about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-12-13 00:08:51 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-12-13 00:08:51 +0000
commita5d06d531c80a96a4041f8f19bdf89b847f71e80 (patch)
treeae8dafc409a0d8a88edae4fcec8b00298f3a8835 /test
parentb62eff9e0c76dcdab094bf9fe32355c543ea909f (diff)
downloadnetpbm-mirror-a5d06d531c80a96a4041f8f19bdf89b847f71e80.tar.gz
netpbm-mirror-a5d06d531c80a96a4041f8f19bdf89b847f71e80.tar.xz
netpbm-mirror-a5d06d531c80a96a4041f8f19bdf89b847f71e80.zip
miscellaneous test updates
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4201 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rwxr-xr-xtest/cis-roundtrip.test2
-rwxr-xr-xtest/cut-paste-roundtrip.test1
-rwxr-xr-xtest/lookup-roundtrip.test2
-rw-r--r--test/pamarith-compare-equal.ok10
-rwxr-xr-xtest/pamarith-compare-equal.test2
-rw-r--r--test/pamchannel.ok8
-rwxr-xr-xtest/pamchannel.test25
-rwxr-xr-xtest/pamcrater.test10
-rwxr-xr-xtest/pamcut.test30
-rwxr-xr-xtest/pamdepth.test4
-rwxr-xr-xtest/pamdice-roundtrip.test2
-rwxr-xr-xtest/pamditherbw.test24
-rwxr-xr-xtest/pamenlarge-pbm.test2
-rwxr-xr-xtest/pamfile.test6
-rwxr-xr-xtest/pamfind.test8
-rwxr-xr-xtest/pamfix.test4
-rwxr-xr-xtest/pamgauss.test10
-rwxr-xr-xtest/pamhue.test2
-rwxr-xr-xtest/pamscale-reportonly.test12
-rwxr-xr-xtest/pamseq.test8
-rwxr-xr-xtest/pamstretch.test7
-rwxr-xr-xtest/pamsumm.test8
-rwxr-xr-xtest/pamundice.test24
-rwxr-xr-xtest/pbmclean.test2
-rwxr-xr-xtest/pbmmake.test16
-rwxr-xr-xtest/pbmpage.test6
-rwxr-xr-xtest/pbmpscale.test6
-rwxr-xr-xtest/pbmtext-bdf.test2
-rwxr-xr-xtest/pbmtopgm.test8
-rwxr-xr-xtest/pbmupc.test18
-rwxr-xr-xtest/pgmhist.test8
-rwxr-xr-xtest/pgmmake.test16
-rwxr-xr-xtest/pgmnoise-parameters.test10
-rwxr-xr-xtest/pgmnoise.test22
-rwxr-xr-xtest/pgmtoppm.test26
-rw-r--r--test/pnmcat.ok84
-rwxr-xr-xtest/pnmcat.test119
-rwxr-xr-xtest/pnmcolormap.test14
-rw-r--r--test/pnminvert.ok7
-rwxr-xr-xtest/pnminvert.test17
-rwxr-xr-xtest/pnmpsnr.test8
-rwxr-xr-xtest/pnmquant.test16
-rwxr-xr-xtest/pnmremap1.test12
-rwxr-xr-xtest/pnmtile.test8
-rwxr-xr-xtest/ppmbrighten.test3
-rwxr-xr-xtest/ppmforge-parameters.test14
-rwxr-xr-xtest/ppmhist.test6
-rwxr-xr-xtest/ppmmake.test20
-rwxr-xr-xtest/ppmpat.test52
-rwxr-xr-xtest/ppmtoarbtxt-roundtrip.test3
-rw-r--r--test/ppmtoppm.ok24
-rwxr-xr-xtest/ppmtoppm.test13
-rw-r--r--test/ppmwheel.ok1
-rwxr-xr-xtest/ppmwheel.test17
-rw-r--r--test/ps-alt-roundtrip.ok4
-rwxr-xr-xtest/ps-alt-roundtrip.test11
-rw-r--r--test/ps-flate-roundtrip.ok4
-rwxr-xr-xtest/ps-flate-roundtrip.test13
-rw-r--r--test/ps-roundtrip.ok9
-rwxr-xr-xtest/ps-roundtrip.test18
-rw-r--r--test/rgb3-roundtrip.ok8
-rwxr-xr-xtest/rgb3-roundtrip.test34
-rw-r--r--test/sgi-roundtrip.ok13
-rwxr-xr-xtest/sgi-roundtrip.test29
-rw-r--r--test/targa-roundtrip.ok10
-rwxr-xr-xtest/targa-roundtrip.test19
-rw-r--r--test/tiff-flate-lzw-roundtrip.ok2
-rwxr-xr-xtest/tiff-flate-lzw-roundtrip.test10
-rw-r--r--test/tiff-roundtrip.ok14
-rwxr-xr-xtest/tiff-roundtrip.test24
70 files changed, 620 insertions, 391 deletions
diff --git a/test/cis-roundtrip.test b/test/cis-roundtrip.test
index 35eb558a..4ad1a5e4 100755
--- a/test/cis-roundtrip.test
+++ b/test/cis-roundtrip.test
@@ -16,3 +16,5 @@ pbmtocis ${test_pbm} | cistopbm | cksum
 echo "Test 2. Should print 281226646 481, cksum of maze.pbm"
 size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}')
 pbmtocis maze.pbm | cistopbm | pamcut -left=0 -top=0 ${size} | cksum
+
+rm ${test_pbm}
\ No newline at end of file
diff --git a/test/cut-paste-roundtrip.test b/test/cut-paste-roundtrip.test
index 1bb3a7c2..ac2c0fe7 100755
--- a/test/cut-paste-roundtrip.test
+++ b/test/cut-paste-roundtrip.test
@@ -2,6 +2,7 @@
 # This script tests: pamcut pnmpaste
 # Also requires: pbmmake pnmpad
 
+tmpdir=${tmpdir:-/tmp}
 base_ppm=${tmpdir}/base.ppm
 
 # Test 1. Should produce 2999529086 101484
diff --git a/test/lookup-roundtrip.test b/test/lookup-roundtrip.test
index 63ec0777..491294a2 100755
--- a/test/lookup-roundtrip.test
+++ b/test/lookup-roundtrip.test
@@ -10,3 +10,5 @@ ppmhist testimg.ppm -map > ${mapfile}
 # Test.  Should produce 1926073387 101484
 pamunlookup -lookupfile=${mapfile} testimg.ppm |\
   pamlookup -lookupfile=${mapfile} | cksum
+
+rm ${mapfile}
\ No newline at end of file
diff --git a/test/pamarith-compare-equal.ok b/test/pamarith-compare-equal.ok
index 2a16d8bb..d6b1f624 100644
--- a/test/pamarith-compare-equal.ok
+++ b/test/pamarith-compare-equal.ok
@@ -35,6 +35,12 @@ Test 2
 8:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
 Test 3
 1:P1
+1:35 33
+33:00000000000000000000000000000000000
+1:P1
+1:35 33
+33:11111111111111111111111111111111111
+1:P1
 1:14 16
 8:10101010101010 11111111111111
 1:P1
@@ -42,6 +48,10 @@ Test 3
 8:01010101010101 00000000000000
 Test 4
 1:P2
+1:35 33
+1:2
+33:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
+1:P2
 1:14 16
 1:2
 8:0 2 0 2 0 2 0 2 0 2 0 2 0 2  0 0 0 0 0 0 0 0 0 0 0 0 0 0 
diff --git a/test/pamarith-compare-equal.test b/test/pamarith-compare-equal.test
index e143a04c..0af9ee27 100755
--- a/test/pamarith-compare-equal.test
+++ b/test/pamarith-compare-equal.test
@@ -37,7 +37,7 @@ rm ${input1_ppm} ${inputm_ppm} ${input2_ppm}
 echo "Test 3"
 
 input3_pbm=${tmpdir}/input3.pbm
-pamcut maze.pbm -left=0 -right=0 -width=35 -height=33 > ${input3_pbm} 
+pamcut maze.pbm -left=0 -top=0 -width=35 -height=33 > ${input3_pbm} 
 
 pamarith -equal -plain ${input3_pbm} ${input3_pbm}  | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
diff --git a/test/pamchannel.ok b/test/pamchannel.ok
index 41d3f890..91629202 100644
--- a/test/pamchannel.ok
+++ b/test/pamchannel.ok
@@ -1,9 +1,11 @@
-Test 1
+Test 1:red-channel  Should produce 1571496937 33838
 1571496937 33838
-Test 2
+Test 2:green-channel  Should produce 394856971 33838
 394856971 33838
-Test 3
+Test 3:blue-channel  Should produce 3164158573 33838
 3164158573 33838
+Test 4:single-channel  Should produce 281226646 481
+281226646 481
 Test Invalid
 Expected failure 1 1
 Expected failure 2 1
diff --git a/test/pamchannel.test b/test/pamchannel.test
index 6bb0cf67..bce1d4eb 100755
--- a/test/pamchannel.test
+++ b/test/pamchannel.test
@@ -12,27 +12,23 @@
 # 3164158573 33838 testimg.blu
 
 
-# Test 1. red channel
-# Should produce 1571496937 33838
-echo "Test 1"
-
+echo "Test 1:red-channel  Should produce 1571496937 33838"
 pamchannel -infile testimg.ppm 0 | \
   pamtopnm --assume | cksum
 
-# Test 2. green channel
-# Should produce  394856971 33838
-echo "Test 2"
-
+echo "Test 2:green-channel  Should produce 394856971 33838"
 pamchannel -infile testimg.ppm -tupletype="GRAYSCALE" 1 | \
   pamtopnm | cksum
 
