about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-04-21 00:05:00 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-04-21 00:05:00 +0000
commit04c717a4cccf6cce662138d3286a449770f478eb (patch)
tree0ade37451a711ba5cb5ccce5b6724f89a28ba821 /test
parent8f4281c6439fd51d7659e3e41bf5d4040a3b68cb (diff)
downloadnetpbm-mirror-04c717a4cccf6cce662138d3286a449770f478eb.tar.gz
netpbm-mirror-04c717a4cccf6cce662138d3286a449770f478eb.tar.xz
netpbm-mirror-04c717a4cccf6cce662138d3286a449770f478eb.zip
Test invalid command line arguments
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4090 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rwxr-xr-xtest/pamarith.test82
-rwxr-xr-xtest/pamchannel.test14
-rwxr-xr-xtest/pamcrater.test18
-rwxr-xr-xtest/pamcut.test62
-rwxr-xr-xtest/pamdepth.test10
-rw-r--r--test/pamdice.ok7
-rwxr-xr-xtest/pamdice.test25
-rwxr-xr-xtest/pamditherbw.test61
-rwxr-xr-xtest/pamfile.test16
-rwxr-xr-xtest/pamfind.test25
-rwxr-xr-xtest/pamfix.test5
-rwxr-xr-xtest/pamfunc.test49
-rwxr-xr-xtest/pamgauss.test26
-rwxr-xr-xtest/pamhue.test6
-rwxr-xr-xtest/pamrecolor.test32
-rwxr-xr-xtest/pamscale-reportonly.test35
-rwxr-xr-xtest/pamseq.test20
-rwxr-xr-xtest/pamsumm.test21
-rwxr-xr-xtest/pamundice.test53
-rwxr-xr-xtest/pbmclean.test6
-rwxr-xr-xtest/pbmmake.test41
-rwxr-xr-xtest/pbmpage.test16
-rwxr-xr-xtest/pbmpscale.test14
-rwxr-xr-xtest/pbmtext-utf8.test50
-rwxr-xr-xtest/pbmtext.test26
-rwxr-xr-xtest/pbmtopgm.test18
-rwxr-xr-xtest/pbmupc.test46
-rwxr-xr-xtest/pgmhist.test21
-rwxr-xr-xtest/pgmmake.test41
-rwxr-xr-xtest/pgmnoise-parameters.test20
-rwxr-xr-xtest/pgmnoise.test55
-rwxr-xr-xtest/pgmramp.test9
-rwxr-xr-xtest/pnmcat.test58
-rwxr-xr-xtest/pnmcolormap.test38
-rwxr-xr-xtest/pnmcrop1.test5
-rwxr-xr-xtest/pnmpsnr.test21
-rwxr-xr-xtest/pnmquant.test59
-rwxr-xr-xtest/pnmremap1.test31
-rwxr-xr-xtest/pnmtile.test18
-rwxr-xr-xtest/ppmforge-parameters.test36
-rwxr-xr-xtest/ppmhist.test16
-rwxr-xr-xtest/ppmmake.test51
-rwxr-xr-xtest/ppmpat.test134
-rwxr-xr-xtest/ppmwheel.test18
44 files changed, 1051 insertions, 364 deletions
diff --git a/test/pamarith.test b/test/pamarith.test
index a4c98859..db4a2311 100755
--- a/test/pamarith.test
+++ b/test/pamarith.test
@@ -1,7 +1,7 @@
 #! /bin/bash
 # This script tests: pamarith
-# Also requires: pamtopnm rgb3toppm pamenlarge pnmcat pamseq pbmmake pgmmake 
-# Also requires: ppmpat pamchannel 
+# Also requires: pamtopnm rgb3toppm pamenlarge pnmcat pamseq pbmmake pgmmake
+# Also requires: ppmpat pamchannel
 
 tmpdir=${tmpdir:-/tmp}
 input1_pgm=${tmpdir}/input1.pgm
@@ -15,8 +15,8 @@ echo "Test 1"
 pamseq 1 15 | pamtopnm -assume > ${input1_pgm}
 pgmmake -maxval 15 0.15 16 1 > ${input2_pgm}
 
-rgb3toppm ${input1_pgm} ${input1_pgm} ${input1_pgm} > ${input1_ppm} 
-rgb3toppm ${input2_pgm} ${input2_pgm} ${input2_pgm} > ${input2_ppm} 
+rgb3toppm ${input1_pgm} ${input1_pgm} ${input1_pgm} > ${input1_ppm}
+rgb3toppm ${input2_pgm} ${input2_pgm} ${input2_pgm} > ${input2_ppm}
 
 pnmcat -tb -plain ${input1_pgm} ${input2_pgm}
 
@@ -93,7 +93,7 @@ echo "cksum is 2425386270 41 or 2921940274 59"
 for image in testgrid.pbm ${input1_ppm}
   do
   echo "input image"
-  cat ${image} | cksum 
+  cat ${image} | cksum
   for fn in "-minimum" "-maximum" "-mean" "-and" "-or"
     do
     echo ${fn}
