1#!/bin/sh 2 3mkdir -p NEW 4mkdir -p DIFF 5passed=0 6failed=0 7cat /dev/null > failure-outputs.txt 8 9# first run any specific tests. 10for i in *.sh 11do 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 23done 24 25echo $passed >.passed 26echo $failed >.failed 27 28# now run typical tests 29cat TESTLIST | while read name input output options 30do 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 51done 52 53# I hate shells with their stupid, useless subshells. 54passed=`cat .passed` 55failed=`cat .failed` 56 57# exit with number of failing tests. 58echo 59echo 60printf "%4u tests failed\n" $failed 61printf "%4u tests passed\n" $passed 62echo 63echo 64cat failure-outputs.txt 65echo 66echo 67exit $failed 68 69 70 71 72