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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 self._WriteTestInput(V8_JSON) | 172 self._WriteTestInput(V8_JSON) |
173 self._MockCommand(["."], ["x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n"]) | 173 self._MockCommand(["."], ["x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n"]) |
174 self.assertEquals(0, self._CallMain()) | 174 self.assertEquals(0, self._CallMain()) |
175 self._VerifyResults("test", "score", [ | 175 self._VerifyResults("test", "score", [ |
176 {"name": "Richards", "results": ["1.234"], "stddev": ""}, | 176 {"name": "Richards", "results": ["1.234"], "stddev": ""}, |
177 {"name": "DeltaBlue", "results": ["10657567"], "stddev": ""}, | 177 {"name": "DeltaBlue", "results": ["10657567"], "stddev": ""}, |
178 ]) | 178 ]) |
179 self._VerifyErrors([]) | 179 self._VerifyErrors([]) |
180 self._VerifyMock(path.join("out", "x64.release", "d7"), "--flag", "run.js") | 180 self._VerifyMock(path.join("out", "x64.release", "d7"), "--flag", "run.js") |
181 | 181 |
| 182 def testOneRunWithTestFlags(self): |
| 183 test_input = dict(V8_JSON) |
| 184 test_input["test_flags"] = ["2", "test_name"] |
| 185 self._WriteTestInput(test_input) |
| 186 self._MockCommand(["."], ["Richards: 1.234\nDeltaBlue: 10657567"]) |
| 187 self.assertEquals(0, self._CallMain()) |
| 188 self._VerifyResults("test", "score", [ |
| 189 {"name": "Richards", "results": ["1.234"], "stddev": ""}, |
| 190 {"name": "DeltaBlue", "results": ["10657567"], "stddev": ""}, |
| 191 ]) |
| 192 self._VerifyErrors([]) |
| 193 self._VerifyMock(path.join("out", "x64.release", "d7"), "--flag", "run.js", |
| 194 "--", "2", "test_name") |
| 195 |
182 def testTwoRuns_Units_SuiteName(self): | 196 def testTwoRuns_Units_SuiteName(self): |
183 test_input = dict(V8_JSON) | 197 test_input = dict(V8_JSON) |
184 test_input["run_count"] = 2 | 198 test_input["run_count"] = 2 |
185 test_input["name"] = "v8" | 199 test_input["name"] = "v8" |
186 test_input["units"] = "ms" | 200 test_input["units"] = "ms" |
187 self._WriteTestInput(test_input) | 201 self._WriteTestInput(test_input) |
188 self._MockCommand([".", "."], | 202 self._MockCommand([".", "."], |
189 ["Richards: 100\nDeltaBlue: 200\n", | 203 ["Richards: 100\nDeltaBlue: 200\n", |
190 "Richards: 50\nDeltaBlue: 300\n"]) | 204 "Richards: 50\nDeltaBlue: 300\n"]) |
191 self.assertEquals(0, self._CallMain()) | 205 self.assertEquals(0, self._CallMain()) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 self._VerifyResults("test", "score", [ | 386 self._VerifyResults("test", "score", [ |
373 {"name": "Richards", "results": [], "stddev": ""}, | 387 {"name": "Richards", "results": [], "stddev": ""}, |
374 {"name": "DeltaBlue", "results": [], "stddev": ""}, | 388 {"name": "DeltaBlue", "results": [], "stddev": ""}, |
375 ]) | 389 ]) |
376 self._VerifyErrors([ | 390 self._VerifyErrors([ |
377 "Regexp \"^Richards: (.+)$\" didn't match for test Richards.", | 391 "Regexp \"^Richards: (.+)$\" didn't match for test Richards.", |
378 "Regexp \"^DeltaBlue: (.+)$\" didn't match for test DeltaBlue.", | 392 "Regexp \"^DeltaBlue: (.+)$\" didn't match for test DeltaBlue.", |
379 ]) | 393 ]) |
380 self._VerifyMock( | 394 self._VerifyMock( |
381 path.join("out", "x64.release", "d7"), "--flag", "run.js", timeout=70) | 395 path.join("out", "x64.release", "d7"), "--flag", "run.js", timeout=70) |
OLD | NEW |