Browse code

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

Ian Wienand authored on 2015/11/13 09:15:15
Showing 1 changed files
... ...
@@ -92,16 +92,17 @@ function assert_empty {
92 92
     fi
93 93
 }
94 94
 
95
-# print a summary of passing and failing tests, exiting
96
-# with an error if we have failed tests
95
+# Print a summary of passing and failing tests and exit
96
+# (with an error if we have failed tests)
97 97
 #  usage: report_results
98 98
 function report_results {
99 99
     echo "$PASS Tests PASSED"
100
-    if [[ $ERROR -gt 1 ]]; then
100
+    if [[ $ERROR -gt 0 ]]; then
101 101
         echo
102 102
         echo "The following $ERROR tests FAILED"
103 103
         echo -e "$FAILED_FUNCS"
104 104
         echo "---"
105 105
         exit 1
106 106
     fi
107
+    exit 0
107 108
 }