| 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 device_recovery.RecoverDevice(self._device, self._env.blacklist) | 255 # TODO(rnephew): Possible problem when restarting on N7 devices. |
| 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.') |
| 256 except device_errors.CommandTimeoutError: | 261 except device_errors.CommandTimeoutError: |
| 257 logging.exception( | 262 logging.exception( |
| 258 'Device failed to recover after failing %s.', test) | 263 'Device failed to recover after failing %s.', test) |
| 259 tries_left -= 1 | 264 tries_left -= 1 |
| 260 | 265 |
| 261 results.AddResult(base_test_result.BaseTestResult(test, result_type)) | 266 results.AddResult(base_test_result.BaseTestResult(test, result_type)) |
| 262 return results | 267 return results |
| 263 | 268 |
| 264 def _LogTestExit(self, test, exit_code, duration): | 269 def _LogTestExit(self, test, exit_code, duration): |
| 265 logging.info('%s : exit_code=%d in %d secs on device %s', | 270 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... |
| 536 # override | 541 # override |
| 537 def _RunTest(self, _device, _test): | 542 def _RunTest(self, _device, _test): |
| 538 raise NotImplementedError | 543 raise NotImplementedError |
| 539 | 544 |
| 540 | 545 |
| 541 class TestDictVersionError(Exception): | 546 class TestDictVersionError(Exception): |
| 542 pass | 547 pass |
| 543 | 548 |
| 544 class PerfTestRunGetStepsError(Exception): | 549 class PerfTestRunGetStepsError(Exception): |
| 545 pass | 550 pass |
| OLD | NEW |