run-tests: exit with non-0 exit code when tests fail or warn
authorGregory Szorc <gregory.szorc@gmail.com>
Tue, 27 May 2014 19:10:22 -0700
changeset 21613 b3213b9fafed
parent 21612 f221eb0531d9
child 21614 609a642dff61
run-tests: exit with non-0 exit code when tests fail or warn As part of the run-tests.py refactor, run-tests.py accidentally started exiting with 0 for most test runs. This patch restores the expected behavior.
tests/run-tests.py
--- a/tests/run-tests.py	Fri May 23 20:23:54 2014 -0700
+++ b/tests/run-tests.py	Tue May 27 19:10:22 2014 -0700
@@ -1318,6 +1318,8 @@
         if self._runner.options.time:
             self.printtimes(result.times)
 
+        return result
+
     def printtimes(self, times):
         self.stream.writeln('# Producing time report')
         times.sort(key=lambda t: (t[1], t[0]), reverse=True)
@@ -1537,7 +1539,12 @@
             if self.options.verbose:
                 verbosity = 2
             runner = TextTestRunner(self, verbosity=verbosity)
-            runner.run(suite)
+            result = runner.run(suite)
+
+            if result.failures:
+                failed = True
+            if result.warned:
+                warned = True
 
             if self.options.anycoverage:
                 self._outputcoverage()