aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/aggregate-results.sh
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2010-09-17 13:53:47 -0700
committerGravatar Carl Worth <cworth@cworth.org>2010-09-17 14:08:36 -0700
commit222926abe1e221a6239ccb9436968af43e1b6fb2 (patch)
tree029145b74a3a782ab532479559dfb9f13482fa1f /test/aggregate-results.sh
parente6ba2c63c9ba3d8999bd2f1c5eac3c5bf7c14167 (diff)
test: Cleanup the test output
This makes the new, git-derived test suite report results in a manner similar to the original notmuch test suite. Notable changes include: * No more initial '*' on every line * Only colorize a single word * Don't print useless test numbers * Use "PASS" in place of "ok" * Begin sentences with a capital letter * Print test descriptions for each block * Separate each block of tests with a blank line * Don't summarize counts between each block
Diffstat (limited to 'test/aggregate-results.sh')
-rwxr-xr-xtest/aggregate-results.sh57
1 files changed, 52 insertions, 5 deletions
diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh
index d5bab75d..cc5b83fb 100755
--- a/test/aggregate-results.sh
+++ b/test/aggregate-results.sh
@@ -27,8 +27,55 @@ do
done <"$file"
done
-printf "%-8s%d\n" fixed $fixed
-printf "%-8s%d\n" success $success
-printf "%-8s%d\n" failed $failed
-printf "%-8s%d\n" broken $broken
-printf "%-8s%d\n" total $total
+pluralize () {
+ case $2 in
+ 1)
+ case $1 in
+ test)
+ echo test ;;
+ failure)
+ echo failure ;;
+ esac
+ ;;
+ *)
+ case $1 in
+ test)
+ echo tests ;;
+ failure)
+ echo failures ;;
+ esac
+ ;;
+ esac
+}
+
+echo "Notmuch test suite complete."
+if [ "$fixed" = "0" ] && [ "$broken" = "0" ]; then
+ tests=$(pluralize "test" $total)
+ printf "All $total $tests "
+ if [ "$broken" = "0" ]; then
+ echo "passed."
+ else
+ failures=$(pluralize "failure" $broken)
+ echo "behaved as expected ($broken expected $failures)."
+ fi;
+else
+ echo "$success/$total tests passed."
+ if [ "$broken" != "0" ]; then
+ tests=$(pluralize "test" $broken)
+ echo "$broken broken $tests failed as expected."
+ fi
+ if [ "$fixed" != "0" ]; then
+ tests=$(pluralize "test" $fixed)
+ echo "$fixed broken $tests now fixed."
+ fi
+ if [ "$failed" != "0" ]; then
+ tests=$(pluralize "test" $failed)
+ echo "$failed $tests failed."
+ fi
+fi
+
+skipped=$(($total - $fixed - $success - $failed - $broken))
+if [ "$skipped" != "0" ]; then
+ tests=$(pluralize "test" $skipped)
+ echo "$skipped $tests skipped."
+fi