diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-12-25 17:36:41 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-12-25 17:36:41 +0000 |
commit | 9df60b4c472359d6d1a92fd62dd74feb002f14fc (patch) | |
tree | 9ea46580cac4aa19cbb07881b98d52200f5b9c36 /test | |
parent | ba0c660b33b95c870f275466af5e6342759e621a (diff) | |
download | netpbm-mirror-9df60b4c472359d6d1a92fd62dd74feb002f14fc.tar.gz netpbm-mirror-9df60b4c472359d6d1a92fd62dd74feb002f14fc.tar.xz netpbm-mirror-9df60b4c472359d6d1a92fd62dd74feb002f14fc.zip |
Copy Development as new Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2861 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rwxr-xr-x | test/Available-Testprog | 52 | ||||
-rwxr-xr-x | test/Execute-Tests | 35 | ||||
-rwxr-xr-x | test/all-in-place.test | 9 | ||||
-rwxr-xr-x | test/jbig-roundtrip.test | 1 | ||||
-rwxr-xr-x | test/legacy-names.test | 9 | ||||
-rwxr-xr-x | test/pbmtext.test | 2 | ||||
-rwxr-xr-x | test/tiff-roundtrip.test | 1 | ||||
-rwxr-xr-x | test/utahrle-roundtrip.test | 1 |
8 files changed, 95 insertions, 15 deletions
diff --git a/test/Available-Testprog b/test/Available-Testprog new file mode 100755 index 00000000..67df13c1 --- /dev/null +++ b/test/Available-Testprog @@ -0,0 +1,52 @@ +#! /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 ;; + + pamtotiff|\ + pnmtotiff|\ + pnmtotiffcmyk|\ + tifftopnm) + [ "${TIFFLIB}" = "NONE" ] && exit 1 ;; + + pnmtorle|\ + rletopnm) + [ "${URTLIB}" = "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 e372d373..1cdae7f6 100755 --- a/test/all-in-place.test +++ b/test/all-in-place.test @@ -367,11 +367,20 @@ ordinary_testprogs="\ zeisstopnm \ " + # The string "fiascotopnm" has to be filtered out by egrep for fiascotopnm # has a slightly different version report format. for i in $ordinary_testprogs do + # Stub out programs that aren't built. + Available-Testprog "$i" + if [ $? = 1 ]; then + echo "$i: program was not built" 1>&2 + echo "$i: ok" + continue + fi + $i --version 2>&1 | \ egrep -v -e fiascotopnm -e \ "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ diff --git a/test/jbig-roundtrip.test b/test/jbig-roundtrip.test index 5e96a001..570d7336 100755 --- a/test/jbig-roundtrip.test +++ b/test/jbig-roundtrip.test @@ -2,7 +2,6 @@ # This script tests: pnmtojbig jbigtopnm # Also requires: pamchannel pamtopnm - # Test 1. Should print 2425386270 41 pnmtojbig testgrid.pbm | jbigtopnm | cksum diff --git a/test/legacy-names.test b/test/legacy-names.test index 30509d20..46bc9ee4 100755 --- a/test/legacy-names.test +++ b/test/legacy-names.test @@ -94,8 +94,17 @@ ordinary_testprogs="\ ppmtouil \ " + for i in $ordinary_testprogs do + # Stub out programs that aren't built. + Available-Testprog "$i" + if [ $? = 1 ]; then + echo "$i: program was not built" 1>&2 + echo "$i: ok" + continue + fi + $i --version 2>&1 | \ egrep -v \ "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ diff --git a/test/pbmtext.test b/test/pbmtext.test index 064b1660..eeb8bf50 100755 --- a/test/pbmtext.test +++ b/test/pbmtext.test @@ -81,12 +81,14 @@ rm ${fontRectangle_txt} ${font_pbm} # One long row # Should print 3233136020 4535 +LC_CTYPE=C \ awk 'BEGIN { for (i=32; i<=125;++i) printf("%c",i); for (i=160;i<=255;++i) printf("%c",i); }' | \ pbmtext -builtin bdf | cksum # One tall column # Should print 1216262214 5711 +LC_CTYPE=C \ awk 'BEGIN { for (i=32; i<=125;++i) printf("%c\n",i); for (i=160;i<=255;++i) printf("%c\n",i); }' | \ pbmtext -nomargins -builtin bdf | cksum diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test index a99425fa..624337f1 100755 --- a/test/tiff-roundtrip.test +++ b/test/tiff-roundtrip.test @@ -2,7 +2,6 @@ # This script tests: pamtotiff tifftopnm # Also requires: - # 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 982b72a9..17f1a6c4 100755 --- a/test/utahrle-roundtrip.test +++ b/test/utahrle-roundtrip.test @@ -2,7 +2,6 @@ # This script tests: pnmtorle rletopnm # Also requires: pamchannel pamtopnm - #Test 1. Should produce 1571496937 33838, cksum of testimg.red pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pnmtorle | rletopnm | cksum |