@@ -130,58 +130,80 @@ output_ppm=${tmpdir}/output.ppm
 pamarith -add -subtract testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 1"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -multiply -divide testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 2"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -difference -minimum testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 3"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -maximum -mean testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 4"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -compare -and testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 5"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -compare -equal testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 6"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -or -nand testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 7"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -nor -xor testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 8"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -shiftleft -shiftright testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 9"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # -add does not take a value
 
 pamarith -add=1 testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 10"
  test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # No function
 
 pamarith -plain testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 11"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 pamarith testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 12"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # Just one input image file
 
 pamarith -add testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 13"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # No input image file
 
 pamarith -add > ${output_ppm} || \
   echo -n "Expected failure 14"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # Input images with different depth (number of planes)
 
@@ -189,39 +211,48 @@ pamchannel -infile testimg.ppm 0 1 | \
   pamarith -add testimg.ppm - > ${output_ppm} || \
   echo -n "Expected failure 15"
   test -s ${output_ppm}; echo " "$?
-
+  rm -f ${test_out}
 
 # Input images with different x/y dimensions
 
 pamarith -add testimg.ppm testgrid.pbm > ${output_ppm} || \
   echo -n "Expected failure 16"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 pamenlarge -xscale=2 testgrid.pbm | \
   pamarith -add testgrid.pbm - > ${output_ppm} || \
   echo -n "Expected failure 17"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 pamenlarge -yscale=3 testgrid.pbm | \
   pamarith -add testgrid.pbm - > ${output_ppm} || \
   echo -n "Expected failure 18"
   test -s ${output_ppm}; echo " "$?
-
+  rm -f ${test_out}
 
 # Invalid usage of -closeness
 
 pamarith -equal -closeness=100.1 testgrid.pbm > ${output_ppm} || \
   echo -n "Expected failure 19"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -equal -closeness=-10 testgrid.pbm > ${output_ppm} || \
   echo -n "Expected failure 20"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -closeness -equal testgrid.pbm > ${output_ppm} || \
   echo -n "Expected failure 21"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -compare -closeness=10 testgrid.pbm > ${output_ppm} || \
   echo -n "Expected failure 22"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # Bit string functions
 # Create PGM test input
@@ -230,7 +261,7 @@ input3_pgm=${tmpdir}/input3.pgm
 input4_pgm=${tmpdir}/input4.pgm
 input5_pgm=${tmpdir}/input5.pgm
 
-pgmmake -maxval=4095 1.0 3 1 > ${input3_pgm} 
+pgmmake -maxval=4095 1.0 3 1 > ${input3_pgm}
 pgmmake -maxval=4096 1.0 3 1 > ${input4_pgm}
 pgmmake -maxval=8191 1.0 3 1 > ${input5_pgm}
 
@@ -239,43 +270,64 @@ pgmmake -maxval=8191 1.0 3 1 > ${input5_pgm}
 pamarith -and ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
   echo -n "Expected failure 23"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -or ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
   echo -n "Expected failure 24"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -nand ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
   echo -n "Expected failure 25"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -nor ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
   echo -n "Expected failure 26"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -xor ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
   echo -n "Expected failure 27"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # Bit string functions - Maxval must be 2^n -1
 
 pamarith -and ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
   echo -n "Expected failure 28"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -or ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
   echo -n "Expected failure 29"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -nand ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
   echo -n "Expected failure 30"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -nor ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
   echo -n "Expected failure 31"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -xor ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
   echo -n "Expected failure 32"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 pamarith -shiftleft ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
   echo -n "Expected failure 33"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -shiftright ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
   echo -n "Expected failure 34"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 rm ${input3_pgm} ${input4_pgm} ${input5_pgm}
 
@@ -286,21 +338,32 @@ rm ${input3_pgm} ${input4_pgm} ${input5_pgm}
 pamarith -subtract testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 35"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -divide testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 36"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -compare testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 37"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -difference testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 38"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -shiftleft testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 39"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 40"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 # Currently -equal and -mean do not allow more than two input images.
 # These two cases should be removed once improvements are made.
@@ -308,8 +371,11 @@ pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
 pamarith -equal testgrid.pbm testgrid.pbm testgrid.pbm > ${output_ppm} || \
   echo -n "Expected failure 41"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamarith -mean testgrid.pbm  testgrid.pbm testgrid.pbm > ${output_ppm} || \
   echo -n "Expected failure 42"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
 
 rm ${output_ppm}
diff --git a/test/pamchannel.test b/test/pamchannel.test
index 2e017ef2..6bb0cf67 100755
--- a/test/pamchannel.test
+++ b/test/pamchannel.test
@@ -46,12 +46,16 @@ test_out=${tmpdir}/test_out
 echo "Test Invalid"
 
 pamchannel  -infile testgrid.pbm 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamchannel  -infile testimg.ppm 3 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamcrater.test b/test/pamcrater.test
index ba10ca24..027e34e3 100755
--- a/test/pamcrater.test
+++ b/test/pamcrater.test
@@ -64,15 +64,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "------------------------------" 1>&2
 
 pamcrater -width 0 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcrater -height 0 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcrater -number 0 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  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}
