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