Fix error detection & exit in report_results
We wish to fail if we have >0 zero errors, not >1 errors (i.e. exactly
one error did not trigger a failure!)
This change also brings consistency to the pass & failure paths by
ensuring report_results exits in both cases, since report_results is
supposed to be the last thing run in a test file.
Change-Id: Id4721dffe13721e6c3cd71bca40c3395627e98bf
diff --git a/tests/unittest.sh b/tests/unittest.sh
index df7a8b4..2570319 100644
--- a/tests/unittest.sh
+++ b/tests/unittest.sh
@@ -92,16 +92,17 @@
fi
}
-# print a summary of passing and failing tests, exiting
-# with an error if we have failed tests
+# Print a summary of passing and failing tests and exit
+# (with an error if we have failed tests)
# usage: report_results
function report_results {
echo "$PASS Tests PASSED"
- if [[ $ERROR -gt 1 ]]; then
+ if [[ $ERROR -gt 0 ]]; then
echo
echo "The following $ERROR tests FAILED"
echo -e "$FAILED_FUNCS"
echo "---"
exit 1
fi
+ exit 0
}