\ No newline at end of file
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamcut.test b/test/pamcut.test
index e4d8c62f..ced45f9c 100755
--- a/test/pamcut.test
+++ b/test/pamcut.test
@@ -59,51 +59,79 @@ echo "-----------------------------------------------------------" 1>&2
 
 # overspecification
 pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -croptop=1  -height=16 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut 5 4 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 13"
+  test -s ${test_out}; echo " "$?
+  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}
\ No newline at end of file
+  echo -n "Expected failure 14"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamdepth.test b/test/pamdepth.test
index da198973..eaa1b165 100755
--- a/test/pamdepth.test
+++ b/test/pamdepth.test
@@ -30,9 +30,11 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamdepth 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamdepth 65536 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamdice.ok b/test/pamdice.ok
index 99504ec0..9e978168 100644
--- a/test/pamdice.ok
+++ b/test/pamdice.ok
@@ -13,9 +13,14 @@ P1@1 1@0@
 P1@1 1@1@
 Test Invalid
 Expected failure 1
+Expected failure 1.rm
 Expected failure 2
+Expected failure 2.rm
 Expected failure 3
+Expected failure 3.rm
 Expected failure 4
+Expected failure 4.rm
 Expected failure 5
+Expected failure 5.rm
 Expected failure 6
-Expected failure (output files)
+Expected failure 6.rm
diff --git a/test/pamdice.test b/test/pamdice.test
index 3199fd4a..25695d5a 100755
--- a/test/pamdice.test
+++ b/test/pamdice.test
@@ -11,7 +11,7 @@ echo "Test 1."
 pbmmake -w 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain
 ls ${fname_stem}*.pbm | while read file
   do
-  cat ${file} | tr '\n'  '@' ; echo 
+  cat ${file} | tr '\n'  '@' ; echo
   done | sort | uniq -c | sed 's/^ *//'
 
 rm ${fname_stem}*.pbm
@@ -22,7 +22,7 @@ echo "Test 2."
 pbmmake -g 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain
 ls ${fname_stem}*.pbm | while read file
   do
-  cat ${file} | tr '\n'  '@' ; echo 
+  cat ${file} | tr '\n'  '@' ; echo
   done
 
 rm ${fname_stem}*.pbm
@@ -36,33 +36,44 @@ echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
+# No output files should be producd.  With nothing to remove,
+# the rm commands should always fail.
+
 # No input file
 pamdice -width=10 -height=10  -outstem=${fname_stem} /dev/null || \
 echo "Expected failure 1"
+rm ${fname_stem}* ||
+echo "Expected failure 1.rm"
 
 # No -outstem
 pamdice -width=10 -height=10 testgrid.pbm || \
 echo "Expected failure 2"
+rm ${fname_stem}* ||
+echo "Expected failure 2.rm"
 
 # -width=0
 pamdice -width=0 -height=10 -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 3"
+rm ${fname_stem}* ||
+echo "Expected failure 3.rm"
 
 # -height=0
 pamdice -width=10 -height=0 -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 4"
+rm ${fname_stem}* ||
+echo "Expected failure 4.rm"
 
 # -hoverlap larger than width
 pamdice -width=10 -height=10 -hoverlap=11 \
   -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 5"
+rm ${fname_stem}* ||
+echo "Expected failure 5.rm"
+
 
 # -voverlap larger than height
 pamdice -width=10 -height=10 -voverlap=11 \
   -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 6"
-
-
-# Ensure that no output files are produced by the above
-ls ${fname_stem}* || \
-echo "Expected failure (output files)"
\ No newline at end of file
+rm ${fname_stem}* ||
+echo "Expected failure 6.rm"
diff --git a/test/pamditherbw.test b/test/pamditherbw.test
index 40eb0a4d..378d7e94 100755
--- a/test/pamditherbw.test
+++ b/test/pamditherbw.test
@@ -47,28 +47,63 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamditherbw -fs -atkinson       ${test_red} > ${test_out} || \
- echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -floyd -atkinson    ${test_red} > ${test_out} || \
- echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -dither8  -cluster3 ${test_red} > ${test_out} || \
- echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \
- echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \
- echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \
- echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \
- echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -clump=8            ${test_red} > ${test_out} || \
- echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -fs -clump=8        ${test_red} > ${test_out} || \
- echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -hilbert -clump=1   ${test_red} > ${test_out} || \
- echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -th -value=-1       ${test_red} > ${test_out} || \
- echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -th -value=1.1      ${test_red} > ${test_out} || \
- echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_red} ${test_out}
+rm ${test_red}
diff --git a/test/pamfile.test b/test/pamfile.test
index aa3e2895..16d084ea 100755
--- a/test/pamfile.test
+++ b/test/pamfile.test
@@ -31,10 +31,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamfile -size -machine  testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamfile -count -machine testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-head -n1 testimg.ppm | pamfile > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+head -n1 testimg.ppm | pamfile > ${test_out} || \
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamfind.test b/test/pamfind.test
index 074dde5c..7b612f78 100755
--- a/test/pamfind.test
+++ b/test/pamfind.test
@@ -8,7 +8,7 @@ sorted1_res=${tmpdir}/pamfind_sorted1.res
 
 # Test 1
 echo "Test 1"
