| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 "step_name_bar" | 50 "step_name_bar" |
| 51 ] | 51 ] |
| 52 | 52 |
| 53 Note that script_to_execute necessarily have to take at least the following | 53 Note that script_to_execute necessarily have to take at least the following |
| 54 option: | 54 option: |
| 55 --device: the serial number to be passed to all adb commands. | 55 --device: the serial number to be passed to all adb commands. |
| 56 """ | 56 """ |
| 57 | 57 |
| 58 import collections | 58 import collections |
| 59 import datetime | 59 import datetime |
| 60 import json |
| 60 import logging | 61 import logging |
| 61 import os | 62 import os |
| 62 import pickle | 63 import pickle |
| 63 import sys | 64 import sys |
| 64 import threading | 65 import threading |
| 65 import time | 66 import time |
| 66 | 67 |
| 67 from pylib import cmd_helper | 68 from pylib import cmd_helper |
| 68 from pylib import constants | 69 from pylib import constants |
| 69 from pylib import forwarder | 70 from pylib import forwarder |
| 70 from pylib.base import base_test_result | 71 from pylib.base import base_test_result |
| 71 from pylib.base import base_test_runner | 72 from pylib.base import base_test_runner |
| 72 | 73 |
| 73 | 74 |
| 75 def OutputJsonList(json_input, json_output): |
| 76 with file(json_input, 'r') as i: |
| 77 all_steps = json.load(i) |
| 78 # TODO(bulach): remove once it rolls downstream, crbug.com/378862. |
| 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: |
| 84 o.write(json.dumps(step_names)) |
| 85 return 0 |
| 86 |
| 87 |
| 74 def PrintTestOutput(test_name): | 88 def PrintTestOutput(test_name): |
| 75 """Helper method to print the output of previously executed test_name. | 89 """Helper method to print the output of previously executed test_name. |
| 76 | 90 |
| 77 Args: | 91 Args: |
| 78 test_name: name of the test that has been previously executed. | 92 test_name: name of the test that has been previously executed. |
| 79 | 93 |
| 80 Returns: | 94 Returns: |
| 81 exit code generated by the test step. | 95 exit code generated by the test step. |
| 82 """ | 96 """ |
| 83 file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name) | 97 file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name) |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 Returns: | 296 Returns: |
| 283 A tuple of (TestRunResults, retry). | 297 A tuple of (TestRunResults, retry). |
| 284 """ | 298 """ |
| 285 _, result_type = self._LaunchPerfTest(test_name) | 299 _, result_type = self._LaunchPerfTest(test_name) |
| 286 results = base_test_result.TestRunResults() | 300 results = base_test_result.TestRunResults() |
| 287 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 301 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
| 288 retry = None | 302 retry = None |
| 289 if not results.DidRunPass(): | 303 if not results.DidRunPass(): |
| 290 retry = test_name | 304 retry = test_name |
| 291 return results, retry | 305 return results, retry |
| OLD | NEW |