diff options
-rwxr-xr-x | runtests | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -6,7 +6,10 @@ if [ $# = 0 ] ; then set -- test/*.c fi +numtest=0 +numpass=0 numfail=0 +fail= got=$(mktemp) trap 'rm "$got"' EXIT @@ -26,16 +29,20 @@ for test ; do echo "invalid test '$test'" >&2 set -- false fi + numtest=$((numtest + 1)) if "$@" && diff -Nu "$want" "$got" ; then result="PASS" + numpass=$((numpass + 1)) else result="FAIL" numfail=$((numfail + 1)) + fail="$fail $test" fi echo "[$result] $test" >&2 done +printf "\n%d/%d tests passed\n" "$numpass" "$numtest" if [ "$numfail" -gt 0 ] ; then - printf "%d test(s) failed\n" "$numfail" + printf "%d test(s) failed (%s)\n" "$numfail" "${fail# }" exit 1 fi |