Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: tools/unittests/run_benchmarks_test.py

Issue 502473002: Teach benchmark runner to understand generic traces. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« tools/run_benchmarks.py ('K') | « tools/run_benchmarks.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 the V8 project authors. All rights reserved. 2 # Copyright 2014 the V8 project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 from collections import namedtuple 6 from collections import namedtuple
7 import coverage 7 import coverage
8 import json 8 import json
9 from mock import DEFAULT 9 from mock import DEFAULT
10 from mock import MagicMock 10 from mock import MagicMock
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 "main": "run.js", 61 "main": "run.js",
62 "flags": ["--flag2"], 62 "flags": ["--flag2"],
63 "results_regexp": "^DeltaBlue: (.+)$"}, 63 "results_regexp": "^DeltaBlue: (.+)$"},
64 {"name": "ShouldntRun", 64 {"name": "ShouldntRun",
65 "path": ["."], 65 "path": ["."],
66 "archs": ["arm"], 66 "archs": ["arm"],
67 "main": "run.js"}, 67 "main": "run.js"},
68 ] 68 ]
69 } 69 }
70 70
71 V8_GENERIC_JSON = {
72 "path": ["."],
73 "binary": "cc",
74 "flags": ["--flag"],
75 "generic": True,
76 "run_count": 1,
77 "units": "ms",
78 }
79
71 Output = namedtuple("Output", "stdout, stderr") 80 Output = namedtuple("Output", "stdout, stderr")
72 81
73 class BenchmarksTest(unittest.TestCase): 82 class BenchmarksTest(unittest.TestCase):
74 @classmethod 83 @classmethod
75 def setUpClass(cls): 84 def setUpClass(cls):
76 cls.base = path.dirname(path.dirname(path.abspath(__file__))) 85 cls.base = path.dirname(path.dirname(path.abspath(__file__)))
77 sys.path.append(cls.base) 86 sys.path.append(cls.base)
78 cls._cov = coverage.coverage( 87 cls._cov = coverage.coverage(
79 include=([os.path.join(cls.base, "run_benchmarks.py")])) 88 include=([os.path.join(cls.base, "run_benchmarks.py")]))
80 cls._cov.start() 89 cls._cov.start()
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 self._WriteTestInput(V8_JSON) 297 self._WriteTestInput(V8_JSON)
289 self._MockCommand(["."], ["x\nRichaards: 1.234\nDeltaBlue: 10657567\ny\n"]) 298 self._MockCommand(["."], ["x\nRichaards: 1.234\nDeltaBlue: 10657567\ny\n"])
290 self.assertEquals(1, self._CallMain()) 299 self.assertEquals(1, self._CallMain())
291 self._VerifyResults("test", "score", [ 300 self._VerifyResults("test", "score", [
292 {"name": "Richards", "results": [], "stddev": ""}, 301 {"name": "Richards", "results": [], "stddev": ""},
293 {"name": "DeltaBlue", "results": ["10657567"], "stddev": ""}, 302 {"name": "DeltaBlue", "results": ["10657567"], "stddev": ""},
294 ]) 303 ])
295 self._VerifyErrors( 304 self._VerifyErrors(
296 ["Regexp \"^Richards: (.+)$\" didn't match for benchmark Richards."]) 305 ["Regexp \"^Richards: (.+)$\" didn't match for benchmark Richards."])
297 self._VerifyMock(path.join("out", "x64.release", "d7"), "--flag", "run.js") 306 self._VerifyMock(path.join("out", "x64.release", "d7"), "--flag", "run.js")
307
308 def testOneRunGeneric(self):
309 test_input = dict(V8_GENERIC_JSON)
310 self._WriteTestInput(test_input)
311 self._MockCommand(["."], [
312 "Trace(Test1), Result(1.234), StdDev(0.23)\n"
313 "Trace(Test2), Result(10657567), StdDev(106)\n"])
314 self.assertEquals(0, self._CallMain())
315 self._VerifyResults("test", "ms", [
316 {"name": "Test1", "results": ["1.234"], "stddev": "0.23"},
317 {"name": "Test2", "results": ["10657567"], "stddev": "106"},
318 ])
319 self._VerifyErrors([])
320 self._VerifyMock(path.join("out", "x64.release", "cc"), "--flag", "")
OLDNEW
« tools/run_benchmarks.py ('K') | « tools/run_benchmarks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698