1 #!/bin/sh 2 3 mkdir -p NEW 4 mkdir -p DIFF 5 passed=0 6 failed=0 7 cat /dev/null > failure-outputs.txt 8 9 # first run any specific tests. 10 for i in *.sh 11 do 12 case $i in TEST*.sh) continue;; esac 13 14 if sh ./$i >DIFF/$i.result 15 then 16 echo $i: passed. 17 rm -f DIFF/$i.result 18 passed=`expr $passed + 1` 19 else 20 echo $i: failed. 21 failed=`expr $failed + 1` 22 fi 23 done 24 25 echo $passed >.passed 26 echo $failed >.failed 27 28 # now run typical tests 29 cat TESTLIST | while read name input output options 30 do 31 case $name in 32 \#*) continue;; 33 '') continue;; 34 esac 35 36 if ./TESTonce $name $input $output "$options" 37 then 38 echo $name: passed. 39 rm -f DIFF/$output.diff 40 passed=`expr $passed + 1` 41 echo $passed >.passed 42 else 43 echo $name: failed. 44 failed=`expr $failed + 1` 45 echo $failed >.failed 46 echo "Failed test: $name" >> failure-outputs.txt 47 echo >> failure-outputs.txt 48 cat DIFF/$output.diff >> failure-outputs.txt 49 echo >> failure-outputs.txt 50 fi 51 done 52 53 # I hate shells with their stupid, useless subshells. 54 passed=`cat .passed` 55 failed=`cat .failed` 56 57 # exit with number of failing tests. 58 echo 59 echo 60 printf "%4u tests failed\n" $failed 61 printf "%4u tests passed\n" $passed 62 echo 63 echo 64 cat failure-outputs.txt 65 echo 66 echo 67 exit $failed 68 69 70 71 72