-# Test 3. blue channel
-# Should produce 3164158573 33838
-echo "Test 3"
+echo "Test 3:blue-channel  Should produce 3164158573 33838"
 
 pamchannel -infile testimg.ppm 2 | \
   pamtopnm --assume | cksum
 
+echo "Test 4:single-channel  Should produce 281226646 481"
+pamchannel -infile maze.pbm 0 | \
+  pamtopnm --assume | cksum
+
 # Test invalid: specified channel does not exist
 
 echo 1>&2
@@ -48,14 +44,15 @@ echo "Test Invalid"
 pamchannel  -infile testgrid.pbm 1 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamchannel  -infile testimg.ppm 3 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
+
diff --git a/test/pamcrater.test b/test/pamcrater.test
index 027e34e3..25b12135 100755
--- a/test/pamcrater.test
+++ b/test/pamcrater.test
@@ -52,7 +52,7 @@ pamshadedrelief ${test100_pam} > ${testshaded_pam}
   pamcut -top=$((128 - 99)) -height=1  ${testshaded_pam} | cksum
 ) | uniq -c | awk '{print $1}'
 
-rm ${testshaded_pam} ${test100_pam}
+rm ${testshaded_pam} ${test100_pam} ${test150_pam}
 
 echo "Test Invalid."
 
@@ -66,19 +66,19 @@ echo "------------------------------" 1>&2
 pamcrater -width 0 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcrater -height 0 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcrater -number 0 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcrater -test -radius=10 | pamshadedrelief -gamma 0 > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamcut.test b/test/pamcut.test
index f03365f9..e18c3cf2 100755
--- a/test/pamcut.test
+++ b/test/pamcut.test
@@ -57,77 +57,77 @@ echo "-----------------------------------------------------------" 1>&2
 pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # excessive cropping
 pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # pad absent
 pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut -croptop=1  -height=16 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 11"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # legacy style: insufficient number of positional parameters
 pamcut 5 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 12"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut 5 4 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 13"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamcut 5 5 30 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 14"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamdepth.test b/test/pamdepth.test
index eaa1b165..86f6c952 100755
--- a/test/pamdepth.test
+++ b/test/pamdepth.test
@@ -32,9 +32,9 @@ echo "-----------------------------------------------------------" 1>&2
 pamdepth 0 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamdepth 65536 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamdice-roundtrip.test b/test/pamdice-roundtrip.test
index b387a8ea..741615f5 100755
--- a/test/pamdice-roundtrip.test
+++ b/test/pamdice-roundtrip.test
@@ -42,7 +42,7 @@ tiles=$(( (${mh}+${height}-1) / ${height} ))
 
 pamdice maze.pbm -outstem=${fname_stem} -height=${height}
 pamundice ${fname_stem}_%1d_%1a.pbm -down=${tiles} | cksum
-#rm ${fname_stem}_*_*.pbm
+rm ${fname_stem}_*_*.pbm
 
 echo "Test 5.  Should print 1926073387 101484 five times"
 
diff --git a/test/pamditherbw.test b/test/pamditherbw.test
index 378d7e94..43d2b00f 100755
--- a/test/pamditherbw.test
+++ b/test/pamditherbw.test
@@ -49,61 +49,61 @@ echo "-----------------------------------------------------------" 1>&2
 pamditherbw -fs -atkinson       ${test_red} > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -floyd -atkinson    ${test_red} > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -dither8  -cluster3 ${test_red} > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -clump=8            ${test_red} > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -fs -clump=8        ${test_red} > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -hilbert -clump=1   ${test_red} > ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -th -value=-1       ${test_red} > ${test_out} || \
   echo -n "Expected failure 11"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamditherbw -th -value=1.1      ${test_red} > ${test_out} || \
   echo -n "Expected failure 12"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 rm ${test_red}
diff --git a/test/pamenlarge-pbm.test b/test/pamenlarge-pbm.test
index 10c00ba0..87493516 100755
--- a/test/pamenlarge-pbm.test
+++ b/test/pamenlarge-pbm.test
@@ -58,4 +58,4 @@ for width in `seq 16`
       #
     done
 
-rm ${test3_pbm}.[1-9]  ${test3_pbm}.1[1-6]
\ No newline at end of file
+rm ${test3_pbm}.[1-9]  ${test3_pbm}.1[0-6]
\ No newline at end of file
diff --git a/test/pamfile.test b/test/pamfile.test
index 16d084ea..41aa3c85 100755
--- a/test/pamfile.test
+++ b/test/pamfile.test
@@ -33,14 +33,14 @@ echo "-----------------------------------------------------------" 1>&2
 pamfile -size -machine  testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamfile -count -machine testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 head -n1 testimg.ppm | pamfile > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamfind.test b/test/pamfind.test
index 7b612f78..e689754f 100755
--- a/test/pamfind.test
+++ b/test/pamfind.test
@@ -46,19 +46,19 @@ echo "Test Invalid"
 pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamfind -target=0,0 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamfind -target=0,0,0,0 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamfind testimg.ppm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamfix.test b/test/pamfix.test
index d13e0230..1293dfe2 100755
--- a/test/pamfix.test
+++ b/test/pamfix.test
@@ -1,6 +1,8 @@
 #! /bin/bash
 # This script tests: pamfix
-# Also requires:
+# Also requires: pbmmake
+
+tmpdir=${tmpdir:-/tmp}
 
 # Test 1.
 echo "Test 1"
diff --git a/test/pamgauss.test b/test/pamgauss.test
index 7952c7df..87e172a8 100755
--- a/test/pamgauss.test
+++ b/test/pamgauss.test
@@ -30,24 +30,24 @@ test_out=${tmpdir}/test_out
 pamgauss 3 3               > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamgauss 3 3   -sigma=0    > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamgauss 3 3   -sigma=-1.5 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamgauss 3     -sigma=0.5  > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamgauss 3 3 3 -sigma=0.5  > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamhue.test b/test/pamhue.test
index 627823b5..622fdf2f 100755
--- a/test/pamhue.test
+++ b/test/pamhue.test
@@ -45,4 +45,4 @@ echo "-----------------------------------------------------------" 1>&2
 pamhue testimg.ppm  > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test
index 9aacab56..a5d2cdcc 100755
--- a/test/pamscale-reportonly.test
+++ b/test/pamscale-reportonly.test
@@ -33,34 +33,34 @@ pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \
   ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm > \
   ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm \
   > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm \
   > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamscale -reportonly -xsize=640 -ysize=400 -xyfit  640 400 testimg.ppm \
   > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm \
   > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamseq.test b/test/pamseq.test
index 9c089cf3..a98a6545 100755
--- a/test/pamseq.test
+++ b/test/pamseq.test
@@ -19,17 +19,17 @@ test_out=${tmpdir}/test_out
 pamseq 1 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamseq 0 255 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamseq 3 0   > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 c64="0123456789012345678901234567890123456789012345678901234567890123"
 c256=${c64}${c64}${c64}${c64}
@@ -39,4 +39,4 @@ c256=${c64}${c64}${c64}${c64}
 pamseq -tupletype="${c256}" 3 15 > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamstretch.test b/test/pamstretch.test
index 55dd4e9c..8cbc555a 100755
--- a/test/pamstretch.test
+++ b/test/pamstretch.test
@@ -13,6 +13,7 @@ pamstretch -xscale=2 -blackedge testimg.ppm | cksum
 
 # Test 3.  Should print 3427416462 301047
 echo test 3
+tmpdir=${tmpdir:-/tmp}
 dropedge1_ppm=${tmpdir}/drop1.ppm
 pamstretch -yscale=3 -dropedge testimg.ppm | tee ${dropedge1_ppm} | cksum
 
@@ -39,10 +40,10 @@ blackedge_ppm=${tmpdir}/black.ppm
 pamstretch 3 testimg.ppm | tee ${stretch_ppm} | cksum
 pamstretch 3 -blackedge testimg.ppm | tee ${blackedge_ppm} | cksum
 pamstretch -xscale=3 -dropedge ${dropedge1_ppm} | tee ${dropedge_ppm} | cksum
-width_height=`pamfile -size ${dropedge_ppm} | \
-              awk '{print "-width="$1, "-height="$2}'`
+width_height=$(pamfile -size ${dropedge_ppm} | \
+              awk '{print "-width="$1, "-height="$2}')
 pamcut -left=0 -top=0 ${width_height} ${stretch_ppm} | cksum
 pamcut -left=0 -top=0 ${width_height} ${blackedge_ppm} | cksum
 pamcut -left=0 -top=0 ${width_height} ${dropedge_ppm} | cksum
 
-rm ${stretch_ppm} ${dropedge_ppm} ${dropedge1_ppm} ${blackedge_ppm}
\ No newline at end of file
+rm ${stretch_ppm} ${dropedge_ppm} ${dropedge1_ppm} ${blackedge_ppm}
diff --git a/test/pamsumm.test b/test/pamsumm.test
index f98800ee..32a9b8c1 100755
--- a/test/pamsumm.test
+++ b/test/pamsumm.test
@@ -37,19 +37,19 @@ echo "-----------------------------------------------------------" 1>&2
 pamsumm -sum -min  testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamsumm -sum -max  testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamsumm -mean -max testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pamsumm            testimg.ppm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pamundice.test b/test/pamundice.test
