Let benchmark runner exit with proper return codes.

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
parent f9f63249
...@@ -345,7 +345,7 @@ def Main(args): ...@@ -345,7 +345,7 @@ def Main(args):
if not options.arch in SUPPORTED_ARCHS: # pragma: no cover if not options.arch in SUPPORTED_ARCHS: # pragma: no cover
print "Unknown architecture %s" % options.arch print "Unknown architecture %s" % options.arch
return False return 1
workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
...@@ -395,5 +395,7 @@ def Main(args): ...@@ -395,5 +395,7 @@ def Main(args):
else: # pragma: no cover else: # pragma: no cover
print results print results
return min(1, len(results.errors))
if __name__ == "__main__": # pragma: no cover if __name__ == "__main__": # pragma: no cover
sys.exit(Main(sys.argv[1:])) sys.exit(Main(sys.argv[1:]))
...@@ -125,7 +125,7 @@ class BenchmarksTest(unittest.TestCase): ...@@ -125,7 +125,7 @@ class BenchmarksTest(unittest.TestCase):
self._test_input, self._test_input,
] ]
all_args += args all_args += args
run_benchmarks.Main(all_args) return run_benchmarks.Main(all_args)
def _LoadResults(self): def _LoadResults(self):
with open(self._test_output) as f: with open(self._test_output) as f:
...@@ -157,7 +157,7 @@ class BenchmarksTest(unittest.TestCase): ...@@ -157,7 +157,7 @@ class BenchmarksTest(unittest.TestCase):
def testOneRun(self): def testOneRun(self):
self._WriteTestInput(V8_JSON) self._WriteTestInput(V8_JSON)
self._MockCommand(["."], ["x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n"]) self._MockCommand(["."], ["x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n"])
self._CallMain() self.assertEquals(0, self._CallMain())
self._VerifyResults("test", "score", [ self._VerifyResults("test", "score", [
{"name": "Richards", "results": ["1.234"]}, {"name": "Richards", "results": ["1.234"]},
{"name": "DeltaBlue", "results": ["10657567"]}, {"name": "DeltaBlue", "results": ["10657567"]},
...@@ -174,7 +174,7 @@ class BenchmarksTest(unittest.TestCase): ...@@ -174,7 +174,7 @@ class BenchmarksTest(unittest.TestCase):
self._MockCommand([".", "."], self._MockCommand([".", "."],
["Richards: 100\nDeltaBlue: 200\n", ["Richards: 100\nDeltaBlue: 200\n",
"Richards: 50\nDeltaBlue: 300\n"]) "Richards: 50\nDeltaBlue: 300\n"])
self._CallMain() self.assertEquals(0, self._CallMain())
self._VerifyResults("v8", "ms", [ self._VerifyResults("v8", "ms", [
{"name": "Richards", "results": ["50", "100"]}, {"name": "Richards", "results": ["50", "100"]},
{"name": "DeltaBlue", "results": ["300", "200"]}, {"name": "DeltaBlue", "results": ["300", "200"]},
...@@ -192,7 +192,7 @@ class BenchmarksTest(unittest.TestCase): ...@@ -192,7 +192,7 @@ class BenchmarksTest(unittest.TestCase):
self._MockCommand([".", "."], self._MockCommand([".", "."],
["Richards: 100\nDeltaBlue: 200\n", ["Richards: 100\nDeltaBlue: 200\n",
"Richards: 50\nDeltaBlue: 300\n"]) "Richards: 50\nDeltaBlue: 300\n"])
self._CallMain() self.assertEquals(0, self._CallMain())
self._VerifyResults("test", "score", [ self._VerifyResults("test", "score", [
{"name": "Richards", "results": ["50", "100"]}, {"name": "Richards", "results": ["50", "100"]},
{"name": "DeltaBlue", "results": ["300", "200"]}, {"name": "DeltaBlue", "results": ["300", "200"]},
...@@ -209,7 +209,7 @@ class BenchmarksTest(unittest.TestCase): ...@@ -209,7 +209,7 @@ class BenchmarksTest(unittest.TestCase):
"Simple: 3 ms.\n", "Simple: 3 ms.\n",
"Richards: 100\n", "Richards: 100\n",
"Richards: 50\n"]) "Richards: 50\n"])
self._CallMain() self.assertEquals(0, self._CallMain())
self.assertEquals([ self.assertEquals([
{"units": "score", {"units": "score",
"graphs": ["test", "Richards"], "graphs": ["test", "Richards"],
...@@ -235,7 +235,7 @@ class BenchmarksTest(unittest.TestCase): ...@@ -235,7 +235,7 @@ class BenchmarksTest(unittest.TestCase):
def testBuildbot(self): def testBuildbot(self):
self._WriteTestInput(V8_JSON) self._WriteTestInput(V8_JSON)
self._MockCommand(["."], ["Richards: 1.234\nDeltaBlue: 10657567\n"]) self._MockCommand(["."], ["Richards: 1.234\nDeltaBlue: 10657567\n"])
self._CallMain("--buildbot") self.assertEquals(0, self._CallMain("--buildbot"))
self._VerifyResults("test", "score", [ self._VerifyResults("test", "score", [
{"name": "Richards", "results": ["1.234"]}, {"name": "Richards", "results": ["1.234"]},
{"name": "DeltaBlue", "results": ["10657567"]}, {"name": "DeltaBlue", "results": ["10657567"]},
...@@ -246,7 +246,7 @@ class BenchmarksTest(unittest.TestCase): ...@@ -246,7 +246,7 @@ class BenchmarksTest(unittest.TestCase):
def testRegexpNoMatch(self): def testRegexpNoMatch(self):
self._WriteTestInput(V8_JSON) self._WriteTestInput(V8_JSON)
self._MockCommand(["."], ["x\nRichaards: 1.234\nDeltaBlue: 10657567\ny\n"]) self._MockCommand(["."], ["x\nRichaards: 1.234\nDeltaBlue: 10657567\ny\n"])
self._CallMain() self.assertEquals(1, self._CallMain())
self._VerifyResults("test", "score", [ self._VerifyResults("test", "score", [
{"name": "Richards", "results": []}, {"name": "Richards", "results": []},
{"name": "DeltaBlue", "results": ["10657567"]}, {"name": "DeltaBlue", "results": ["10657567"]},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment