about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-12-13 16:45:02 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-12-13 16:45:02 +0000
commit041c0bd7451c3383b930f75555cc4ba42e2709d6 (patch)
tree6b4c26d60ca0c378ec366cd9127c500f8204e133 /test
parent68c1836441889f462cd1b11ca795381385309e13 (diff)
downloadnetpbm-mirror-041c0bd7451c3383b930f75555cc4ba42e2709d6.tar.gz
netpbm-mirror-041c0bd7451c3383b930f75555cc4ba42e2709d6.tar.xz
netpbm-mirror-041c0bd7451c3383b930f75555cc4ba42e2709d6.zip
More handling in test of not-built programs
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2848 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rwxr-xr-xtest/Available-Testprog65
-rwxr-xr-xtest/Execute-Tests35
-rwxr-xr-xtest/all-in-place.test50
-rwxr-xr-xtest/fiasco-roundtrip.test4
-rwxr-xr-xtest/jbig-roundtrip.test4
-rwxr-xr-xtest/legacy-names.test21
-rwxr-xr-xtest/png-roundtrip.test4
-rwxr-xr-xtest/png-roundtrip2.test4
-rwxr-xr-xtest/ps-roundtrip.test4
-rwxr-xr-xtest/tiff-roundtrip.test4
-rwxr-xr-xtest/utahrle-roundtrip.test4
11 files changed, 96 insertions, 103 deletions
diff --git a/test/Available-Testprog b/test/Available-Testprog
new file mode 100755
index 00000000..7755317e
--- /dev/null
+++ b/test/Available-Testprog
@@ -0,0 +1,65 @@
+#! /bin/bash
+
+# If make target is "check-install" assume that all programs are available
+if [ "${CHECK_TYPE}" = "install" ]; then
+  exit 0
+fi
+
+# Special case: no arguments were passed to this program
+# For all-in-place.test and legacy-names.test
+
+if [ $# = 0 ]; then
+  exit 0
+fi
+
+# Normal operation: Walk through the argument list and exit if an
+# unavailable program is encountered.
+
+for i in $@
+    do
+    case $i in
+      fiascotopnm|\
+      pnmtofiasco)
+        [ "${BUILD_FIASCO}" = "N" ] && exit 1 ;;
+
+      jpeg2ktopam|\
+      pamtojpeg2k)
+        [ "${JASPERLIB}" = "NONE" ] && exit 1 ;;
+
+      jbigtopnm|\
+      pnmtojbig)
+        [ "${JBIGLIB}" = "NONE" ] && exit 1 ;;
+
+      jpegtopnm|\
+      pnmtojpeg|\
+      ppmtojpeg)
+        [ "${JPEGLIB}" = "NONE" ] && exit 1 ;;
+
+      pamtopng|\
+      pngtopam|\
+      pnmtopng|\
+      pamrgbatopng|\
+      pngtopnm)
+        [ "${PNGLIB}" = "NONE" ] && exit 1 ;;
+
+      svgtopam)
+        [ "${PNGLIB}" = "NONE" ] && exit 1
+        [ "${XML2_LIBS}" = "NONE" ] && exit 1 ;;
+
+      pamtotiff|\
+      pnmtotiff|\
+      pnmtotiffcmyk|\
+      tifftopnm)
+        [ "${TIFFLIB}" = "NONE" ] && exit 1 ;;
+
+      pnmtorle|\
+      rletopnm)
+        [ "${URTLIB}" = "NONE" ] && exit 1 ;;
+
+      pamx)
+        [ "${X11LIB}" = "NONE" ] && exit 1 ;;
+    esac
+done
+
+# All checks passed.  Exit with success status.
+exit 0
\ No newline at end of file
diff --git a/test/Execute-Tests b/test/Execute-Tests
index 78091e6b..39d6a5d1 100755
--- a/test/Execute-Tests
+++ b/test/Execute-Tests
@@ -236,18 +236,29 @@ if [ $VALGRIND_TESTS = "on" ]
 fi
 
 # Execute a single test and test its result.
