regress.sh revision 213738
1# $FreeBSD: head/tools/regression/bin/sh/regress.sh 213738 2010-10-12 18:20:38Z obrien $ 2 3if [ -z "${SH}" ]; then 4 echo '${SH} is not set, please correct and re-run.' 5 exit 1 6fi 7export SH=${SH} 8 9COUNTER=1 10 11do_test() { 12 local c 13 c=${COUNTER} 14 COUNTER=$((COUNTER+1)) 15 ${SH} $1 > tmp.stdout 2> tmp.stderr 16 if [ $? -ne $2 ]; then 17 echo "not ok ${c} - ${1} # wrong exit status" 18 rm tmp.stdout tmp.stderr 19 return 20 fi 21 for i in stdout stderr; do 22 if [ -f ${1}.${i} ]; then 23 if ! cmp -s tmp.${i} ${1}.${i}; then 24 echo "not ok ${c} - ${1} # wrong output on ${i}" 25 rm tmp.stdout tmp.stderr 26 return 27 fi 28 elif [ -s tmp.${i} ]; then 29 echo "not ok ${c} - ${1} # wrong output on ${i}" 30 rm tmp.stdout tmp.stderr 31 return 32 fi 33 done 34 echo "ok ${c} - ${1}" 35 rm tmp.stdout tmp.stderr 36} 37 38TESTS=$(find -Es . -regex ".*\.[0-9]+") 39printf "1..%d\n" $(echo ${TESTS} | wc -w) 40 41for i in ${TESTS} ; do 42 do_test ${i} ${i##*.} 43done 44