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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 # Simple test that mocks out the android platform. Testing the platform would | 406 # Simple test that mocks out the android platform. Testing the platform would |
407 # require lots of complicated mocks for the android tools. | 407 # require lots of complicated mocks for the android tools. |
408 def testAndroid(self): | 408 def testAndroid(self): |
409 self._WriteTestInput(V8_JSON) | 409 self._WriteTestInput(V8_JSON) |
410 # FIXME(machenbach): This is not test-local! | 410 # FIXME(machenbach): This is not test-local! |
411 platform = run_perf.AndroidPlatform | 411 platform = run_perf.AndroidPlatform |
412 platform.PreExecution = MagicMock(return_value=None) | 412 platform.PreExecution = MagicMock(return_value=None) |
413 platform.PostExecution = MagicMock(return_value=None) | 413 platform.PostExecution = MagicMock(return_value=None) |
414 platform.PreTests = MagicMock(return_value=None) | 414 platform.PreTests = MagicMock(return_value=None) |
| 415 platform.PrintResult = MagicMock(return_value=None) |
415 platform.Run = MagicMock( | 416 platform.Run = MagicMock( |
416 return_value=("Richards: 1.234\nDeltaBlue: 10657567\n", None)) | 417 return_value=("Richards: 1.234\nDeltaBlue: 10657567\n", None)) |
417 run_perf.AndroidPlatform = MagicMock(return_value=platform) | 418 run_perf.AndroidPlatform = MagicMock(return_value=platform) |
418 self.assertEquals( | 419 self.assertEquals( |
419 0, self._CallMain("--android-build-tools", "/some/dir", | 420 0, self._CallMain("--android-build-tools", "/some/dir", |
420 "--arch", "arm")) | 421 "--arch", "arm")) |
421 self._VerifyResults("test", "score", [ | 422 self._VerifyResults("test", "score", [ |
422 {"name": "Richards", "results": ["1.234"], "stddev": ""}, | 423 {"name": "Richards", "results": ["1.234"], "stddev": ""}, |
423 {"name": "DeltaBlue", "results": ["10657567.0"], "stddev": ""}, | 424 {"name": "DeltaBlue", "results": ["10657567.0"], "stddev": ""}, |
424 ]) | 425 ]) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 self._VerifyMock(path.join("out", "x64.release", "d7"), | 467 self._VerifyMock(path.join("out", "x64.release", "d7"), |
467 "--flag", "--prof", "run.js") | 468 "--flag", "--prof", "run.js") |
468 | 469 |
469 def testUnzip(self): | 470 def testUnzip(self): |
470 def Gen(): | 471 def Gen(): |
471 for i in [1, 2, 3]: | 472 for i in [1, 2, 3]: |
472 yield i, i + 1 | 473 yield i, i + 1 |
473 l, r = run_perf.Unzip(Gen()) | 474 l, r = run_perf.Unzip(Gen()) |
474 self.assertEquals([1, 2, 3], list(l())) | 475 self.assertEquals([1, 2, 3], list(l())) |
475 self.assertEquals([2, 3, 4], list(r())) | 476 self.assertEquals([2, 3, 4], list(r())) |
OLD | NEW |