-
-PATH=${testpath} $vg_command ${srcdir}/$tname > ${tname%.test}.out;
-let result=$?
-case $result in
-0)   cmp -s ${tname%.test}.out ${srcdir}/${tname%.test}.ok ;
-     if [ $? -eq 0 ]
-        then let result=0;  rm  ${tname%.test}.out ;
-        else let result=1;
-             grep "^##" ${srcdir}/$tname  # Print failure message.
-     fi ;;
-80) let result=4 ;;
-*)  let result=1 ;;
+# But first see if the target programs and requirements are in place.
+
+${srcdir}/Available-Testprog \
+  `sed -n -e '/^# This script tests: /s/# This script tests: //p' \
+          -e '/^# Also requires: /s/^# Also requires: //p' \
+          -e '/^$/q' ${srcdir}/$tname | tr '\n' ' '`
+case $? in
+0)
+  PATH=${testpath} $vg_command ${srcdir}/$tname > ${tname%.test}.out;
+  let retval=$?
+  case $retval in
+  0)   cmp -s ${tname%.test}.out ${srcdir}/${tname%.test}.ok ;
+       if [ $? -eq 0 ]
+          then let result=0;  rm  ${tname%.test}.out ;
+          else let result=1;
+               grep "^##" ${srcdir}/$tname  # Print failure message.
+       fi ;;
+  80) let result=4 ;;
+  *)  let result=1 ;;
+  esac ;;
+
+1)   let result=4 ;;
+*)   let result=1 ;;
 esac
 
 # Report whether a single test succeeded or failed.
diff --git a/test/all-in-place.test b/test/all-in-place.test
index adcfa6d5..1cdae7f6 100755
--- a/test/all-in-place.test
+++ b/test/all-in-place.test
@@ -367,50 +367,6 @@ ordinary_testprogs="\
   zeisstopnm \
 "
 
-enabled_testprog() {
-    case $1 in
-      fiascotopnm|\
-      pnmtofiasco)
-        [ "${BUILD_FIASCO}" = "N" ] && return 1 ;;
-
-      jpeg2ktopam|\
-      pamtojpeg2k)
-        [ "${JASPERLIB}" = "NONE" ] && return 1 ;;
-
-      jbigtopnm|\
-      pnmtojbig)
-        [ "${JBIGLIB}" = "NONE" ] && return 1 ;;
-
-      jpegtopnm|\
-      pnmtojpeg|\
-      ppmtojpeg)
-        [ "${JPEGLIB}" = "NONE" ] && return 1 ;;
-
-      pamtopng|\
-      pngtopam|\
-      pnmtopng)
-        [ "${PNGLIB}" = "NONE" ] && return 1 ;;
-
-      svgtopam)
-        [ "${PNGLIB}" = "NONE" ] && return 1
-        [ "${XML2_LIBS}" = "NONE" ] && return 1
-        ;;
-
-      pamtotiff|\
-      pnmtotiffcmyk|\
-      tifftopnm)
-        [ "${TIFFLIB}" = "NONE" ] && return 1 ;;
-
-      pnmtorle|\
-      rletopnm)
-        [ "${URTLIB}" = "NONE" ] && return 1 ;;
-
-      pamx)
-        [ "${X11LIB}" = "NONE" ] && return 1 ;;
-    esac
-
-    return 0
-}
 
 # The string "fiascotopnm" has to be filtered out by egrep for fiascotopnm
 # has a slightly different version report format.
