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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 Returns: | 251 Returns: |
252 A tuple containing (Output, base_test_result.ResultType) | 252 A tuple containing (Output, base_test_result.ResultType) |
253 """ | 253 """ |
254 if not self._CheckDeviceAffinity(test_name): | 254 if not self._CheckDeviceAffinity(test_name): |
255 return '', base_test_result.ResultType.PASS | 255 return '', base_test_result.ResultType.PASS |
256 | 256 |
257 try: | 257 try: |
258 logging.warning('Unmapping device ports') | 258 logging.warning('Unmapping device ports') |
259 forwarder.Forwarder.UnmapAllDevicePorts(self.device) | 259 forwarder.Forwarder.UnmapAllDevicePorts(self.device) |
260 self.device.RestartAdbd() | 260 self.device.RestartAdbd() |
261 except Exception as e: | 261 except Exception as e: # pylint: disable=broad-except |
262 logging.error('Exception when tearing down device %s', e) | 262 logging.error('Exception when tearing down device %s', e) |
263 | 263 |
264 cmd = ('%s --device %s' % | 264 cmd = ('%s --device %s' % |
265 (self._tests['steps'][test_name]['cmd'], | 265 (self._tests['steps'][test_name]['cmd'], |
266 self.device_serial)) | 266 self.device_serial)) |
267 | 267 |
268 if self._options.collect_chartjson_data: | 268 if self._options.collect_chartjson_data: |
269 self._output_dir = tempfile.mkdtemp() | 269 self._output_dir = tempfile.mkdtemp() |
270 cmd = cmd + ' --output-dir=%s' % self._output_dir | 270 cmd = cmd + ' --output-dir=%s' % self._output_dir |
271 | 271 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 if exit_code == 0: | 323 if exit_code == 0: |
324 result_type = base_test_result.ResultType.PASS | 324 result_type = base_test_result.ResultType.PASS |
325 else: | 325 else: |
326 result_type = base_test_result.ResultType.FAIL | 326 result_type = base_test_result.ResultType.FAIL |
327 # Since perf tests use device affinity, give the device a chance to | 327 # Since perf tests use device affinity, give the device a chance to |
328 # recover if it is offline after a failure. Otherwise, the master sharder | 328 # recover if it is offline after a failure. Otherwise, the master sharder |
329 # will remove it from the pool and future tests on this device will fail. | 329 # will remove it from the pool and future tests on this device will fail. |
330 try: | 330 try: |
331 self.device.WaitUntilFullyBooted(timeout=120) | 331 self.device.WaitUntilFullyBooted(timeout=120) |
332 except device_errors.CommandTimeoutError as e: | 332 except device_errors.CommandTimeoutError as e: |
333 logging.error('Device failed to return after %s: %s' % (test_name, e)) | 333 logging.error('Device failed to return after %s: %s', test_name, e) |
334 | 334 |
335 actual_exit_code = exit_code | 335 actual_exit_code = exit_code |
336 if test_name in self._flaky_tests: | 336 if test_name in self._flaky_tests: |
337 # The exit_code is used at the second stage when printing the | 337 # The exit_code is used at the second stage when printing the |
338 # test output. If the test is flaky, force to "0" to get that step green | 338 # test output. If the test is flaky, force to "0" to get that step green |
339 # whilst still gathering data to the perf dashboards. | 339 # whilst still gathering data to the perf dashboards. |
340 # The result_type is used by the test_dispatcher to retry the test. | 340 # The result_type is used by the test_dispatcher to retry the test. |
341 exit_code = 0 | 341 exit_code = 0 |
342 | 342 |
343 persisted_result = { | 343 persisted_result = { |
(...skipping 22 matching lines...) Expand all Loading... |
366 Returns: | 366 Returns: |
367 A tuple of (TestRunResults, retry). | 367 A tuple of (TestRunResults, retry). |
368 """ | 368 """ |
369 _, result_type = self._LaunchPerfTest(test_name) | 369 _, result_type = self._LaunchPerfTest(test_name) |
370 results = base_test_result.TestRunResults() | 370 results = base_test_result.TestRunResults() |
371 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 371 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
372 retry = None | 372 retry = None |
373 if not results.DidRunPass(): | 373 if not results.DidRunPass(): |
374 retry = test_name | 374 retry = test_name |
375 return results, retry | 375 return results, retry |
OLD | NEW |