| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import collections | 5 import collections |
| 6 import io | 6 import io |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import pickle | 10 import pickle |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 result_type = self._RunSingleTest(test) | 245 result_type = self._RunSingleTest(test) |
| 246 except device_errors.CommandTimeoutError: | 246 except device_errors.CommandTimeoutError: |
| 247 result_type = base_test_result.ResultType.TIMEOUT | 247 result_type = base_test_result.ResultType.TIMEOUT |
| 248 except device_errors.CommandFailedError: | 248 except device_errors.CommandFailedError: |
| 249 logging.exception('Exception when executing %s.', test) | 249 logging.exception('Exception when executing %s.', test) |
| 250 result_type = base_test_result.ResultType.FAIL | 250 result_type = base_test_result.ResultType.FAIL |
| 251 finally: | 251 finally: |
| 252 self._TestTearDown() | 252 self._TestTearDown() |
| 253 if result_type != base_test_result.ResultType.PASS: | 253 if result_type != base_test_result.ResultType.PASS: |
| 254 try: | 254 try: |
| 255 # TODO(rnephew): Possible problem when restarting on N7 devices. | 255 device_recovery.RecoverDevice(self._device, self._env.blacklist) |
| 256 # Determine if this is true. crbug.com/667470 | |
| 257 if 'Nexus 7' not in self._device.product_model: | |
| 258 device_recovery.RecoverDevice(self._device, self._env.blacklist) | |
| 259 else: | |
| 260 logging.critical('Not attempting device recovery.') | |
| 261 except device_errors.CommandTimeoutError: | 256 except device_errors.CommandTimeoutError: |
| 262 logging.exception( | 257 logging.exception( |
| 263 'Device failed to recover after failing %s.', test) | 258 'Device failed to recover after failing %s.', test) |
| 264 tries_left -= 1 | 259 tries_left -= 1 |
| 265 | 260 |
| 266 results.AddResult(base_test_result.BaseTestResult(test, result_type)) | 261 results.AddResult(base_test_result.BaseTestResult(test, result_type)) |
| 267 return results | 262 return results |
| 268 | 263 |
| 269 def _LogTestExit(self, test, exit_code, duration): | 264 def _LogTestExit(self, test, exit_code, duration): |
| 270 logging.info('%s : exit_code=%d in %d secs on device %s', | 265 logging.info('%s : exit_code=%d in %d secs on device %s', |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 # override | 536 # override |
| 542 def _RunTest(self, _device, _test): | 537 def _RunTest(self, _device, _test): |
| 543 raise NotImplementedError | 538 raise NotImplementedError |
| 544 | 539 |
| 545 | 540 |
| 546 class TestDictVersionError(Exception): | 541 class TestDictVersionError(Exception): |
| 547 pass | 542 pass |
| 548 | 543 |
| 549 class PerfTestRunGetStepsError(Exception): | 544 class PerfTestRunGetStepsError(Exception): |
| 550 pass | 545 pass |
| OLD | NEW |