index d412cde1..1e3dd31b 100755
--- a/test/pamundice.test
+++ b/test/pamundice.test
@@ -125,76 +125,76 @@ echo "-----------------------------------------------------------" 1>&2
 pamundice -down=5 -across=2 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # -down=0
 pamundice -down=0 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # -across=0
 pamundice -down=5 -across=0 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # -down too large
 pamundice -down=6 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # -across too large
 pamundice -down=5 -across=3 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # precision does not match
 pamundice -down=5 -across=2 ${fname_stem}_"%2d"_"%2a".pbm > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # precision set to zero
 pamundice -down=5 -across=2 ${fname_stem}_"%0d"_"%0a".pbm > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # no precision
 pamundice -down=5 -across=2 ${fname_stem}_"%d"_"%a".pbm > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # -hoverlap too large
 pamundice -down=5 -across=2 -hoverlap=$((${mw}+1)) \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # -voverlap too large
 pamundice -down=5 -across=2 -voverlap=$((${mh}+1)) \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # corrupt listfile : file names do not exist
 seq 10 | sed -e 's/^/::::::/' -e 's/$/::::::/' | \
   pamundice -down=5 -across=2 -listfile=- > ${test_out} || \
   echo -n "Expected failure 11"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # listfile with insufficient lines (insufficient file entries)
 ls ${fname_stem}_*_*.pbm | head -n 9 | \
   pamundice -down=5 -across=2 -listfile=- > ${test_out} || \
   echo -n "Expected failure 12"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 rm ${fname_stem}*.pbm
diff --git a/test/pbmclean.test b/test/pbmclean.test
index 3fb24b25..0e17ba8a 100755
--- a/test/pbmclean.test
+++ b/test/pbmclean.test
@@ -48,6 +48,6 @@ echo "-----------------------------------------------------------" 1>&2
 pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # note that without -extended the above is valid.
diff --git a/test/pbmmake.test b/test/pbmmake.test
index 9945394a..eef4e0da 100755
--- a/test/pbmmake.test
+++ b/test/pbmmake.test
@@ -34,39 +34,39 @@ test_out=${tmpdir}/test_out
 pbmmake -b -w -plain 1 1 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmmake -b -g -plain 1 1 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmmake -white -gray -plain 1 1 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmmake -white -plain   > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmmake -white -plain 1 > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmmake -white -plain 1 0 > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmmake -white -plain 0 1 > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmmake -white -plain 1 1 1 > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pbmpage.test b/test/pbmpage.test
index cfacefa7..2ee27122 100755
--- a/test/pbmpage.test
+++ b/test/pbmpage.test
@@ -22,14 +22,14 @@ test_out=${tmpdir}/test_out
 pbmpage -a3 1 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmpage 0 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmpage 4 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pbmpscale.test b/test/pbmpscale.test
index 29621a8c..a92511b0 100755
--- a/test/pbmpscale.test
+++ b/test/pbmpscale.test
@@ -38,14 +38,14 @@ echo "-----------------------------------------------------------" 1>&2
 pbmpscale testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmpscale 0 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmpscale 2 3 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pbmtext-bdf.test b/test/pbmtext-bdf.test
index b12c10bf..d3d4b37f 100755
--- a/test/pbmtext-bdf.test
+++ b/test/pbmtext-bdf.test
@@ -173,3 +173,5 @@ do
   echo $?
   rm ${font_corrupt_bdf}
 done
+
+rm ${font_bdf}
\ No newline at end of file
diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test
index dc872640..53b25aab 100755
--- a/test/pbmtopgm.test
+++ b/test/pbmtopgm.test
@@ -20,19 +20,19 @@ echo "-----------------------------------------------------------" 1>&2
 pbmtopgm 5 0 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmtopgm 0 9 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmtopgm 15 5 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmtopgm 5 17 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pbmupc.test b/test/pbmupc.test
index a29a06f3..f4a4d1e8 100755
--- a/test/pbmupc.test
+++ b/test/pbmupc.test
@@ -22,44 +22,44 @@ echo "-----------------------------------------------------------" 1>&2
 pbmupc -s3 0 72890 00011     > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1   72890 00011     > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1 0 72890           > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1 10 72890 00011    > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1 0 172890 00011    > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1 0   2890 00011    > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1 0 72890 100011    > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1 0 72890   0011    > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pbmupc -s1 0 72890 100011 1  > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pgmhist.test b/test/pgmhist.test
index 0179a4f6..b028b07a 100755
--- a/test/pgmhist.test
+++ b/test/pgmhist.test
@@ -37,19 +37,19 @@ echo "-----------------------------------------------------------" 1>&2
 pgmhist -median   -quartile testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmhist -median   -decile   testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmhist -quartile -decile   testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmhist testimg.ppm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pgmmake.test b/test/pgmmake.test
index bd9882a5..0ec5efd6 100755
--- a/test/pgmmake.test
+++ b/test/pgmmake.test
@@ -21,39 +21,39 @@ test_out=${tmpdir}/test_out
 pgmmake 100  5 5 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmmake 1.01 5 5 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmmake .5   5   > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmmake .5       > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmmake -maxval=5        5 5 > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmmake -maxval=0     .5 5 5 > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmmake -maxval=-1    .5 5 5 > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmmake -maxval=65536 .5 5 5 > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test
index d2a96530..bf3deb3f 100755
--- a/test/pgmnoise-parameters.test
+++ b/test/pgmnoise-parameters.test
@@ -13,24 +13,24 @@ echo "-----------------------------------------------------------" 1>&2
 pgmnoise -maxval=255  -randomseed=1 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 100 -randomseed=1 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 100 0 -randomseed=1 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 0 100 -randomseed=1 > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pgmnoise.test b/test/pgmnoise.test
index ab98a5e2..4a6e21dd 100755
--- a/test/pgmnoise.test
+++ b/test/pgmnoise.test
@@ -1,6 +1,6 @@
 #! /bin/bash
 # This script tests: pgmnoise
-# Also requires: pgmhist pamvalidate
+# Also requires: pgmhist pamvalidate pamfile
 
 echo "Test 1."
 echo "Should print: 2132901423 10015" # (Mersenne Twister)
@@ -70,49 +70,49 @@ echo "-----------------------------------------------------------" 1>&2
 pgmnoise 0 0  > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 0 1  > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 1 0  > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise      > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 1    > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise 100 -1 > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise -randomseed=-1 100 100  > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise -maxval=-1 100 100  > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise -maxval=0 100 100  > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmnoise -maxval=$((256 * 256 * 256 * 256)) 10 10 > ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pgmtoppm.test b/test/pgmtoppm.test
index e9bd1a59..622a0688 100755
--- a/test/pgmtoppm.test
+++ b/test/pgmtoppm.test
@@ -1,6 +1,6 @@
 #! /bin/bash
 # This script tests: pgmtoppm
-# Also requires: pamtopnm pgmtoppm pnminvert pamseq pgmramp
+# Also requires: pamtopnm pnminvert pamseq pgmramp
 
 tmpdir=${tmpdir:-/tmp}
 
@@ -68,72 +68,72 @@ pgmtoppm white testimg.ppm > \
   ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm -map=/dev/null testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm black white testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm hwite testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm off-color testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm rgb-255:7/7/7 testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm -black=black -white=white white testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm -black=rgb:0/0/0 -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm -white=rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pgmtoppm rgb:00/00/00-rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
   echo -n "Expected failure 11"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 #pgmtoppm rgb-255:7/7/7 testgrid.pbm > \
 #  ${test_out} || \
 #  echo -n "Expected failure 12"
 #  test -s ${test_out}; echo " "$?
-#  rm -f {test_out}
+#  rm -f ${test_out}
 
 rm -f ${palette_ppm}
diff --git a/test/pnmcat.ok b/test/pnmcat.ok
index b92a1420..57769353 100644
--- a/test/pnmcat.ok
+++ b/test/pnmcat.ok
@@ -1,8 +1,82 @@
-Test 1.
-1704087873 73
-4150323653 73
-1522490272 202953
-2862441566 202953
+Test 1.  Should print a simple PBM image four times
+P1
+2 2
+01
+10
+P1
+2 2
+01
+10
+P1
+2 2
+01
+10
+P1
+2 2
+01
+10
+Test 2.  Should print 2197356643 895 twice
+2197356643 895
+2197356643 895
+Test 3.  Should print 3313353797 954
+3313353797 954
+Test 4.  Should print 1731660895 1308 three times
+1731660895 1308
+1731660895 1308
+1731660895 1308
+Test 5.  Should print 2985957591 1426 three times
+2985957591 1426
+2985957591 1426
+2985957591 1426
+Test 6.  Should print a simple PGM image three times
+P2
+4 4
+3
+0 0 1 1
+0 1 1 2
+1 1 2 2
+1 2 2 3
+P2
+4 4
+3
+0 0 1 1
+0 1 1 2
+1 1 2 2
+1 2 2 3
+P2
+4 4
+3
+0 0 1 1
+0 1 1 2
+1 1 2 2
+1 2 2 3
+Test 7.  Should print 2097565808 394 twice
+2097565808 394
+2097565808 394
+Test 8.  Should print 3086569577 394
+3086569577 394
+Test 9.  Should print 4288335051 586 three times
+4288335051 586
+4288335051 586
+4288335051 586
+Test 10.  Should print 642720605 586 three times
+642720605 586
+642720605 586
+642720605 586
+Test 11.  Should print 3622741282 1019 twice
+3622741282 1019
+3622741282 1019
+Test 12.  Should print 1401081637 1019
+1401081637 1019
+Test 13.  Should print 2756501917 1019
+2756501917 1019
+Test 14. Should print 587933655 107742 twice
+587933655 107742
+587933655 107742
+Test 15.  Should print 3948141157 107742
+3948141157 107742
+Test 16.  Should print 3910239002 107742
+3910239002 107742
 Test Invalid
 Expected failure 1 1
 Expected failure 2 1
