Let benchmark runner exit with proper return codes.
authormachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 3 Jun 2014 14:58:52 +0000 (14:58 +0000)
committermachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 3 Jun 2014 14:58:52 +0000 (14:58 +0000)
BUG=374740
LOG=n
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/313603002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21648 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/run_benchmarks.py
tools/unittests/run_benchmarks_test.py

index 42b5bf5..1a07025 100755 (executable)
@@ -345,7 +345,7 @@ def Main(args):
 
   if not options.arch in SUPPORTED_ARCHS:  # pragma: no cover
     print "Unknown architecture %s" % options.arch
-    return False
+    return 1
 
   workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
 
@@ -395,5 +395,7 @@ def Main(args):
   else:  # pragma: no cover
     print results
 
+  return min(1, len(results.errors))
+
 if __name__ == "__main__":  # pragma: no cover
   sys.exit(Main(sys.argv[1:]))
index 746d0ea..f627d43 100644 (file)
@@ -125,7 +125,7 @@ class BenchmarksTest(unittest.TestCase):
       self._test_input,
     ]
     all_args += args
-    run_benchmarks.Main(all_args)
+    return run_benchmarks.Main(all_args)
 
   def _LoadResults(self):
     with open(self._test_output) as f:
@@ -157,7 +157,7 @@ class BenchmarksTest(unittest.TestCase):
   def testOneRun(self):
     self._WriteTestInput(V8_JSON)
     self._MockCommand(["."], ["x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n"])
-    self._CallMain()
+    self.assertEquals(0, self._CallMain())
     self._VerifyResults("test", "score", [
       {"name": "Richards", "results": ["1.234"]},
       {"name": "DeltaBlue", "results": ["10657567"]},
@@ -174,7 +174,7 @@ class BenchmarksTest(unittest.TestCase):
     self._MockCommand([".", "."],
                       ["Richards: 100\nDeltaBlue: 200\n",
                        "Richards: 50\nDeltaBlue: 300\n"])
-    self._CallMain()
+    self.assertEquals(0, self._CallMain())
     self._VerifyResults("v8", "ms", [
       {"name": "Richards", "results": ["50", "100"]},
       {"name": "DeltaBlue", "results": ["300", "200"]},
@@ -192,7 +192,7 @@ class BenchmarksTest(unittest.TestCase):
     self._MockCommand([".", "."],
                       ["Richards: 100\nDeltaBlue: 200\n",
                        "Richards: 50\nDeltaBlue: 300\n"])
-    self._CallMain()
+    self.assertEquals(0, self._CallMain())
     self._VerifyResults("test", "score", [
       {"name": "Richards", "results": ["50", "100"]},
       {"name": "DeltaBlue", "results": ["300", "200"]},
@@ -209,7 +209,7 @@ class BenchmarksTest(unittest.TestCase):
                        "Simple: 3 ms.\n",
                        "Richards: 100\n",
                        "Richards: 50\n"])
-    self._CallMain()
+    self.assertEquals(0, self._CallMain())
     self.assertEquals([
       {"units": "score",
        "graphs": ["test", "Richards"],
@@ -235,7 +235,7 @@ class BenchmarksTest(unittest.TestCase):
   def testBuildbot(self):
     self._WriteTestInput(V8_JSON)
     self._MockCommand(["."], ["Richards: 1.234\nDeltaBlue: 10657567\n"])
-    self._CallMain("--buildbot")
+    self.assertEquals(0, self._CallMain("--buildbot"))
     self._VerifyResults("test", "score", [
       {"name": "Richards", "results": ["1.234"]},
       {"name": "DeltaBlue", "results": ["10657567"]},
@@ -246,7 +246,7 @@ class BenchmarksTest(unittest.TestCase):
   def testRegexpNoMatch(self):
     self._WriteTestInput(V8_JSON)
     self._MockCommand(["."], ["x\nRichaards: 1.234\nDeltaBlue: 10657567\ny\n"])
-    self._CallMain()
+    self.assertEquals(1, self._CallMain())
     self._VerifyResults("test", "score", [
       {"name": "Richards", "results": []},
       {"name": "DeltaBlue", "results": ["10657567"]},