X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Faggregate-results.sh;h=732d6ca7f53ca8bf332f1179199ec132fe6abe04;hp=d5bab75d7da49ebb53e368d67f6b867f5417a125;hb=65801835ee47dc4cada82c8a3ae16e8177a7919a;hpb=0083854b1204f077e98b1d9c4ecfa2a4844ee716 diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh index d5bab75d..732d6ca7 100755 --- a/test/aggregate-results.sh +++ b/test/aggregate-results.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash fixed=0 success=0 @@ -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" ] && [ "$failed" = "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