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) | |
416 platform.Run = MagicMock( | 415 platform.Run = MagicMock( |
417 return_value=("Richards: 1.234\nDeltaBlue: 10657567\n", None)) | 416 return_value=("Richards: 1.234\nDeltaBlue: 10657567\n", None)) |
418 run_perf.AndroidPlatform = MagicMock(return_value=platform) | 417 run_perf.AndroidPlatform = MagicMock(return_value=platform) |
419 self.assertEquals( | 418 self.assertEquals( |
420 0, self._CallMain("--android-build-tools", "/some/dir", | 419 0, self._CallMain("--android-build-tools", "/some/dir", |
421 "--arch", "arm")) | 420 "--arch", "arm")) |
422 self._VerifyResults("test", "score", [ | 421 self._VerifyResults("test", "score", [ |
423 {"name": "Richards", "results": ["1.234"], "stddev": ""}, | 422 {"name": "Richards", "results": ["1.234"], "stddev": ""}, |
424 {"name": "DeltaBlue", "results": ["10657567.0"], "stddev": ""}, | 423 {"name": "DeltaBlue", "results": ["10657567.0"], "stddev": ""}, |
425 ]) | 424 ]) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 self._VerifyMock(path.join("out", "x64.release", "d7"), | 466 self._VerifyMock(path.join("out", "x64.release", "d7"), |
468 "--flag", "--prof", "run.js") | 467 "--flag", "--prof", "run.js") |
469 | 468 |
470 def testUnzip(self): | 469 def testUnzip(self): |
471 def Gen(): | 470 def Gen(): |
472 for i in [1, 2, 3]: | 471 for i in [1, 2, 3]: |
473 yield i, i + 1 | 472 yield i, i + 1 |
474 l, r = run_perf.Unzip(Gen()) | 473 l, r = run_perf.Unzip(Gen()) |
475 self.assertEquals([1, 2, 3], list(l())) | 474 self.assertEquals([1, 2, 3], list(l())) |
476 self.assertEquals([2, 3, 4], list(r())) | 475 self.assertEquals([2, 3, 4], list(r())) |
OLD | NEW |