OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Runs perf tests. | 5 """Runs perf tests. |
6 | 6 |
7 Our buildbot infrastructure requires each slave to run steps serially. | 7 Our buildbot infrastructure requires each slave to run steps serially. |
8 This is sub-optimal for android, where these steps can run independently on | 8 This is sub-optimal for android, where these steps can run independently on |
9 multiple connected devices. | 9 multiple connected devices. |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 "device_affinity": int, | 27 "device_affinity": int, |
28 "cmd": "script_to_execute foo" | 28 "cmd": "script_to_execute foo" |
29 }, | 29 }, |
30 "bar": { | 30 "bar": { |
31 "device_affinity": int, | 31 "device_affinity": int, |
32 "cmd": "script_to_execute bar" | 32 "cmd": "script_to_execute bar" |
33 } | 33 } |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 # TODO(bulach): remove once it rolls downstream, crbug.com/378862. | |
38 The OLD JSON steps file contains a dictionary in the format: | |
39 [ | |
40 ["step_name_foo", "script_to_execute foo"], | |
41 ["step_name_bar", "script_to_execute bar"] | |
42 ] | |
43 | |
44 This preserves the order in which the steps are executed. | |
45 | |
46 The JSON flaky steps file contains a list with step names which results should | 37 The JSON flaky steps file contains a list with step names which results should |
47 be ignored: | 38 be ignored: |
48 [ | 39 [ |
49 "step_name_foo", | 40 "step_name_foo", |
50 "step_name_bar" | 41 "step_name_bar" |
51 ] | 42 ] |
52 | 43 |
53 Note that script_to_execute necessarily have to take at least the following | 44 Note that script_to_execute necessarily have to take at least the following |
54 option: | 45 option: |
55 --device: the serial number to be passed to all adb commands. | 46 --device: the serial number to be passed to all adb commands. |
(...skipping 12 matching lines...) Expand all Loading... |
68 from pylib import cmd_helper | 59 from pylib import cmd_helper |
69 from pylib import constants | 60 from pylib import constants |
70 from pylib import forwarder | 61 from pylib import forwarder |
71 from pylib.base import base_test_result | 62 from pylib.base import base_test_result |
72 from pylib.base import base_test_runner | 63 from pylib.base import base_test_runner |
73 | 64 |
74 | 65 |
75 def OutputJsonList(json_input, json_output): | 66 def OutputJsonList(json_input, json_output): |
76 with file(json_input, 'r') as i: | 67 with file(json_input, 'r') as i: |
77 all_steps = json.load(i) | 68 all_steps = json.load(i) |
78 # TODO(bulach): remove once it rolls downstream, crbug.com/378862. | 69 step_names = all_steps['steps'].keys() |
79 if isinstance(all_steps, list): | |
80 step_names = [t[0] for t in all_steps] | |
81 else: | |
82 step_names = all_steps['steps'].keys() | |
83 with file(json_output, 'w') as o: | 70 with file(json_output, 'w') as o: |
84 o.write(json.dumps(step_names)) | 71 o.write(json.dumps(step_names)) |
85 return 0 | 72 return 0 |
86 | 73 |
87 | 74 |
88 def PrintTestOutput(test_name): | 75 def PrintTestOutput(test_name): |
89 """Helper method to print the output of previously executed test_name. | 76 """Helper method to print the output of previously executed test_name. |
90 | 77 |
91 Args: | 78 Args: |
92 test_name: name of the test that has been previously executed. | 79 test_name: name of the test that has been previously executed. |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 Returns: | 283 Returns: |
297 A tuple of (TestRunResults, retry). | 284 A tuple of (TestRunResults, retry). |
298 """ | 285 """ |
299 _, result_type = self._LaunchPerfTest(test_name) | 286 _, result_type = self._LaunchPerfTest(test_name) |
300 results = base_test_result.TestRunResults() | 287 results = base_test_result.TestRunResults() |
301 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 288 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
302 retry = None | 289 retry = None |
303 if not results.DidRunPass(): | 290 if not results.DidRunPass(): |
304 retry = test_name | 291 retry = test_name |
305 return results, retry | 292 return results, retry |
OLD | NEW |