diff --git a/test/pnmcat.test b/test/pnmcat.test
index 519e01c7..46bc7b51 100755
--- a/test/pnmcat.test
+++ b/test/pnmcat.test
@@ -1,18 +1,91 @@
 #! /bin/bash
 # This script tests: pnmcat
-# Also requires:
+# Also requires: pbmmake pgmramp ppmtoppm
 
-echo "Test 1."
-
-pnmcat -lr testgrid.pbm testgrid.pbm | cksum
-pnmcat -tb testgrid.pbm testgrid.pbm | cksum
-
-pnmcat -lr testimg.ppm testimg.ppm | cksum
-pnmcat -tb testimg.ppm testimg.ppm | cksum
+tmpdir=${tmpdir:-/tmp}
+check2x2_pbm=${tmpdir}/check2x2.pbm
+maze2lr_pbm=${tmpdir}/maze2lr.pbm
+maze2tb_pbm=${tmpdir}/maze2tb.pbm
+diag_pgm=${tmpdir}/diag.pgm
+diag_ppm=${tmpdir}/diag.ppm
+diag2lr_ppm=${tmpdir}/diag2lr.ppm
+diag2tb_ppm=${tmpdir}/diag2tb.ppm
+
+echo "Test 1.  Should print a simple PBM image four times"
+pbmmake -g 2 2 | tee ${check2x2_pbm} | pnmcat -lr -plain
+pnmcat -tb -plain ${check2x2_pbm}
+pnmcat -lr -black -plain ${check2x2_pbm}
+cat ${check2x2_pbm} | pnmcat -tb -white -plain
+
+rm ${check2x2_pbm}
+
+echo "Test 2.  Should print 2197356643 895 twice"
+pnmcat -lr -white maze.pbm maze.pbm | tee ${maze2lr_pbm} | cksum
+cat maze.pbm | pnmcat -lr -black maze.pbm - | cksum
+
+echo "Test 3.  Should print 3313353797 954"
+pnmcat -tb maze.pbm maze.pbm | tee ${maze2tb_pbm} | cksum
+
+echo "Test 4.  Should print 1731660895 1308 three times"
+pnmcat -lr maze.pbm maze.pbm maze.pbm | cksum
+pnmcat -lr ${maze2lr_pbm} maze.pbm | cksum
+cat ${maze2lr_pbm} | pnmcat -lr - maze.pbm | cksum
+
+echo "Test 5.  Should print 2985957591 1426 three times"
+pnmcat -tb maze.pbm maze.pbm maze.pbm | cksum
+pnmcat -tb maze.pbm ${maze2tb_pbm} | cksum
+cat maze.pbm | pnmcat -tb - ${maze2tb_pbm} | cksum
+
+rm ${maze2lr_pbm} ${maze2tb_pbm}
+
+echo "Test 6.  Should print a simple PGM image three times"
+pgmramp -diag 4 4 -maxval=3 | tee ${diag_pgm} | pnmcat -lr -plain
+pnmcat -tb -plain ${diag_pgm}
+cat ${diag_pgm} | pnmcat -tb -plain
+
+rm ${diag_pgm}
+
+pgmramp -diag 8 8 -maxval 7 | ppmtoppm > ${diag_ppm} 
+
+echo "Test 7.  Should print 2097565808 394 twice"
+pnmcat -lr -black ${diag_ppm} ${diag_ppm} | tee ${diag2lr_ppm} | cksum
+cat ${diag_ppm} | pnmcat -lr -white ${diag_ppm} - | cksum
+
+echo "Test 8.  Should print 3086569577 394"
+pnmcat -tb ${diag_ppm} ${diag_ppm} | tee ${diag2tb_ppm} | cksum
+
+echo "Test 9.  Should print 4288335051 586 three times"
+pnmcat -lr ${diag_ppm} ${diag_ppm} ${diag_ppm} | cksum
+pnmcat -lr ${diag_ppm}  ${diag2lr_ppm} | cksum 
+cat ${diag2lr_ppm} | pnmcat -lr - ${diag_ppm} | cksum
+
+echo "Test 10.  Should print 642720605 586 three times"
+pnmcat -tb ${diag_ppm} ${diag_ppm} ${diag_ppm} | cksum
+pnmcat -tb ${diag2tb_ppm} ${diag_ppm} | cksum
+cat ${diag_ppm} | pnmcat -tb ${diag2tb_ppm} - | cksum
+
+rm ${diag2lr_ppm} ${diag2tb_ppm}
+
+echo "Test 11.  Should print 3622741282 1019 twice"
+pnmcat -tb -white testgrid.pbm ${diag_ppm} | tee /tmp/a.ppm | cksum
+pnmcat -tb -jcenter -white testgrid.pbm ${diag_ppm} | tee /tmp/c.ppm | cksum
+echo "Test 12.  Should print 1401081637 1019"
+pnmcat -tb -jleft -white testgrid.pbm ${diag_ppm}  | tee /tmp/b.ppm | cksum
+echo "Test 13.  Should print 2756501917 1019"
+pnmcat -tb -jright -white testgrid.pbm ${diag_ppm} | tee /tmp/d.ppm | cksum
+
+echo "Test 14. Should print 587933655 107742 twice"
+pnmcat -lr -black testgrid.pbm testimg.ppm | tee /tmp/e.ppm | cksum
+pnmcat -lr -jcenter -black testgrid.pbm testimg.ppm | tee /tmp/g.ppm | cksum
+echo "Test 15.  Should print 3948141157 107742"
+pnmcat -lr -jtop -black testgrid.pbm testimg.ppm | tee /tmp/f.ppm | cksum
+echo "Test 16.  Should print 3910239002 107742"
+pnmcat -lr -jbottom -black testgrid.pbm testimg.ppm | tee /tmp/h.ppm | cksum
+
+rm ${diag_ppm}
 
 echo "Test Invalid"
 
-tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 echo 1>&2
@@ -24,74 +97,74 @@ echo "-----------------------------------------------------------" 1>&2
 pnmcat testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # both directions specified
 pnmcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # both pad colors specified
 pnmcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # justification parameters overspecified
 pnmcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # justification parameter in the wrong direction
 pnmcat -lr -jleft    testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -lr -jright   testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 11"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -tb -jtop     testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 12"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcat -tb -jbottom  testgrid.pbm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 13"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # more than one input image from standard input
 cat testgrid.pbm | pnmcat -lr - - testimg.ppm > ${test_out} || \
   echo -n "Expected failure 14"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test
index d14a7936..90d11f6d 100755
--- a/test/pnmcolormap.test
+++ b/test/pnmcolormap.test
@@ -17,35 +17,35 @@ test_out=${tmpdir}/test_out
 pnmcolormap 0 testimg.ppm   > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcolormap -1 testimg.ppm  > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcolormap 0.1 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcolormap -center -meancolor 16 testimg.ppm    > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcolormap -center -meanpixel 16 testimg.ppm    > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcolormap -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmcolormap -spreadbrightness -spreadluminosity 16 \
   testimg.ppm > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pnminvert.ok b/test/pnminvert.ok
index 6cf5f011..d35b30b9 100644
--- a/test/pnminvert.ok
+++ b/test/pnminvert.ok
@@ -1,7 +1,12 @@
-1240379484 41
+Test 1.  Should print 1739442872 481
+1739442872 481
+Test 2.  Should print 1416115901 101484
 1416115901 101484
+Test 3.  Should print 1174803406 33838
 1174803406 33838
+Test 4.  Should print 2595564405 14 three times
 2595564405 14
 2595564405 14
 2595564405 14
+Test 7.  Should print 2896726098 15
 2896726098 15
diff --git a/test/pnminvert.test b/test/pnminvert.test
index b80716ef..68a4e066 100755
--- a/test/pnminvert.test
+++ b/test/pnminvert.test
@@ -2,25 +2,20 @@
 # This script tests: pnminvert
 # Also requires: pbmmake pamchannel pamtopnm
 
+echo "Test 1.  Should print 1739442872 481"
+pnminvert maze.pbm | cksum
 
-# Test 1.  Should print 1240379484 41
-pnminvert testgrid.pbm | cksum
-
-# Test 2.  Should print 1416115901 101484
+echo "Test 2.  Should print 1416115901 101484"
 pnminvert testimg.ppm | cksum
 
-# Test 3.  Should print 1174803406 33838
+echo "Test 3.  Should print 1174803406 33838"
 pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \
   pnminvert | cksum
 
-# Test 4.  Should print 2595564405 14
+echo "Test 4.  Should print 2595564405 14 three times"
 pbmmake -w 7 7 | pnminvert | cksum
-
-# Test 5.  Should print 2595564405 14
 pbmmake -b 7 7 | cksum
-
-# Test 6.  Should print 2595564405 14
 pbmmake -b 7 7 | pnminvert | pnminvert | cksum
 
-# Test 7.  Should print 2896726098 15
+echo "Test 7.  Should print 2896726098 15"
 pbmmake -g 8 8 | pnminvert | cksum
diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test
index bdd67883..2de7fc95 100755
--- a/test/pnmpsnr.test
+++ b/test/pnmpsnr.test
@@ -38,21 +38,21 @@ echo "-----------------------------------------------------------" 1>&2
 pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm}     > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmpsnr ${b_pbm}                       > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmpsnr ${b_pbm} ${w_pbm} -target1=100 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmpsnr                   -machine     > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 rm ${b_pbm} ${w_pbm}