-pamfind -color=grey17     testimg.ppm 
+pamfind -color=grey17     testimg.ppm
 pamfind -target=210,57,41 testimg.ppm
 pamfind -target=50,55,49 -machine testimg.ppm
 
@@ -25,7 +25,7 @@ pamfind -target=1 testgrid.pbm | sort > ${sorted1_res}
 comm -3 ${sorted0_res}  ${sorted1_res}  |
   awk 'END {if (NR==226) print  "okay";
             else printf("failure (line count=%d)\n", NR)}'
-comm -12 ${sorted0_res}  ${sorted1_res} | 
+comm -12 ${sorted0_res}  ${sorted1_res} |
   awk '{print}; END { if(NR == 0) print  "okay";
             else printf("failure (line count=%d)\n", NR)}'
 
@@ -44,12 +44,21 @@ echo "-----------------------------------------------------------" 1>&2
 echo "Test Invalid"
 
 pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamfind -target=0,0 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamfind -target=0,0,0,0 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-pamfind testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pamfind testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamfix.test b/test/pamfix.test
index e6021b56..d13e0230 100755
--- a/test/pamfix.test
+++ b/test/pamfix.test
@@ -54,13 +54,14 @@ echo "-----------------------------------------------------------" 1>&2
 echo -e "P2\n3 2\n7\n0 1 2\n6 7 8" | pamfix -change -clip > ${test_out} || \
   echo -n "Expected failure 1";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 echo -e "P1\n5 5" | pamfix -truncate -plain > ${test_out} || \
   echo -n "Expected failure 2";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 echo -e "P2\n3 3\255" | pamfix -truncate -plain > ${test_out} || \
   echo -n "Expected failure 3";
   test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  rm -f ${test_out}
diff --git a/test/pamfunc.test b/test/pamfunc.test
index f9a8a33e..fa2570b4 100755
--- a/test/pamfunc.test
+++ b/test/pamfunc.test
@@ -5,7 +5,7 @@
 tmpdir=${tmpdir:-/tmp}
 input_pgm=${tmpdir}/input.pgm
 
-echo "Test 1"  
+echo "Test 1"
 
 pamseq 1 15 | pamtopnm -assume > ${input_pgm}
 pamtopnm -plain ${input_pgm} | tr '\n' ' '; echo
@@ -95,72 +95,119 @@ output_ppm=${tmpdir}/output.ppm
 pamfunc -multiplier testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 1"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -multiplier=-1 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 2"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -divisor testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 3"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -divisor=-20 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 4"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -adder testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 5"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -adder 0.5 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 6"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -subtractor testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 7"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -subtractor 0.1 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 8"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -multiplier=1 -divisor=2 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 9"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -adder=2 -subtractor=3 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 10"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -min testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 11"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -max testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 12"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -andmask testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 13"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -ormask testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 14"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -xormask testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 15"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -not 1 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 16"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -min=1 -max=2 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 17"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -andmask=1 -ormask=0 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 18"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -andmask=0xffff testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 19"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -shiftleft testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 20"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -shiftright testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 21"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -changemaxval testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 22"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -shiftleft=1 -shiftright=1 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 23"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
+
 pamfunc -multiplier=0.5 -changemaxval=65535 testimg.ppm > ${output_ppm} || \
   echo -n "Expected failure 24"
   test -s ${output_ppm}; echo " "$?
+  rm -f ${test_out}
diff --git a/test/pamgauss.test b/test/pamgauss.test
index bb006ce9..7952c7df 100755
--- a/test/pamgauss.test
+++ b/test/pamgauss.test
@@ -28,14 +28,26 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pamgauss 3 3               > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamgauss 3 3   -sigma=0    > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamgauss 3 3   -sigma=-1.5 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamgauss 3     -sigma=0.5  > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-pamgauss 3 3 3 -sigma=0.5  > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${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}
diff --git a/test/pamhue.test b/test/pamhue.test
index d81a0acb..47688175 100755
--- a/test/pamhue.test
+++ b/test/pamhue.test
@@ -43,6 +43,6 @@ echo "An error message should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamhue testimg.ppm  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamrecolor.test b/test/pamrecolor.test
index cc79a124..3f21517a 100755
--- a/test/pamrecolor.test
+++ b/test/pamrecolor.test
@@ -27,17 +27,33 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamrecolor --targetcolor=rgb:00/11/22 --colorfile={base1_pgm} testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamrecolor --rmult=0.3  --gmult=0.3  --bmult=0.3 --colorfile={base1_pgm} testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamrecolor --colorspace=void --targetcolor=rgb:80/80/80 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamrecolor --targetcolor=vague testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamrecolor --colorfile=${truncated_file} testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
-pamrecolor --rmult=0.2989 --gmult=0.5866 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
+pamrecolor --rmult=0.2989 --gmult=0.5866 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${base_pgm} ${test_out} ${truncated_file}
\ No newline at end of file
+rm ${base_pgm} ${truncated_file}
diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test
index 45a38687..9aacab56 100755
--- a/test/pamscale-reportonly.test
+++ b/test/pamscale-reportonly.test
@@ -30,22 +30,37 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \
-  ${test_out} \
-  || echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  ${test_out} || \
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  ${test_out} || \
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  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 ${test_out}
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamseq.test b/test/pamseq.test
index 0681d396..9c089cf3 100755
--- a/test/pamseq.test
+++ b/test/pamseq.test
@@ -17,11 +17,19 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pamseq 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamseq 0 255 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamseq 3 0   > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 c64="0123456789012345678901234567890123456789012345678901234567890123"
 c256=${c64}${c64}${c64}${c64}
