aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-09-28 12:19:08 -0700
committerMichael Forney <mforney@mforney.org>2021-09-28 12:19:08 -0700
commitbb9e42f52064845f924e438d4f9fc27655ed6690 (patch)
tree0f7cc75e8ac1b6e9baf711fb6d6c89d3708c4332
parent7e8386697aa60c1813019eda3cd2073e6be5b021 (diff)
runtests: Print better result summary
-rwxr-xr-xruntests9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtests b/runtests
index a71ed37..90166e3 100755
--- a/runtests
+++ b/runtests
@@ -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