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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 """A TestRunner instance runs a perf test on a single device. | 163 """A TestRunner instance runs a perf test on a single device. |
164 | 164 |
165 Args: | 165 Args: |
166 test_options: A PerfOptions object. | 166 test_options: A PerfOptions object. |
167 device: Device to run the tests. | 167 device: Device to run the tests. |
168 shard_index: the index of this device. | 168 shard_index: the index of this device. |
169 max_shards: the maximum shard index. | 169 max_shards: the maximum shard index. |
170 tests: a dict mapping test_name to command. | 170 tests: a dict mapping test_name to command. |
171 flaky_tests: a list of flaky test_name. | 171 flaky_tests: a list of flaky test_name. |
172 """ | 172 """ |
173 super(TestRunner, self).__init__(device, None) | 173 super(TestRunner, self).__init__(device, None, 'Release') |
174 self._options = test_options | 174 self._options = test_options |
175 self._shard_index = shard_index | 175 self._shard_index = shard_index |
176 self._max_shard = max_shard | 176 self._max_shard = max_shard |
177 self._tests = tests | 177 self._tests = tests |
178 self._flaky_tests = flaky_tests | 178 self._flaky_tests = flaky_tests |
179 self._output_dir = None | 179 self._output_dir = None |
180 | 180 |
181 @staticmethod | 181 @staticmethod |
182 def _IsBetter(result): | 182 def _IsBetter(result): |
183 if result['actual_exit_code'] == 0: | 183 if result['actual_exit_code'] == 0: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 Returns: | 229 Returns: |
230 A tuple containing (Output, base_test_result.ResultType) | 230 A tuple containing (Output, base_test_result.ResultType) |
231 """ | 231 """ |
232 if not self._CheckDeviceAffinity(test_name): | 232 if not self._CheckDeviceAffinity(test_name): |
233 return '', base_test_result.ResultType.PASS | 233 return '', base_test_result.ResultType.PASS |
234 | 234 |
235 try: | 235 try: |
236 logging.warning('Unmapping device ports') | 236 logging.warning('Unmapping device ports') |
237 forwarder.Forwarder.UnmapAllDevicePorts(self.device) | 237 forwarder.Forwarder.UnmapAllDevicePorts(self.device) |
238 self.device.RestartAdbd() | 238 self.device.old_interface.RestartAdbdOnDevice() |
239 except Exception as e: | 239 except Exception as e: |
240 logging.error('Exception when tearing down device %s', e) | 240 logging.error('Exception when tearing down device %s', e) |
241 | 241 |
242 cmd = ('%s --device %s' % | 242 cmd = ('%s --device %s' % |
243 (self._tests['steps'][test_name]['cmd'], | 243 (self._tests['steps'][test_name]['cmd'], |
244 self.device_serial)) | 244 self.device_serial)) |
245 | 245 |
246 if self._options.collect_chartjson_data: | 246 if self._options.collect_chartjson_data: |
247 self._output_dir = tempfile.mkdtemp() | 247 self._output_dir = tempfile.mkdtemp() |
248 cmd = cmd + ' --output-dir=%s' % self._output_dir | 248 cmd = cmd + ' --output-dir=%s' % self._output_dir |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 Returns: | 329 Returns: |
330 A tuple of (TestRunResults, retry). | 330 A tuple of (TestRunResults, retry). |
331 """ | 331 """ |
332 _, result_type = self._LaunchPerfTest(test_name) | 332 _, result_type = self._LaunchPerfTest(test_name) |
333 results = base_test_result.TestRunResults() | 333 results = base_test_result.TestRunResults() |
334 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 334 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
335 retry = None | 335 retry = None |
336 if not results.DidRunPass(): | 336 if not results.DidRunPass(): |
337 retry = test_name | 337 retry = test_name |
338 return results, retry | 338 return results, retry |
OLD | NEW |