[PATCH 1/1] test: exit with nonzero value when not all tests completed successfully

Tomi Ollila tomi.ollila at iki.fi
Fri Sep 6 08:05:35 PDT 2013


If any of the tests in our test system is not passing the execution
of the test suite completes with nonzero exit value.

It is better to rely on the exit value of the test system instead
of some arbitrary strings in test output (or use both).
---
 test/aggregate-results.sh |    5 +++++
 test/notmuch-test         |    3 +++
 2 files changed, 8 insertions(+)

diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh
index 732d6ca..5193d7f 100755
--- a/test/aggregate-results.sh
+++ b/test/aggregate-results.sh
@@ -49,10 +49,12 @@ pluralize () {
 }
 
 echo "Notmuch test suite complete."
+ev=1
 if [ "$fixed" = "0" ] && [ "$failed" = "0" ]; then
     tests=$(pluralize "test" $total)
     printf "All $total $tests "
     if [ "$broken" = "0" ]; then
+	ev=0
 	echo "passed."
     else
 	failures=$(pluralize "failure" $broken)
@@ -76,6 +78,9 @@ fi
 
 skipped=$(($total - $fixed - $success - $failed - $broken))
 if [ "$skipped" != "0" ]; then
+    ev=1
     tests=$(pluralize "test" $skipped)
     echo "$skipped $tests skipped."
 fi
+
+exit $ev
diff --git a/test/notmuch-test b/test/notmuch-test
index 6db7979..aa28bb0 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -97,6 +97,9 @@ trap - HUP INT TERM
 
 # Report results
 ./aggregate-results.sh test-results/*
+ev=$?
 
 # Clean up
 rm -rf test-results corpus.mail
+
+exit $ev
-- 
1.7.10.4



More information about the notmuch mailing list