@@ -29,6 +37,6 @@ c256=${c64}${c64}${c64}${c64}
 # Tupletype string length=256
 
 pamseq -tupletype="${c256}" 3 15 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamsumm.test b/test/pamsumm.test
index 5b4fdb17..3d008533 100755
--- a/test/pamsumm.test
+++ b/test/pamsumm.test
@@ -28,12 +28,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamsumm -sum -min  testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamsumm -sum -max  testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamsumm -mean -max testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-pamsumm            testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pamsumm            testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamundice.test b/test/pamundice.test
index e8add587..5c1f9c6b 100755
--- a/test/pamundice.test
+++ b/test/pamundice.test
@@ -18,7 +18,7 @@ for ((x=0; x<3; ++x))
 pamundice -across=3 -down=5 ${fname_stem}"_%1d_%1a".pgm | cksum
 
 ls ${fname_stem}_?_?.pgm | \
-    pamundice -across=3 -down=5 -listfile=- | cksum 
+    pamundice -across=3 -down=5 -listfile=- | cksum
 
 
 # Test 2.
@@ -30,7 +30,7 @@ for ((y=0; y<5; ++y))
   do
   pamundice -across=3 ${fname_stem}"_"$y"_%1a".pgm > ${tempfile}_"$y"
   done
- 
+
 pnmcat -tb ${tempfile}_[01234] | cksum
 rm ${tempfile}_[01234]
 
@@ -129,55 +129,78 @@ echo "-----------------------------------------------------------" 1>&2
 
 # No input file pattern specified
 pamundice -down=5 -across=2 > ${test_out} || \
-echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -hoverlap too large
 pamundice -down=5 -across=2 -hoverlap=18 \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -voverlap too large
 pamundice -down=5 -across=2 -voverlap=19 \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 rm ${fname_stem}*.pbm
-
diff --git a/test/pbmclean.test b/test/pbmclean.test
index c0c3a759..3fb24b25 100755
--- a/test/pbmclean.test
+++ b/test/pbmclean.test
@@ -46,8 +46,8 @@ echo "-----------------------------------------------------------" 1>&2
 
 # overspecification
 pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # note that without -extended the above is valid.
-
-rm -f ${test_out}
\ No newline at end of file
diff --git a/test/pbmmake.test b/test/pbmmake.test
index 3f815617..9945394a 100755
--- a/test/pbmmake.test
+++ b/test/pbmmake.test
@@ -32,20 +32,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pbmmake -b -w -plain 1 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -b -g -plain 1 1 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -gray -plain 1 1 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain   > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain 1 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain 1 0 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain 0 1 > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-pbmmake -white -plain 1 1 1 > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pbmmake -white -plain 1 1 1 > ${test_out} || \
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmpage.test b/test/pbmpage.test
index 50570e3e..cfacefa7 100755
--- a/test/pbmpage.test
+++ b/test/pbmpage.test
@@ -20,10 +20,16 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pbmpage -a3 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmpage 0 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-pbmpage 4 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pbmpage 4 > ${test_out} || \
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmpscale.test b/test/pbmpscale.test
index 9c34734a..21ad6cd1 100755
--- a/test/pbmpscale.test
+++ b/test/pbmpscale.test
@@ -19,12 +19,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmpscale testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmpscale 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  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}
\ No newline at end of file
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test
index 8ebb6e31..0677d161 100755
--- a/test/pbmtext-utf8.test
+++ b/test/pbmtext-utf8.test
@@ -7,7 +7,7 @@ LC_ALL=C
 export LANG LC_ALL
 
 
-# This test requires a working UTF-8 locale 
+# This test requires a working UTF-8 locale
 # Skip this test if it is are not available
 
 iconv /dev/null
@@ -22,11 +22,11 @@ utf_locale_list=${tmpdir}/utf_locale_list
 
 locale_to_test="en_US.utf8"  # Initial value
 # Edit the above value if necessary
-  
+
 # Make a list of available locales which end in "utf8"
 locale -a | grep "\.utf8$" > ${utf_locale_list}
 
-# Hunt for a valid utf8 locale  
+# Hunt for a valid utf8 locale
 # Submit each candidate to a trial pbmtext run until one that works is
 # encountered
 
@@ -142,12 +142,15 @@ cat ${long_txt} | \
   LC_ALL=${locale_for_test} \
   pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \
   echo -n "Expected failure 1";