@@ -418,10 +374,12 @@ enabled_testprog() {
 for i in $ordinary_testprogs
   do
     # Stub out programs that aren't built.
-    if ! enabled_testprog "$i"; then
+    Available-Testprog "$i"
+      if [ $? = 1 ]; then
+      echo "$i: program was not built" 1>&2
       echo "$i: ok"
       continue
-    fi
+      fi
 
     $i --version  2>&1 | \
     egrep -v -e fiascotopnm -e \
diff --git a/test/fiasco-roundtrip.test b/test/fiasco-roundtrip.test
index 8ba0111a..f733c04a 100755
--- a/test/fiasco-roundtrip.test
+++ b/test/fiasco-roundtrip.test
@@ -2,10 +2,6 @@
 # This script tests: pnmtofiasco fiascotopnm
 # Also requires: pnmpad
 
-if [ "${BUILD_FIASCO}" = "N" ]; then
-  exit 80
-fi
-
 # Should print 215556145 102615
 
 pnmpad --black --bottom 1 --left 1 testimg.ppm | \
diff --git a/test/jbig-roundtrip.test b/test/jbig-roundtrip.test
index 33800348..570d7336 100755
--- a/test/jbig-roundtrip.test
+++ b/test/jbig-roundtrip.test
@@ -2,10 +2,6 @@
 # This script tests: pnmtojbig jbigtopnm
 # Also requires: pamchannel pamtopnm
 
-if [ "${JBIGLIB}" = "NONE" ]; then
-  exit 80
-fi
-
 # Test 1.  Should print 2425386270 41
 pnmtojbig testgrid.pbm | jbigtopnm | cksum
 
diff --git a/test/legacy-names.test b/test/legacy-names.test
index 8dbd97b4..46bc9ee4 100755
--- a/test/legacy-names.test
+++ b/test/legacy-names.test
@@ -94,29 +94,16 @@ ordinary_testprogs="\
   ppmtouil \
 "
 
-enabled_testprog() {
-    case $1 in
-      ppmtojpeg)
-        [ "${JPEGLIB}" = "NONE" ] && return 1 ;;
-
-      pamrgbatopng|\
-      pngtopnm)
-        [ "${PNGLIB}" = "NONE" ] && return 1 ;;
-
-      pnmtotiff)
-        [ "${TIFFLIB}" = "NONE" ] && return 1 ;;
-    esac
-
-    return 0
-}
 
 for i in $ordinary_testprogs
   do
     # Stub out programs that aren't built.
-    if ! enabled_testprog "$i"; then
+    Available-Testprog "$i"
+      if [ $? = 1 ]; then
+      echo "$i: program was not built" 1>&2
       echo "$i: ok"
       continue
-    fi
+      fi
 
     $i --version  2>&1 | \
     egrep -v \
diff --git a/test/png-roundtrip.test b/test/png-roundtrip.test
index d1b3dd76..7e7c4a9b 100755
--- a/test/png-roundtrip.test
+++ b/test/png-roundtrip.test
@@ -6,10 +6,6 @@
 ## If this test fails and pnm-roundtrip2.test succeeds, it indicates
 ## some problem with pnmtopng.
 
-if [ "${PNGLIB}" = "NONE" ]; then
-  exit 80
-fi
-
 # Test 1.  Should print 1926073387 101484 18 times
 for flags in "" -interlace \
   -gamma=.45 \
diff --git a/test/png-roundtrip2.test b/test/png-roundtrip2.test
index b48bbf91..af2ad029 100755
--- a/test/png-roundtrip2.test
+++ b/test/png-roundtrip2.test
@@ -9,10 +9,6 @@
 ## If both tests fail, the likely cause is a problem with pngtopam.
 ## It is also possible that there is some problem in libpng.
 
-if [ "${PNGLIB}" = "NONE" ]; then
-  exit 80
-fi
-
 # Test 1.  Should print 1926073387 101484 twice
 for flags in "" -gamma=.45
   do
diff --git a/test/ps-roundtrip.test b/test/ps-roundtrip.test
index 345795ff..873bbdef 100755
--- a/test/ps-roundtrip.test
+++ b/test/ps-roundtrip.test
@@ -8,10 +8,6 @@
 ## (1) zlib was not linked.
 ## (2) ghostscript is not available.
 
-if [ "${ZLIB}" = "NONE" ]; then
-  exit 80
-fi
-
 tmpdir=${tmpdir:-/tmp}
 
 # pstopnm does not use libnetpbm functions for output.
diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test
index bb8a2dc0..624337f1 100755
--- a/test/tiff-roundtrip.test
+++ b/test/tiff-roundtrip.test
@@ -2,10 +2,6 @@
 # This script tests: pamtotiff tifftopnm
 # Also requires:
 
-if [ "${TIFFLIB}" = "NONE" ]; then
-  exit 80
-fi
-
 # Failure message
 ## Second test fails if Netpbm was built without the flate library
 
diff --git a/test/utahrle-roundtrip.test b/test/utahrle-roundtrip.test
index ff959990..17f1a6c4 100755
--- a/test/utahrle-roundtrip.test
+++ b/test/utahrle-roundtrip.test
@@ -2,10 +2,6 @@
 # This script tests: pnmtorle rletopnm
 # Also requires: pamchannel pamtopnm
 
-if [ "${URTLIB}" = "NONE" ]; then
-  exit 80
-fi
-
 #Test 1.  Should produce 1571496937 33838, cksum of testimg.red
 pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \
   pnmtorle | rletopnm | cksum