diff --git a/test/pnmquant.test b/test/pnmquant.test
index 07830a3a..24cee077 100755
--- a/test/pnmquant.test
+++ b/test/pnmquant.test
@@ -44,39 +44,39 @@ test_out=${tmpdir}/test_out
 pnmquant 0 testimg.ppm   > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmquant testimg.ppm  > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmquant 10.5 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmquant -center -meanpixel 16 testimg.ppm    > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pnmremap1.test b/test/pnmremap1.test
index c2b9a6a6..b1cdd6d9 100755
--- a/test/pnmremap1.test
+++ b/test/pnmremap1.test
@@ -35,30 +35,30 @@ test_out=${tmpdir}/test_out
 pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmremap -mapfile=/dev/zero testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmremap testimg.ppm                    > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmremap -fs -nofs testimg.ppm          > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmremap -mapfile=testgrid.pbm -missingcolor=rgb:00/ff/00 testimg.ppm \
  > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/pnmtile.test b/test/pnmtile.test
index 80378432..b9597467 100755
--- a/test/pnmtile.test
+++ b/test/pnmtile.test
@@ -31,19 +31,19 @@ echo "-----------------------------------------------------------" 1>&2
 pnmtile 100 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmtile 100 0 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmtile 0 100 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 pnmtile 100 100 100 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/ppmbrighten.test b/test/ppmbrighten.test
index 40fe08f6..29ec78fb 100755
--- a/test/ppmbrighten.test
+++ b/test/ppmbrighten.test
@@ -26,6 +26,7 @@ echo "-----------------------------------------------------------" 1>&2
 
 echo "Test Error: Should print 1 four times"
 
+tmpdir=${tmpdir:-/tmp}
 output_ppm=${tmpdir}/output.ppm
 
 pambrighten -v -120 testimg.ppm > ${output_ppm}
@@ -36,3 +37,5 @@ pambrighten -s -120 testimg.ppm > ${output_ppm}
 echo $?
 test -s ${output_ppm}
 echo $?
+
+rm ${output_ppm}
diff --git a/test/ppmforge-parameters.test b/test/ppmforge-parameters.test
index 342b8242..efc846a8 100755
--- a/test/ppmforge-parameters.test
+++ b/test/ppmforge-parameters.test
@@ -32,34 +32,34 @@ echo "-----------------------------------------------------------" 1>&2
 ppmforge -night  -dimension=0  > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmforge  -dimension=10  > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmforge  -dimension=-1  > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmforge -clouds -mesh=1.99    > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmforge -clouds -power=0      > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmforge         -ice=-1       > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmforge         -glaciers=-1  > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/ppmhist.test b/test/ppmhist.test
index a89c95bb..b5812503 100755
--- a/test/ppmhist.test
+++ b/test/ppmhist.test
@@ -38,14 +38,14 @@ echo "-----------------------------------------------------------" 1>&2
 ppmhist -hexcolor -float testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmhist -hexcolor -map   testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmhist -float    -map   testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/ppmmake.test b/test/ppmmake.test
index 61f417ca..26b592f7 100755
--- a/test/ppmmake.test
+++ b/test/ppmmake.test
@@ -21,49 +21,49 @@ echo "-----------------------------------------------------------" 1>&2
 ppmmake rgb:gg/00/00  2 2  > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake rgb:ff/ff/00  2    > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake rgbi:1.1/0/0  2 2  > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake rgbi:1.0/.5   2 2  > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake rainbow       2 2  > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake               2 2  > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake blue -maxval=0 2 2  > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake blue -maxval=-1 2 2  > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmmake blue -maxval=65536 2 2  > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/ppmpat.test b/test/ppmpat.test
index ccba27c2..6e916944 100755
--- a/test/ppmpat.test
+++ b/test/ppmpat.test
@@ -52,47 +52,47 @@ echo "-----------------------------------------------------------" 1>&2
 ppmpat -g2 -g3 10 10 > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -madras -tartan 10 10 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -poles -squig 10 10 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -camo -anticamo 10 10 > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \
   echo -n "Expected failure 5"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat 10 10 > ${test_out} || \
   echo -n "Expected failure 6"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -g2 10 > ${test_out} || \
   echo -n "Expected failure 7"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -g2 10 10 10 > ${test_out} || \
   echo -n "Expected failure 8"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -g2 10 > ${test_out} || \
   echo -n "Expected failure 9"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 clist1="-color=rgb:00/00/00"
 clist2="-color=rgb:00/00/00,rgb:00/00/ff"
@@ -103,87 +103,87 @@ clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff"
 ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \
   echo -n "Expected failure 10"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -argyle1  ${clist1} 10 10 > ${test_out} || \
   echo -n "Expected failure 11"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \
   echo -n "Expected failure 12"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -argyle1  ${clist3} 10 10 > ${test_out} || \
   echo -n "Expected failure 13"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # These require exactly 3 colors
 ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \
   echo -n "Expected failure 14"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -argyle2  ${clist2} 10 10 > ${test_out} || \
   echo -n "Expected failure 15"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -madras   ${clist2} 10 10 > ${test_out} || \
   echo -n "Expected failure 16"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -tartan   ${clist2} 10 10 > ${test_out} || \
   echo -n "Expected failure 17"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \
   echo -n "Expected failure 18"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -argyle2  ${clist4} 10 10 > ${test_out} || \
   echo -n "Expected failure 19"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -madras   ${clist4} 10 10 > ${test_out} || \
   echo -n "Expected failure 20"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -tartan   ${clist4} 10 10 > ${test_out} || \
   echo -n "Expected failure 21"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # These require at least 3 colors
 ppmpat -squig    ${clist2} 10 10 > ${test_out} || \
   echo -n "Expected failure 22"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -camo     ${clist2} 10 10 > ${test_out} || \
   echo -n "Expected failure 23"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \
   echo -n "Expected failure 24"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 # The squig pattern has an aspect ratio restriction
 ppmpat -squig ${clist3} 10 250  > ${test_out} || \
   echo -n "Expected failure 25"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmpat -squig ${clist3} 500 20  > ${test_out} || \
   echo -n "Expected failure 26"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
diff --git a/test/ppmtoarbtxt-roundtrip.test b/test/ppmtoarbtxt-roundtrip.test
index dff78250..7c64114e 100755
--- a/test/ppmtoarbtxt-roundtrip.test
+++ b/test/ppmtoarbtxt-roundtrip.test
@@ -30,5 +30,4 @@ ppmtoarbtxt ${bodyskl} -hd ${headskl} testimg.ppm | tee ${inv_ppm} |
 
 cat ${inv_ppm} | ppmtoarbtxt ${bodyskl} -hd ${headskl} | pamtopnm | cksum
 
-
-rm ${bodyskl} ${headskl}
+rm ${inv_ppm} ${bodyskl} ${headskl}
diff --git a/test/ppmtoppm.ok b/test/ppmtoppm.ok
index 764a3464..2b4ad9f8 100644
--- a/test/ppmtoppm.ok
+++ b/test/ppmtoppm.ok
@@ -1 +1,23 @@
-829921912 685
+Test 1.  Should print a simple 4 x 3 pattern
+P3
+4 3
+255
+255 255 255  0 0 0  255 255 255  0 0 0
+0 0 0  255 255 255  0 0 0  255 255 255
+255 255 255  0 0 0  255 255 255  0 0 0
+Test 2.  Should print a simple 6 x 8 pattern
+P3
+6 8
+5
+0 0 0  0 0 0  0 0 0  1 1 1  1 1 1  2 2 2
+0 0 0  0 0 0  1 1 1  1 1 1  2 2 2  2 2 2
+0 0 0  1 1 1  1 1 1  2 2 2  2 2 2  2 2 2
+1 1 1  1 1 1  2 2 2  2 2 2  2 2 2  3 3 3
+1 1 1  2 2 2  2 2 2  2 2 2  3 3 3  3 3 3
+2 2 2  2 2 2  2 2 2  3 3 3  3 3 3  4 4 4
+2 2 2  2 2 2  3 3 3  3 3 3  4 4 4  4 4 4
+2 2 2  3 3 3  3 3 3  4 4 4  4 4 4  5 5 5
+Test 3.  Should print 669206373 10102
+669206373 10102
+Test 4.  Should print 1926073387 101484
+1926073387 101484
diff --git a/test/ppmtoppm.test b/test/ppmtoppm.test
index 797c733d..411c17f6 100755
--- a/test/ppmtoppm.test
+++ b/test/ppmtoppm.test
@@ -1,6 +1,15 @@
 #! /bin/bash
 # This script tests: ppmtoppm
-# Also requires:
+# Also requires: pbmmake pgmramp
 
+echo "Test 1.  Should print a simple 4 x 3 pattern"
+pbmmake -g 4 3 | ppmtoppm -plain
 
-ppmtoppm < testgrid.pbm | cksum
+echo "Test 2.  Should print a simple 6 x 8 pattern"
+pgmramp -diagonal -maxval=5 6 8 | ppmtoppm -plain
+
+echo "Test 3.  Should print 669206373 10102"
+ppmtoppm < maze.pbm | cksum
+
+echo "Test 4.  Should print 1926073387 101484"
+ppmtoppm < testimg.ppm | cksum
\ No newline at end of file
diff --git a/test/ppmwheel.ok b/test/ppmwheel.ok
index 0b0a7746..790a19cb 100644
--- a/test/ppmwheel.ok
+++ b/test/ppmwheel.ok
@@ -6,3 +6,4 @@ Expected failure 1 1
 Expected failure 2 1
 Expected failure 3 1
 Expected failure 4 1