-  test -s ${test_out}; echo " "$? 
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 cat ${long_txt} | \
   LC_ALL=${locale_for_test} \
   pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \
   echo -n "Expected failure 2";
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 rm ${long_txt}
 
@@ -165,39 +168,42 @@ echo "Test 6 Invalid"
 
 awk 'BEGIN { printf("%c%c",128,129);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-1:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
-  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 awk 'BEGIN { printf("ABC%c%c",192, 193);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-2:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 awk 'BEGIN { printf("abcde%c%c", 254, 253);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-3:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
-  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 awk 'BEGIN { printf("abcdefg%c%c", 195, 15);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-4:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 awk 'BEGIN { printf("123456789%c%c%c", 224, 143 ,0);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-5:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 awk 'BEGIN { printf("abcdefg123ABCDEFG%c%c%c%c",247, 135, 135, 7);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-6:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$? 
-  
-rm ${test_out}
-  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
diff --git a/test/pbmtext.test b/test/pbmtext.test
index 515711e4..a7c75c23 100755
--- a/test/pbmtext.test
+++ b/test/pbmtext.test
@@ -114,27 +114,42 @@ test_out=${tmpdir}/test_out
 pbmtext -font=testgrid.pbm foo > ${test_out} || \
   echo -n "Expected failure 1";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -font=testimg.ppm  foo > ${test_out} || \
   echo -n "Expected failure 2";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -builtin=void      foo > ${test_out} || \
-  echo -n "Expected failure 3";  
+  echo -n "Expected failure 3";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -font=${font_pbm} -builtin=fixed foo > ${test_out}  || \
   echo -n "Expected failure 4";
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -dry-run    -text-dump  foo > ${test_out} || \
   echo -n "Expected failure 5";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -dump-sheet -text-dump  foo > ${test_out} || \
   echo -n "Expected failure 6";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -dry-run    -dump-sheet foo > ${test_out} || \
   echo -n "Expected failure 7";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -wchar foo > ${test_out} || \
   echo -n "Expected failure 8";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 rm ${font_pbm}
 
@@ -164,12 +179,17 @@ echo "-----------------------------------------------------------" 1>&2
 pbmtext -nomargins -builtin fixed `cat ${long_txt}` > ${test_out}  || \
   echo -n "Expected failure 1";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 cat ${long_txt} | pbmtext -nomargins -builtin fixed > ${test_out}  || \
   echo -n "Expected failure 2";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 cat ${long_txt} | \
   LC_ALL=C pbmtext -nomargins -builtin fixed -wchar > ${test_out}  || \
   echo -n "Expected failure 3";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
-rm ${long_txt} ${test_out}
+rm ${long_txt}
diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test
index a7ba6f7c..dc872640 100755
--- a/test/pbmtopgm.test
+++ b/test/pbmtopgm.test
@@ -18,15 +18,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmtopgm 5 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmtopgm 0 9 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmtopgm 15 5 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  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}
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmupc.test b/test/pbmupc.test
index fb9ec90e..a29a06f3 100755
--- a/test/pbmupc.test
+++ b/test/pbmupc.test
@@ -20,22 +20,46 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmupc -s3 0 72890 00011     > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1   72890 00011     > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 72890           > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 10 72890 00011    > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 172890 00011    > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0   2890 00011    > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 72890 100011    > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 72890   0011    > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
-pbmupc -s1 0 72890 100011 1  > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pbmupc -s1 0 72890 100011 1  > ${test_out} || \
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmhist.test b/test/pgmhist.test
index ab3763fd..0179a4f6 100755
--- a/test/pgmhist.test
+++ b/test/pgmhist.test
@@ -35,12 +35,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pgmhist -median   -quartile testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmhist -median   -decile   testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmhist -quartile -decile   testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-pgmhist testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pgmhist testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmmake.test b/test/pgmmake.test
index 2fc63e72..bd9882a5 100755
--- a/test/pgmmake.test
+++ b/test/pgmmake.test
@@ -19,20 +19,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pgmmake 100  5 5 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake 1.01 5 5 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake .5   5   > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake .5       > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake -maxval=5        5 5 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake -maxval=0     .5 5 5 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake -maxval=-1    .5 5 5 > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-pgmmake -maxval=65536 .5 5 5 > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pgmmake -maxval=65536 .5 5 5 > ${test_out} || \
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test
index 1682afca..d2a96530 100755
--- a/test/pgmnoise-parameters.test
+++ b/test/pgmnoise-parameters.test
@@ -11,16 +11,26 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pgmnoise -maxval=255  -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 100 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 100 0 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 0 100 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmnoise.test b/test/pgmnoise.test
index 21a2729e..ab98a5e2 100755
--- a/test/pgmnoise.test
+++ b/test/pgmnoise.test
@@ -20,7 +20,7 @@ echo "Test 3."
 for maxval in `seq 16` 255 65535
   do
   echo ${maxval}
-  pgmnoise -maxval=${maxval} -randomseed=1 -plain 16 1 | tr '\n' ' ' 
+  pgmnoise -maxval=${maxval} -randomseed=1 -plain 16 1 | tr '\n' ' '
   done
 echo
 
@@ -35,7 +35,7 @@ for maxval in `seq 16` 30 31 32 254 255 256 65534 65535
 
 echo "Test 5."
 echo "Should print four identical lines"
-# width height values do not affect random number sequence 
+# width height values do not affect random number sequence
 for xysize in "1 10000" "100 100" "250 40" "1000 10"
   do pgmnoise --randomseed=0 ${xysize} | pgmhist -mach | cksum
   done
@@ -48,7 +48,7 @@ echo "Test 6."
 echo "First column should be 2^n - 1"
 # The "pool" method of generating pixvals is used iff maxval is
 # a power of 2 minus 1: 1, 3, 7, 15, 31 ...
-for maxval in `seq 35; seq 60 69; seq 120 129; seq 250 259` 
+for maxval in `seq 35; seq 60 69; seq 120 129; seq 250 259`
   do
   pgmnoise -maxval=${maxval} -randomseed=1 -verbose 1 1 > /dev/null \
   2> ${messages}
@@ -68,22 +68,51 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pgmnoise 0 0  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 0 1  > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 1 0  > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise      > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 1    > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 100 -1 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -randomseed=-1 100 100  > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -maxval=-1 100 100  > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -maxval=0 100 100  > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -maxval=$((256 * 256 * 256 * 256)) 10 10 > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmramp.test b/test/pgmramp.test
index 3ec73749..50a3cf6d 100755
--- a/test/pgmramp.test
+++ b/test/pgmramp.test
@@ -31,14 +31,17 @@ test_out=${tmpdir}/test_out
 
 for combination in "-lr -tb" "-lr -rectangle" "-rectangle -ellipse"
 do pgmramp $combination 10 10 > ${test_out} || \
-   echo -n "Expected failure: $combination" ; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure: $combination"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 done
 
 pgmramp -lr     1 > ${test_out} || \
   echo -n "Expected failure: insufficient parameters"; \
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pgmramp -tb 1 1 1 > ${test_out} || \
   echo -n "Expected failure: excessive parameters"; \
   test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  rm -f ${test_out}
diff --git a/test/pnmcat.test b/test/pnmcat.test
index 40c29f50..519e01c7 100755
--- a/test/pnmcat.test
+++ b/test/pnmcat.test
@@ -22,50 +22,76 @@ echo "-----------------------------------------------------------" 1>&2
 
 # direction not specified
 pnmcat testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -lr -jright   testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jtop     testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jbottom  testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 13"
+  test -s ${test_out}; echo " "$?
+  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}
+  echo -n "Expected failure 14"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test
index 13be8a44..9ac0ea9e 100755
--- a/test/pnmcolormap.test
+++ b/test/pnmcolormap.test
@@ -3,7 +3,7 @@
 # Also requires:
 
 pnmcolormap -plain -sort 2 testgrid.pbm
