diff options
| author | Tomi Ollila <tomi.ollila@iki.fi> | 2021-05-17 11:11:09 +0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-06-07 20:16:33 -0300 |
| commit | 6f0f83660e222cfdd05b05ad134763a7ab26f097 (patch) | |
| tree | 5e95ce0a8fb9a8e02014683782ee96b4d6952173 /test/aggregate-results.sh | |
| parent | 651a1b085be106aa9761c464429d88e34157fc2a (diff) | |
test: aggregate-results updates
notmuch-test will now call aggregate-results.sh with file list
that it compiles based on the test ran, and aggregate-results
will report failure is any of the test files are missing.
With this notmuch-test no longer has to exit in non-parallel
run if some test fail to write its report file -- so it works
as parallel tests in this sense.
Changed test_done() in test-lib.sh write report file in one write(2),
so there is (even) less chance it being partially written. Also,
now it writes 'total' last and aggregate-results.sh expects this
line to exist in all report files for reporting to be successful.
Added 'set -eu' to notmuch-test and modified code to work with
these settings. That makes it harder to get mistakes slipped
into committed code.
Diffstat (limited to 'test/aggregate-results.sh')
| -rwxr-xr-x | test/aggregate-results.sh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh index 75400e6e..6845fcf0 100755 --- a/test/aggregate-results.sh +++ b/test/aggregate-results.sh @@ -8,9 +8,16 @@ failed=0 broken=0 total=0 all_skipped=0 +rep_failed=0 for file do + if [ ! -f "$file" ]; then + echo "'$file' does not exist!" + rep_failed=$((rep_failed + 1)) + continue + fi + has_total=0 while read type value do case $type in @@ -24,18 +31,23 @@ do broken=$((broken + value)) ;; total) total=$((total + value)) + has_total=1 if [ "$value" -eq 0 ]; then all_skipped=$((all_skipped + 1)) fi esac done <"$file" + if [ "$has_total" -eq 0 ]; then + echo "'$file' lacks 'total ...'; results may be inconsistent." + failed=$((failed + 1)) + fi done pluralize_s () { [ "$1" -eq 1 ] && s='' || s='s'; } echo "Notmuch test suite complete." -if [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ]; then +if [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ] && [ "$rep_failed" -eq 0 ]; then pluralize_s "$total" printf "All $total test$s " if [ "$broken" -eq 0 ]; then @@ -70,10 +82,16 @@ if [ "$all_skipped" -ne 0 ]; then echo "All tests in $all_skipped file$s skipped." fi +if [ "$rep_failed" -ne 0 ]; then + pluralize_s "$rep_failed" + echo "$rep_failed test$s failed to report results." +fi + # Note that we currently do not consider skipped tests as failing the # build. -if [ "$success" -gt 0 ] && [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ] +if [ "$success" -gt 0 ] && [ "$fixed" -eq 0 ] && + [ "$failed" -eq 0 ] && [ "$rep_failed" -eq 0 ] then exit 0 else |
