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 a perf test on a single device. | 5 """Runs a perf test on a single device. |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 Returns: | 65 Returns: |
66 exit code generated by the test step. | 66 exit code generated by the test step. |
67 """ | 67 """ |
68 file_name = os.path.join(_OUTPUT_DIR, test_name) | 68 file_name = os.path.join(_OUTPUT_DIR, test_name) |
69 if not os.path.exists(file_name): | 69 if not os.path.exists(file_name): |
70 logging.error('File not found %s', file_name) | 70 logging.error('File not found %s', file_name) |
71 return 1 | 71 return 1 |
72 | 72 |
73 with file(file_name, 'r') as f: | 73 with file(file_name, 'r') as f: |
74 persisted_result = pickle.loads(f.read()) | 74 persisted_result = pickle.loads(f.read()) |
| 75 logging.info('*' * 80) |
| 76 logging.info('Output from:') |
| 77 logging.info(persisted_result['cmd']) |
| 78 logging.info('*' * 80) |
75 print persisted_result['output'] | 79 print persisted_result['output'] |
76 | 80 |
77 return persisted_result['exit_code'] | 81 return persisted_result['exit_code'] |
78 | 82 |
79 | 83 |
80 class TestRunner(base_test_runner.BaseTestRunner): | 84 class TestRunner(base_test_runner.BaseTestRunner): |
81 def __init__(self, test_options, device, tests, flaky_tests): | 85 def __init__(self, test_options, device, tests, flaky_tests): |
82 """A TestRunner instance runs a perf test on a single device. | 86 """A TestRunner instance runs a perf test on a single device. |
83 | 87 |
84 Args: | 88 Args: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 exit_code = 0 | 129 exit_code = 0 |
126 result_type = base_test_result.ResultType.PASS | 130 result_type = base_test_result.ResultType.PASS |
127 | 131 |
128 persisted_result = { | 132 persisted_result = { |
129 'name': test_name, | 133 'name': test_name, |
130 'output': output, | 134 'output': output, |
131 'exit_code': exit_code, | 135 'exit_code': exit_code, |
132 'result_type': result_type, | 136 'result_type': result_type, |
133 'total_time': (end_time - start_time).seconds, | 137 'total_time': (end_time - start_time).seconds, |
134 'device': self.device, | 138 'device': self.device, |
| 139 'cmd': cmd, |
135 } | 140 } |
136 self._SaveResult(persisted_result) | 141 self._SaveResult(persisted_result) |
137 | 142 |
138 return (output, result_type) | 143 return (output, result_type) |
139 | 144 |
140 def RunTest(self, test_name): | 145 def RunTest(self, test_name): |
141 """Run a perf test on the device. | 146 """Run a perf test on the device. |
142 | 147 |
143 Args: | 148 Args: |
144 test_name: String to use for logging the test result. | 149 test_name: String to use for logging the test result. |
145 | 150 |
146 Returns: | 151 Returns: |
147 A tuple of (TestRunResults, retry). | 152 A tuple of (TestRunResults, retry). |
148 """ | 153 """ |
149 output, result_type = self._LaunchPerfTest(test_name) | 154 output, result_type = self._LaunchPerfTest(test_name) |
150 results = base_test_result.TestRunResults() | 155 results = base_test_result.TestRunResults() |
151 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 156 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
152 retry = None | 157 retry = None |
153 if not results.DidRunPass(): | 158 if not results.DidRunPass(): |
154 retry = test_name | 159 retry = test_name |
155 return results, retry | 160 return results, retry |
OLD | NEW |