+Expected failure 5 1
diff --git a/test/ppmwheel.test b/test/ppmwheel.test
index f2fa55d9..150a75e5 100755
--- a/test/ppmwheel.test
+++ b/test/ppmwheel.test
@@ -124,19 +124,24 @@ echo "-----------------------------------------------------------" 1>&2
 ppmwheel 10 -huevalue -huesaturation > ${test_out} || \
   echo -n "Expected failure 1"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
 ppmwheel 0 > ${test_out} || \
   echo -n "Expected failure 2"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
-ppmwheel > ${test_out} || \
+ppmwheel 3 > ${test_out} || \
   echo -n "Expected failure 3"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
 
-ppmwheel 10 10 > ${test_out} || \
+ppmwheel > ${test_out} || \
   echo -n "Expected failure 4"
   test -s ${test_out}; echo " "$?
-  rm -f {test_out}
+  rm -f ${test_out}
+
+ppmwheel 10 10 > ${test_out} || \
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
diff --git a/test/ps-alt-roundtrip.ok b/test/ps-alt-roundtrip.ok
index 2deba38d..a23005f9 100644
--- a/test/ps-alt-roundtrip.ok
+++ b/test/ps-alt-roundtrip.ok
@@ -1,2 +1,4 @@
+Test 1.  Should print: 281226646 481
 2425386270 41
-2916080186 235
+Test 2.  Should print: 2154092425 3374
+2154092425 3374
diff --git a/test/ps-alt-roundtrip.test b/test/ps-alt-roundtrip.test
index 8fc08f2b..07081d3a 100755
--- a/test/ps-alt-roundtrip.test
+++ b/test/ps-alt-roundtrip.test
@@ -24,7 +24,9 @@
 # pstopnm does not use libnetpbm functions for output.
 # Output is filtered through at least one Netpbm program.
 
-# Test 1. Should print: 2425386270 41
+echo "Test 1.  Should print: 281226646 481"
+
+tmpdir=${tmpdir:-/tmp}
 testgrid1_ps=${tmpdir}/testgrid1.ps
 
 pbmtopsg3 -dpi=72 testgrid.pbm \
@@ -36,13 +38,12 @@ pstopnm -xborder=0 -yborder=0 -llx=0 -lly=-16 -urx=14 \
 rm ${testgrid1_ps}
 
 
-
-# Test 2. Should print: 2916080186 235
+echo "Test 2.  Should print: 2154092425 3374"
 # Output is pgm maxval=1 with black and white inverted.
-#
+
 testgrid_epsi=${tmpdir}/testgrid.epsi
 
-pbmtoepsi testgrid.pbm > ${testgrid_epsi} && \
+pbmtoepsi maze.pbm > ${testgrid_epsi} && \
 xysizebps=`awk  '/BeginPreview/ {print $2,$3,$4}' \
     ${testgrid_epsi}` && \
 awk '/^%%BeginPreview:/ { p=1; next } /^%%EndImage/ { p=0; next } \
diff --git a/test/ps-flate-roundtrip.ok b/test/ps-flate-roundtrip.ok
index 57fb124f..0fdf23f2 100644
--- a/test/ps-flate-roundtrip.ok
+++ b/test/ps-flate-roundtrip.ok
@@ -1,3 +1,5 @@
+Test 1.  Should print: 1926073387 101484 twice
 1926073387 101484
 1926073387 101484
-1386192571 507420
+Test 2. Should print 1831481505 608904
+1831481505 608904
diff --git a/test/ps-flate-roundtrip.test b/test/ps-flate-roundtrip.test
index 08d1500c..888f2856 100755
--- a/test/ps-flate-roundtrip.test
+++ b/test/ps-flate-roundtrip.test
@@ -17,7 +17,7 @@ tmpdir=${tmpdir:-/tmp}
 # pstopnm does not use libnetpbm functions for output.
 # Output is filtered through pamtopnm.
 
-# Test 1.  Should print: 1926073387 101484 twice
+echo "Test 1.  Should print: 1926073387 101484 twice"
 test1_ps=${tmpdir}/testimg1.ps
 
 for flag in "-ps -flate" "-ps -rle -ascii -flate"
@@ -32,16 +32,17 @@ for flag in "-ps -flate" "-ps -rle -ascii -flate"
 
 rm ${test1_ps}
 
-# Test 2. Should print: 1386192571 507420
+echo "Test 2. Should print 1831481505 608904"
 # See comments in ps-roundtrip.test
 
 test3_ps=${tmpdir}/testimg3.ps
 flag="-ps -bitspersample=12 -flate -rle -vmreclaim"
-cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \
-pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \
-  > ${test3_ps} &&
+cat testimg.ppm testimg.ppm testimg.ppm maze.pbm \
+  testgrid.pbm testgrid.pbm | \
+  pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \
+    > ${test3_ps} &&
 xysize3=`awk  '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \
-  ${test3_ps}` &&
+    ${test3_ps}` &&
 pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout  ${test3_ps} | \
   pamtopnm | cksum
 
diff --git a/test/ps-roundtrip.ok b/test/ps-roundtrip.ok
index 5ef66cc4..1a69224d 100644
--- a/test/ps-roundtrip.ok
+++ b/test/ps-roundtrip.ok
@@ -1,7 +1,9 @@
+Test 1.  Should print 1926073387 101484 four times
 1926073387 101484
 1926073387 101484
 1926073387 101484
 1926073387 101484
+Test 2.  Should print 2918318199 62 seven times
 2918318199 62
 2918318199 62
 2918318199 62
@@ -9,6 +11,7 @@
 2918318199 62
 2918318199 62
 2918318199 62
-1386192571 507420
-1386192571 507420
-1386192571 507420
+Test 3. Should print 1831481505 608904 three times
+1831481505 608904
+1831481505 608904
+1831481505 608904
diff --git a/test/ps-roundtrip.test b/test/ps-roundtrip.test
index 207646cc..efce4fd6 100755
--- a/test/ps-roundtrip.test
+++ b/test/ps-roundtrip.test
@@ -11,7 +11,7 @@ tmpdir=${tmpdir:-/tmp}
 # pstopnm does not use libnetpbm functions for output.
 # Output is filtered through pamtopnm.
 
-# Test 1.  Should print: 1926073387 101484 four times
+echo "Test 1.  Should print 1926073387 101484 four times"
 test1_ps=${tmpdir}/testimg1.ps
 
 for flag in "" "-ps" "-rle" "-ps -ascii"
@@ -25,9 +25,9 @@ for flag in "" "-ps" "-rle" "-ps -ascii"
   done
 
 rm ${test1_ps}
-# Test 2.  Should print: 2918318199 62 seven times
+
+echo "Test 2.  Should print 2918318199 62 seven times"
 # Test image designed to detect problems with run-length compression
-#
 
 g_pbm=${tmpdir}/g.pbm
 t_pbm=${tmpdir}/t.pbm
@@ -52,8 +52,8 @@ for flag in "" "-rle" "-ps -rle -ascii" \
 
 rm ${grid_ps} ${g_pbm} ${t_pbm}
 
-#Test 3. Should print: 1386192571 507420 three times
-#
+echo "Test 3. Should print 1831481505 608904 three times"
+
 # Special care is needed when conducting round-trips with multiple-image
 # files as input.
 # (1) pnmtops: -setpage is mandatory
@@ -61,16 +61,16 @@ rm ${grid_ps} ${g_pbm} ${t_pbm}
 #          Subsequent BoundingBox values are ignored.
 # (3) pstopnm: input must be an ordinary file.  Input from stdin
 #     (by pipe or input redirection: "< file" ) does not work.
-#
 
 test3_ps=${tmpdir}/testimg3.ps
 
 for flag in "" "-ps" \
             "-ps -bitspersample=12 -rle -vmreclaim"
   do
-cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \
-pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \
-  > ${test3_ps} &&
+cat testimg.ppm testimg.ppm testimg.ppm maze.pbm \
+  testgrid.pbm testgrid.pbm | \
+  pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \
+    > ${test3_ps} &&
 xysize3=`awk  '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \
   ${test3_ps}` &&
 pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout  ${test3_ps} | \
diff --git a/test/rgb3-roundtrip.ok b/test/rgb3-roundtrip.ok
index 367e5429..cbdb369c 100644
--- a/test/rgb3-roundtrip.ok
+++ b/test/rgb3-roundtrip.ok
@@ -1,6 +1,12 @@
+Test 1.  Should print 1926073387 101484
 1926073387 101484
+Test 2.  Should print 3744829044 101514
 3744829044 101514
-2425386270 41
+Test 3.  Should print 281226646 481 twice
+281226646 481
+281226646 481
+Test 4.  Should print 0 twice
 0
 0
+Test 5.  Should print 0 0 : 0
 0 0 : 0
diff --git a/test/rgb3-roundtrip.test b/test/rgb3-roundtrip.test
index 42fd822f..5edb1f19 100755
--- a/test/rgb3-roundtrip.test
+++ b/test/rgb3-roundtrip.test
@@ -10,6 +10,7 @@
 tmpdir=${tmpdir:-/tmp}
 
 # Test 1.  PPM (color) input
+echo "Test 1.  Should print 1926073387 101484"
 testimg_ppm=${tmpdir}/testimg.ppm
 testimg_red=${tmpdir}/testimg.red
 testimg_grn=${tmpdir}/testimg.grn
@@ -19,28 +20,35 @@ cp testimg.ppm ${tmpdir} &&
 ppmtorgb3 ${testimg_ppm} &&
 rgb3toppm ${testimg_red} ${testimg_grn} ${testimg_blu} | cksum
 