-pnmcolormap -plain -sort -square 2 testgrid.pbm 
+pnmcolormap -plain -sort -square 2 testgrid.pbm
 pnmcolormap -plain -sort all testgrid.pbm
 
 echo 1>&2
@@ -15,19 +15,37 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmcolormap 0 testimg.ppm   > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -1 testimg.ppm  > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap 0.1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -center -meancolor 16 testimg.ppm    > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -center -meanpixel 16 testimg.ppm    > ${test_out} || \
-  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -spreadbrightness -spreadluminosity 16 \
   testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pnmcrop1.test b/test/pnmcrop1.test
index 34c7534a..936cbd95 100755
--- a/test/pnmcrop1.test
+++ b/test/pnmcrop1.test
@@ -74,6 +74,7 @@ for option in "-reportfull -reportsize" \
     do
     echo ${option}
     pnmcrop -reportfull ${option} testgrid.pbm > ${test_out} || \
-        echo -n "Expected failure: " ${option}; test -s ${test_out}; echo " "$?
-        rm ${test_out} 
+        echo -n "Expected failure: " ${option}
+        test -s ${test_out}; echo " "$?
+        rm ${test_out}
     done
diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test
index 7603459b..bdd67883 100755
--- a/test/pnmpsnr.test
+++ b/test/pnmpsnr.test
@@ -36,12 +36,23 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm}     > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmpsnr ${b_pbm}                       > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmpsnr ${b_pbm} ${w_pbm} -target1=100 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmpsnr                   -machine     > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${b_pbm} ${w_pbm} ${test_out}
+rm ${b_pbm} ${w_pbm}
diff --git a/test/pnmquant.test b/test/pnmquant.test
index 3a2ef906..07830a3a 100755
--- a/test/pnmquant.test
+++ b/test/pnmquant.test
@@ -7,30 +7,30 @@ echo "Test 1"
 # Count colors in output image.
 
 pnmquant 256 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}'
 
 pnmquant -center 256 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}'
 
 pnmquant -spreadbrightness 256 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}'
 
 pnmquant -spreadluminosity 128 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}'
 
 pnmquant -floyd -randomseed=0 128 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}'
 
 pnmquant 64 -meanpixel testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 64) , ($2 > 64 * 0.9)}' 
