From 06534b62ef0fe5856ba7358ec4e968d018e82e95 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Tue, 2 Apr 2013 04:35:38 +0000 Subject: [PATCH] testsuite: samples/Makefile reports pkg-config unavailable. test/Makefile reports samples not built. functions.source augmented appropriately. --- samples/Makefile | 4 ++++ test/Makefile | 5 ++++- test/functions.source | 47 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/samples/Makefile b/samples/Makefile index 82427060..3b07e330 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -83,6 +83,9 @@ BINSRC = addmoddel.cpp \ # Initialisations SHELL = /bin/sh +PKGCONFIG=pkg-config +BAR='****************************************' + .SUFFIXES: .SUFFIXES: .c .cpp .o .so @@ -105,6 +108,7 @@ endif samples: $(BINARY) $(OTHER) $(BINOBJ): %.o: %.cpp + @if [ -z `which $(PKGCONFIG)` ]; then echo $(BAR) $'\\n***' utility $(PKGCONFIG) not available $'***\n'$(BAR) ; exit 42 ; fi $(COMPILE.cc) -I../src -o $@ $< @$(MAKEDEPEND) @$(POSTDEPEND) diff --git a/test/Makefile b/test/Makefile index 5607f0de..2126abb3 100644 --- a/test/Makefile +++ b/test/Makefile @@ -90,7 +90,10 @@ tests: test: @list='$(TESTS)'; for p in $$list; do \ echo Running $$p ...; \ - ./$$p; \ + ./$$p; \ + rc=$$?; \ + if [ $$rc -ne 0 ]; then echo result = $$rc ; fi ; \ + if [ $$rc -gt 2 ]; then exit $$rc ; fi ; \ done testv: diff --git a/test/functions.source b/test/functions.source index 65142411..65a14f92 100644 --- a/test/functions.source +++ b/test/functions.source @@ -340,6 +340,41 @@ extendedTest() rm $tmp } +## +# http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac +real_path () +{ + OIFS=$IFS + IFS='/' + for I in $1; do + # Resolve relative path punctuation. + if [ "$I" = "." ] || [ -z "$I" ]; then + continue + elif [ "$I" = ".." ]; then + FOO="${FOO%%/${FOO##*/}}" + continue + else + FOO="${FOO}/${I}" + fi + + ## Resolve symbolic links + if [ -h "$FOO" ]; then + IFS=$OIFS + set `ls -l "$FOO"` + while shift ; do + if [ "$1" = "->" ]; then + FOO=$2 + shift $# + break + fi + done + IFS='/' + fi + done + IFS=$OIFS + echo "$FOO" +} + ## # prepare temp files and other variables prepareTest() @@ -416,6 +451,18 @@ prepareTest() da2="" fi diffargs="$da1 $da2" + + ## + # test that exiv2 and some sample apps are in the bin! + for e in exiv2 exifprint; do + e="${bin}/${e}${exe}" + if [ ! -e "$e" ]; then + echo '******************************************' + echo '***' $(real_path "$e") does not exist + echo '******************************************' + exit 42 + fi + done } prepareTest