+# Simple cat of three planes
+echo "Test 2.  Should print 3744829044 101514"
 cat ${testimg_red} ${testimg_grn} ${testimg_blu} | cksum
 
 rm ${testimg_ppm} ${testimg_red} ${testimg_grn} ${testimg_blu}
 
-# Test 2.  PBM (monochrome) input
-testgrid_pbm=${tmpdir}/testgrid.pbm
-testgrid_red=${tmpdir}/testgrid.red
-testgrid_grn=${tmpdir}/testgrid.grn
-testgrid_blu=${tmpdir}/testgrid.blu
+# Test 3.  PBM (monochrome) input
+echo "Test 3.  Should print 281226646 481 twice"
+maze_pbm=${tmpdir}/maze.pbm
+maze_red=${tmpdir}/maze.red
+maze_grn=${tmpdir}/maze.grn
+maze_blu=${tmpdir}/maze.blu
 
-cp testgrid.pbm ${tmpdir} &&
-ppmtorgb3 ${testgrid_pbm} &&
-rgb3toppm ${testgrid_red} ${testgrid_grn} ${testgrid_blu} | \
+cp maze.pbm ${tmpdir} &&
+ppmtorgb3 ${maze_pbm} &&
+rgb3toppm ${maze_red} ${maze_grn} ${maze_blu} | \
   ppmtopgm | pgmtopbm -th -val=0.5 | cksum
+pgmtopbm -th -val=0.5 ${maze_red} | cksum
 
-# Test 3.
+# Test 4.
 # With PGM or PBM input, the three monochrome planes should be
 # identical.  Test for this.
 
-cmp -s ${testgrid_red} ${testgrid_grn} ; echo $?
-cmp -s ${testgrid_grn} ${testgrid_blu} ; echo $?
-pgmtopgm < testgrid.pbm | cmp -s - ${testgrid_red}
+echo "Test 4.  Should print 0 twice"
+cmp -s ${maze_red} ${maze_grn} ; echo $?
+cmp -s ${maze_grn} ${maze_blu} ; echo $?
+
+echo "Test 5.  Should print 0 0 : 0"
+pgmtopgm < maze.pbm | cmp -s - ${maze_red}
   echo ${PIPESTATUS[@]} ":" $?
 
-rm ${testgrid_pbm} ${testgrid_red} ${testgrid_grn} ${testgrid_blu}
+rm ${maze_pbm} ${maze_red} ${maze_grn} ${maze_blu}
diff --git a/test/sgi-roundtrip.ok b/test/sgi-roundtrip.ok
index b1bd5ba6..3c3f022a 100644
--- a/test/sgi-roundtrip.ok
+++ b/test/sgi-roundtrip.ok
@@ -1,8 +1,13 @@
+Test 1.  Should produce 1926073387 101484 twice
 1926073387 101484
 1926073387 101484
+Test 2.  Should produce 1926073387 101484 twice
 1926073387 101484
 1926073387 101484
-538848130 235
-538848130 235
-2394972481 463
-2394972481 463
+Test 3.  Should produce 281226646 481 twice
+281226646 481
+281226646 481
+Test 4. Should produce 4155890407 6741 three times
+4155890407 6741
+4155890407 6741
+4155890407 6741
diff --git a/test/sgi-roundtrip.test b/test/sgi-roundtrip.test
index 5052bb81..073755d8 100755
--- a/test/sgi-roundtrip.test
+++ b/test/sgi-roundtrip.test
@@ -1,14 +1,14 @@
 #! /bin/bash
 # This script tests: pnmtosgi sgitopnm
-# Also requires: rgb3toppm pamdepth pamtopnm
-
+# Also requires: rgb3toppm pamdepth pamtopnm pgmtopbm
 
+tmpdir=${tmpdir:-/tmp}
 a_sgi=${tmpdir}/a.sgi
 a_red=${tmpdir}/a.red
 a_grn=${tmpdir}/a.grn
 a_blu=${tmpdir}/a.blu
 
-# Test 1.  Should produce 1926073387 101484 twice
+echo "Test 1.  Should produce 1926073387 101484 twice"
 pnmtosgi -rle testimg.ppm | tee ${a_sgi} | sgitopnm  | cksum
 sgitopnm -channel=0  ${a_sgi} > ${a_red}
 sgitopnm -channel=1  ${a_sgi} > ${a_grn}
@@ -21,7 +21,7 @@ b_red=${tmpdir}/b.red
 b_grn=${tmpdir}/b.grn
 b_blu=${tmpdir}/b.blu
 
-# Test 2.  Should produce 1926073387 101484 twice
+echo "Test 2.  Should produce 1926073387 101484 twice"
 pnmtosgi -verbatim testimg.ppm | tee ${b_sgi} | sgitopnm  | cksum
 sgitopnm -channel=0  ${b_sgi} > ${b_red}
 sgitopnm -channel=1  ${b_sgi} > ${b_grn}
@@ -29,15 +29,16 @@ sgitopnm -channel=2  ${b_sgi} > ${b_blu}
 rgb3toppm ${b_red} ${b_grn} ${b_blu} | cksum
 rm ${b_sgi} ${b_red} ${b_grn} ${b_blu}
 
-# Test 3.  Should produce 2425386270 41 twice
-pnmtosgi testgrid.pbm | sgitopnm | cksum             # Defaults to -rle
-pnmtosgi -verbatim testgrid.pbm | sgitopnm | cksum
-
+echo "Test 3.  Should produce 281226646 481 twice"
+pnmtosgi maze.pbm | sgitopnm | pgmtopbm -threshold -value=0.5 | cksum 
+# Defaults to -rle
+pnmtosgi -verbatim maze.pbm | sgitopnm | \
+  pgmtopbm -threshold -value=0.5 | cksum 
 
-testgrid_pgm=${tmpdir}/testgrid.pgm
+maze_pgm=${tmpdir}/maze.pgm
 
-# Test 4. Should produce 2394972481 463 twice
-pamdepth 65535 testgrid.pbm | pamtopnm | tee ${testgrid_pgm} | \
-  pnmtosgi -rle | sgitopnm | cksum
-pnmtosgi -verbatim ${testgrid_pgm} | sgitopnm | cksum
-rm ${testgrid_pgm}
+echo "Test 4. Should produce 4155890407 6741 three times"
+pamdepth 65535 maze.pbm | pamtopnm | tee ${maze_pgm} | cksum
+pnmtosgi -rle ${maze_pgm} | sgitopnm | cksum
+pnmtosgi -verbatim ${maze_pgm} | sgitopnm | cksum
+rm ${maze_pgm}
diff --git a/test/targa-roundtrip.ok b/test/targa-roundtrip.ok
index 188833f0..beb6700e 100644
--- a/test/targa-roundtrip.ok
+++ b/test/targa-roundtrip.ok
@@ -1,4 +1,4 @@
-Test 1: Should print 281226646 481, cksum of maze.pbm, ten times
+Test 1:  Should print 281226646 481 ten times
 281226646 481
 281226646 481
 281226646 481
@@ -9,7 +9,7 @@ Test 1: Should print 281226646 481, cksum of maze.pbm, ten times
 281226646 481
 281226646 481
 281226646 481
-Test 2:  Should produce 1571496937 33838, cksum of testimg.red, ten times
+Test 2:  Should produce 1571496937 33838 ten times
 1571496937 33838
 1571496937 33838
 1571496937 33838
@@ -20,19 +20,19 @@ Test 2:  Should produce 1571496937 33838, cksum of testimg.red, ten times
 1571496937 33838
 1571496937 33838
 1571496937 33838
-Test 3: Should print 1926073387 101484, cksum of testimg.ppm, four times
+Test 3.  Should print 1926073387 101484 four times
 1926073387 101484
 1926073387 101484
 1926073387 101484
 1926073387 101484
-Test 4: Should print 0 0 0 : 0 six times
+Test 4.  Should print 0 0 0 : 0 six times
 0 0 0 : 0
 0 0 0 : 0
 0 0 0 : 0
 0 0 0 : 0
 0 0 0 : 0
 0 0 0 : 0
-Test 5: Should print 0 0 0 : 0 twice, then 0 0 0 0 : 0 six times
+Test 4.  Should print 0 0 0 : 0 twice, then 0 0 0 0 : 0 six times
 0 0 0 : 0
 0 0 0 : 0
 0 0 0 0 : 0
diff --git a/test/targa-roundtrip.test b/test/targa-roundtrip.test
index 39ea8bd7..2dd04e91 100755
--- a/test/targa-roundtrip.test
+++ b/test/targa-roundtrip.test
@@ -4,7 +4,7 @@
 
 tmpdir=${tmpdir:-/tmp}
 
-echo "Test 1: Should print 281226646 481, cksum of maze.pbm, ten times"
+echo "Test 1:  Should print 281226646 481 ten times"
 
 for mode in "-mono" "-mono -norle" \
             "-cmap" "-cmap -norle" "-cmap16" "-cmap16 -norle" \
@@ -15,11 +15,10 @@ for mode in "-mono" "-mono -norle" \
     pgmtopbm -threshold -val 0.5 | cksum
   done
 
-echo \
-  "Test 2:  Should produce 1571496937 33838, cksum of testimg.red, ten times"
+echo "Test 2:  Should produce 1571496937 33838 ten times"
 
-test_pam=${tmpdir}/testimg.pam
-pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 > ${test_pam}
+test_pam=${tmpdir}/testimg.pgm
+pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 > ${test_pam} 
 
 for mode in "-mono" "-mono -norle" \
             "-cmap" "-cmap -norle" "-cmap16" "-cmap16 -norle" \