+  awk 'NR==1 {print ($2 <= 64) , ($2 > 64 * 0.9)}'
 
 pnmquant 16 -meancolor testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 16) , ($2 > 16 * 0.9)}' 
+  awk 'NR==1 {print ($2 <= 16) , ($2 > 16 * 0.9)}'
 
 
 pnmquant 2 testgrid.pbm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 2) , ($2 == 2) }' 
- 
+  awk 'NR==1 {print ($2 <= 2) , ($2 == 2) }'
+
 echo "Test Invalid"
 
 echo 1>&2
@@ -42,20 +42,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmquant 0 testimg.ppm   > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant testimg.ppm  > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant 10.5 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -center -meanpixel 16 testimg.ppm    > ${test_out} || \
-  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${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}
diff --git a/test/pnmremap1.test b/test/pnmremap1.test
index 18debcb8..c2b9a6a6 100755
--- a/test/pnmremap1.test
+++ b/test/pnmremap1.test
@@ -33,17 +33,32 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmremap -mapfile=/dev/zero testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmremap testimg.ppm                    > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmremap -fs -nofs testimg.ppm          > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  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 " "$?
-pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${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}
diff --git a/test/pnmtile.test b/test/pnmtile.test
index 11f576bd..80378432 100755
--- a/test/pnmtile.test
+++ b/test/pnmtile.test
@@ -29,15 +29,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pnmtile 100 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmtile 100 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmtile 0 100 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  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}
\ No newline at end of file
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmforge-parameters.test b/test/ppmforge-parameters.test
index 39f199ea..342b8242 100755
--- a/test/ppmforge-parameters.test
+++ b/test/ppmforge-parameters.test
@@ -30,18 +30,36 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmforge -night  -dimension=0  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge  -dimension=10  > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge  -dimension=-1  > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge -clouds -mesh=1.99    > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge -clouds -power=0      > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge         -ice=-1       > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
-ppmforge         -glaciers=-1  > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+ppmforge         -glaciers=-1  > ${test_out} || \
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmhist.test b/test/ppmhist.test
index 1983bd13..a89c95bb 100755
--- a/test/ppmhist.test
+++ b/test/ppmhist.test
@@ -36,10 +36,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmhist -hexcolor -float testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmhist -hexcolor -map   testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-ppmhist -float    -map   testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+ppmhist -float    -map   testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmmake.test b/test/ppmmake.test
index f28249c7..61f417ca 100755
--- a/test/ppmmake.test
+++ b/test/ppmmake.test
@@ -19,24 +19,51 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmmake rgb:gg/00/00  2 2  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rgb:ff/ff/00  2    > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rgbi:1.1/0/0  2 2  > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rgbi:1.0/.5   2 2  > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rainbow       2 2  > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake               2 2  > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake blue -maxval=0 2 2  > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake blue -maxval=-1 2 2  > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake blue -maxval=65536 2 2  > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
-RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${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}
diff --git a/test/ppmpat.test b/test/ppmpat.test
index 0a6127ca..88fb9fdd 100755
--- a/test/ppmpat.test
+++ b/test/ppmpat.test
@@ -38,70 +38,140 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmpat -g2 -g3 10 10 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -madras -tartan 10 10 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -poles -squig 10 10 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -camo -anticamo 10 10 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmpat 10 10 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -g2 10 > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -g2 10 10 10 > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -g2 10 > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 clist1="-color=rgb:00/00/00"
 clist2="-color=rgb:00/00/00,rgb:00/00/ff"
 clist3="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff"
 clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff"
 
-# These patterns require exactly 2 colors 
+# These patterns require exactly 2 colors
 ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle1  ${clist1} 10 10 > ${test_out} || \
-   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \
-   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle1  ${clist3} 10 10 > ${test_out} || \
-   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 13"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-# These require exactly 3 colors 
+# These require exactly 3 colors
 ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 14"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 14"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle2  ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 15"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 15"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -madras   ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 16"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 16"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -tartan   ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 17"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 17"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 18"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 18"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle2  ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 19"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 19"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -madras   ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 20"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 20"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -tartan   ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 21"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 21"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-# These require at least 3 colors 
+# These require at least 3 colors
 ppmpat -squig    ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 22"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 22"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -camo     ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 23"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 23"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 24"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 24"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-# The squig pattern has an aspect ratio restriction 
+# 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 " "$?
-ppmpat -squig ${clist3} 500 20  > ${test_out} || \
-   echo -n "Expected failure 26"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 25"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+ppmpat -squig ${clist3} 500 20  > ${test_out} || \
+  echo -n "Expected failure 26"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmwheel.test b/test/ppmwheel.test
index fd401951..f2fa55d9 100755
--- a/test/ppmwheel.test
+++ b/test/ppmwheel.test
@@ -122,15 +122,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmwheel 10 -huevalue -huesaturation > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmwheel 0 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmwheel > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmwheel 10 10 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}