test: exit with nonzero value when not all tests completed successfully

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).
This commit is contained in:
Tomi Ollila 2013-09-08 18:53:30 +03:00 committed by David Bremner
parent 5c19eb46a9
commit 11a3805464
2 changed files with 12 additions and 0 deletions

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
fixed=0 fixed=0
success=0 success=0
failed=0 failed=0
@ -79,3 +81,10 @@ if [ "$skipped" != "0" ]; then
tests=$(pluralize "test" $skipped) tests=$(pluralize "test" $skipped)
echo "$skipped $tests skipped." echo "$skipped $tests skipped."
fi fi
if [ $success -gt 0 -a $fixed -eq 0 -a $failed -eq 0 -a $skipped -eq 0 ]
then
exit 0
else
exit 1
fi

View file

@ -97,6 +97,9 @@ trap - HUP INT TERM
# Report results # Report results
./aggregate-results.sh test-results/* ./aggregate-results.sh test-results/*
ev=$?
# Clean up # Clean up
rm -rf test-results corpus.mail rm -rf test-results corpus.mail
exit $ev