@@ -30,16 +29,14 @@ for mode in "-mono" "-mono -norle" \
 
 rm ${test_pam}
 
-
-echo \
-    "Test 3: Should print 1926073387 101484, cksum of testimg.ppm, four times"
+echo "Test 3.  Should print 1926073387 101484 four times"
 
 for mode in "-rgb" "-rgb -norle" "" "-norle"
   do
   pamtotga ${mode} testimg.ppm | tgatoppm | cksum
   done
 
-echo "Test 4: Should print 0 0 0 : 0 six times"
+echo "Test 4.  Should print 0 0 0 : 0 six times"
 
 test256_ppm=${tmpdir}/test256.ppm
 pnmquant 256 testimg.ppm > ${test256_ppm} || echo "pnmquant failed"
@@ -51,9 +48,7 @@ for mode in "-rgb" "-rgb -norle" "-cmap" "-cmap -norle" "" "-norle"
   echo ${PIPESTATUS[@]} ":" $?
 done
 
-
-echo \
-    "Test 5: Should print 0 0 0 : 0 twice, then 0 0 0 0 : 0 six times"
+echo "Test 4.  Should print 0 0 0 : 0 twice, then 0 0 0 0 : 0 six times"
 
 test256_31_ppm=${tmpdir}/test256-31.ppm
 pamdepth 31 ${test256_ppm} > ${test256_31_ppm} || echo "pamdepth failed"
diff --git a/test/tiff-flate-lzw-roundtrip.ok b/test/tiff-flate-lzw-roundtrip.ok
index fb3d98d0..b3b0e1e7 100644
--- a/test/tiff-flate-lzw-roundtrip.ok
+++ b/test/tiff-flate-lzw-roundtrip.ok
@@ -1,7 +1,9 @@
+Test 1.  Should print 1079668603 10237 six times
 1079668603 10237
 1079668603 10237
 1079668603 10237
 1079668603 10237
 1079668603 10237
 1079668603 10237
+Test 2.  Should print 281226646 481
 281226646 481
diff --git a/test/tiff-flate-lzw-roundtrip.test b/test/tiff-flate-lzw-roundtrip.test
index 95bedb71..f62c6767 100755
--- a/test/tiff-flate-lzw-roundtrip.test
+++ b/test/tiff-flate-lzw-roundtrip.test
@@ -8,11 +8,11 @@
 ## features.
 
 tmpdir=${tmpdir:-/tmp}
-
 tartan_ppm=${tmpdir}/testimg40.ppm
 
 # Make a test image with reduced colors which compresses better
-# cksum is 1079668603 10237
+
+echo "Test 1.  Should print 1079668603 10237 six times"
 
 ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 71 48 | \
   tee ${tartan_ppm} | cksum
@@ -28,7 +28,9 @@ pamtotiff -adobeflate ${tartan_ppm} | tifftopnm | cksum
 pamtotiff -lzw ${tartan_ppm} | tifftopnm | cksum
 pamtotiff -lzw -predictor=1 ${tartan_ppm} | tifftopnm | cksum
 
+rm ${tartan_ppm}
+
+echo "Test 2.  Should print 281226646 481"
+
 # PBM image: test flate compression
 pamtotiff -flate maze.pbm | tifftopnm | cksum
-
-rm ${tartan_ppm}
diff --git a/test/tiff-roundtrip.ok b/test/tiff-roundtrip.ok
index 5636f3b2..dec662ed 100644
--- a/test/tiff-roundtrip.ok
+++ b/test/tiff-roundtrip.ok
@@ -1,36 +1,36 @@
-PPM-rose
+Test 1:PPM-rose  Should print 1926073387 101484 five times
 1926073387 101484
 1926073387 101484
 1926073387 101484
 1926073387 101484
 1926073387 101484
-PPM-6
+Test 2:PPM-6  Should print 1646869394 29498 four times
 1646869394 29498
 1646869394 29498
 1646869394 29498
 1646869394 29498
-PPM-2
+Test 3:PPM-2  Should print 3743909631 14836 four times
 3743909631 14836
 3743909631 14836
 3743909631 14836
 3743909631 14836
-PPM-gray
+Test 4:PPM-gray  Should print 603974118 4954 six times
 603974118 4954
 603974118 4954
 603974118 4954
 603974118 4954
 603974118 4954
 603974118 4954
-PPM-bilevel-black-white
+Test 5:PPM-bilevel-black-white  Should print 1001018459 4954 four times
 1001018459 4954
 1001018459 4954
 1001018459 4954
 1001018459 4954
-PBM
+Test 6:PBM  Should print 281226646 481 three times
 281226646 481
 281226646 481
 281226646 481
-Extract from multi-image TIFF
+Test 7:Extract from multi-image TIFF
 1926073387 101484
 1646869394 29498
 3743909631 14836
diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test
index 99e14588..b4169319 100755
--- a/test/tiff-roundtrip.test
+++ b/test/tiff-roundtrip.test
@@ -13,9 +13,8 @@ argylegray_ppm=${tmpdir}/argyle2.ppm
 multiimage_tiff=${tmpdir}/multiimage.ppm
 
 # PPM image
-# Should print 1926073387 101484 five times
 
-echo PPM-rose
+echo "Test 1:PPM-rose  Should print 1926073387 101484 five times"
 pamtotiff testimg.ppm | tifftopnm -headerdump | cksum
 pamtotiff -truecolor testimg.ppm -output ${multiimage_tiff} && \
   tifftopnm ${multiimage_tiff} -byrow | cksum
@@ -25,9 +24,8 @@ pamtotiff -truecolor -lsb2msb  testimg.ppm | \
   tifftopnm -respectfillorder | cksum
 
 # PPM image with six colors
-# Should print 1646869394 29498 four times
 
-echo PPM-6
+echo "Test 2:PPM-6  Should print 1646869394 29498 four times"
 ppmpat -tartan -color=rgb:0/8/8,rgb:8/f/8,rgb:f/f/0 108 91 | \
   tee ${tartan_ppm} | cksum
 pamtotiff -truecolor ${tartan_ppm} | tifftopnm | cksum
@@ -37,12 +35,12 @@ pamtotiff ${tartan_ppm} -append -output ${multiimage_tiff} && \
 
 
 # PPM image with two colors
-# Should print 3743909631 14836 four times
 
-echo PPM-2
+echo "Test 3:PPM-2  Should print 3743909631 14836 four times"
 ppmpat -argyle2 -color=rgb:0/0/0,rgb:f/8/f,rgb:0/0/0 61 81 | \
   tee ${argylecolor_ppm} | cksum
-pamtotiff -indexbits=2 ${argylecolor_ppm} -append -output ${multiimage_tiff} && \
+pamtotiff -indexbits=2 ${argylecolor_ppm} -append \
+  -output ${multiimage_tiff} && \
   tifftopnm ${multiimage_tiff} | pampick 2 | cksum
 pamtotiff -indexbits=1 ${argylecolor_ppm} | tifftopnm | cksum
 pamtotiff -indexbits=1 -g4 ${argylecolor_ppm} | tifftopnm | cksum
@@ -51,9 +49,8 @@ pamtotiff -indexbits=1 -g4 ${argylecolor_ppm} | tifftopnm | cksum
 # pamtotiff detects the absence of colors and produces a grayscale
 # tiff image unless -color is specified
 # Pipeline output is PGM unless -color is specified
-# Should print 603974118 4954 six times
 
-echo PPM-gray
+echo "Test 4:PPM-gray  Should print 603974118 4954 six times"
 ppmpat -gingham3 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \
   tee ${gingham_ppm} | ppmtopgm | cksum
 pamtotiff -color ${gingham_ppm} | tifftopnm | cksum
@@ -67,9 +64,8 @@ pamtotiff -mb ${gingham_ppm} -append -output ${multiimage_tiff} && \
 # pamtotiff detects the absence of colors and produces a grayscale
 # tiff image unless -color is specified
 # Pipeline output is PGM unless -color is specified
-# Should print 1001018459 4954 four times
 
-echo PPM-bilevel-black-white
+echo "Test 5:PPM-bilevel-black-white  Should print 1001018459 4954 four times"
 ppmpat -argyle2 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \
   tee ${argylegray_ppm} | ppmtopgm | cksum
 pamtotiff -color -fill ${argylegray_ppm} | tifftopnm | cksum
@@ -78,9 +74,9 @@ pamtotiff -mb ${argylegray_ppm} -append -output ${multiimage_tiff} && \
   tifftopnm ${multiimage_tiff} | pampick 4 | cksum
 
 # PBM image
-# Should print 281226646 481 three times
 
-echo PBM
+
+echo "Test 6:PBM  Should print 281226646 481 three times"
 pamtotiff maze.pbm | tifftopnm | cksum
 pamtotiff -g3 -fill maze.pbm | tifftopnm | cksum
 pamtotiff -g4 -mb maze.pbm -append -output ${multiimage_tiff} && \
@@ -88,7 +84,7 @@ pamtotiff -g4 -mb maze.pbm -append -output ${multiimage_tiff} && \
 
 # Extract individual images from multi-image tiff file
 
-echo "Extract from multi-image TIFF"
+echo "Test 7:Extract from multi-image TIFF"
 tifftopnm ${multiimage_tiff} | pampick 0 | cksum
 tifftopnm ${multiimage_tiff} | pampick 1 | cksum
 tifftopnm ${multiimage_tiff} | pampick 2 | cksum