OLD | NEW |
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 {"name": "DeltaBlue", "results": ["10657567"], "stddev": ""}, | 335 {"name": "DeltaBlue", "results": ["10657567"], "stddev": ""}, |
336 ]) | 336 ]) |
337 self._VerifyErrors( | 337 self._VerifyErrors( |
338 ["Regexp \"^Richards: (.+)$\" didn't match for test Richards."]) | 338 ["Regexp \"^Richards: (.+)$\" didn't match for test Richards."]) |
339 self._VerifyMock(path.join("out", "x64.release", "d7"), "--flag", "run.js") | 339 self._VerifyMock(path.join("out", "x64.release", "d7"), "--flag", "run.js") |
340 | 340 |
341 def testOneRunGeneric(self): | 341 def testOneRunGeneric(self): |
342 test_input = dict(V8_GENERIC_JSON) | 342 test_input = dict(V8_GENERIC_JSON) |
343 self._WriteTestInput(test_input) | 343 self._WriteTestInput(test_input) |
344 self._MockCommand(["."], [ | 344 self._MockCommand(["."], [ |
345 "Trace(Test1), Result(1.234), StdDev(0.23)\n" | 345 "RESULT Infra: Constant1= 11 count\n" |
346 "Trace(Test2), Result(10657567), StdDev(106)\n"]) | 346 "RESULT Infra: Constant2= [10,5,10,15] count\n" |
| 347 "RESULT Infra: Constant3= {12,1.2} count\n"]) |
347 self.assertEquals(0, self._CallMain()) | 348 self.assertEquals(0, self._CallMain()) |
348 self._VerifyResults("test", "ms", [ | 349 self.assertEquals([ |
349 {"name": "Test1", "results": ["1.234"], "stddev": "0.23"}, | 350 {"units": "count", |
350 {"name": "Test2", "results": ["10657567"], "stddev": "106"}, | 351 "graphs": ["test", "Infra", "Constant1"], |
351 ]) | 352 "results": ["11"], |
| 353 "stddev": ""}, |
| 354 {"units": "count", |
| 355 "graphs": ["test", "Infra", "Constant2"], |
| 356 "results": ["10", "5", "10", "15"], |
| 357 "stddev": ""}, |
| 358 {"units": "count", |
| 359 "graphs": ["test", "Infra", "Constant3"], |
| 360 "results": ["12"], |
| 361 "stddev": "1.2"}, |
| 362 ], self._LoadResults()["traces"]) |
352 self._VerifyErrors([]) | 363 self._VerifyErrors([]) |
353 self._VerifyMock(path.join("out", "x64.release", "cc"), "--flag", "") | 364 self._VerifyMock(path.join("out", "x64.release", "cc"), "--flag", "") |
354 | 365 |
355 def testOneRunTimingOut(self): | 366 def testOneRunTimingOut(self): |
356 test_input = dict(V8_JSON) | 367 test_input = dict(V8_JSON) |
357 test_input["timeout"] = 70 | 368 test_input["timeout"] = 70 |
358 self._WriteTestInput(test_input) | 369 self._WriteTestInput(test_input) |
359 self._MockCommand(["."], [""], timed_out=True) | 370 self._MockCommand(["."], [""], timed_out=True) |
360 self.assertEquals(1, self._CallMain()) | 371 self.assertEquals(1, self._CallMain()) |
361 self._VerifyResults("test", "score", [ | 372 self._VerifyResults("test", "score", [ |
362 {"name": "Richards", "results": [], "stddev": ""}, | 373 {"name": "Richards", "results": [], "stddev": ""}, |
363 {"name": "DeltaBlue", "results": [], "stddev": ""}, | 374 {"name": "DeltaBlue", "results": [], "stddev": ""}, |
364 ]) | 375 ]) |
365 self._VerifyErrors([ | 376 self._VerifyErrors([ |
366 "Regexp \"^Richards: (.+)$\" didn't match for test Richards.", | 377 "Regexp \"^Richards: (.+)$\" didn't match for test Richards.", |
367 "Regexp \"^DeltaBlue: (.+)$\" didn't match for test DeltaBlue.", | 378 "Regexp \"^DeltaBlue: (.+)$\" didn't match for test DeltaBlue.", |
368 ]) | 379 ]) |
369 self._VerifyMock( | 380 self._VerifyMock( |
370 path.join("out", "x64.release", "d7"), "--flag", "run.js", timeout=70) | 381 path.join("out", "x64.release", "d7"), "--flag", "run.js", timeout=70) |
OLD | NEW |