| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Run specific test on specific environment.""" | 5 """Run specific test on specific environment.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 current_status, self._env.timeouts['unknown']) | 92 current_status, self._env.timeouts['unknown']) |
| 93 if timeout_counter > timeout: | 93 if timeout_counter > timeout: |
| 94 raise remote_device_helper.RemoteDeviceError( | 94 raise remote_device_helper.RemoteDeviceError( |
| 95 'Timeout while in %s state for %s seconds' | 95 'Timeout while in %s state for %s seconds' |
| 96 % (current_status, timeout), | 96 % (current_status, timeout), |
| 97 is_infra_error=True) | 97 is_infra_error=True) |
| 98 time.sleep(self.WAIT_TIME) | 98 time.sleep(self.WAIT_TIME) |
| 99 timeout_counter += self.WAIT_TIME | 99 timeout_counter += self.WAIT_TIME |
| 100 heartbeat_counter += self.WAIT_TIME | 100 heartbeat_counter += self.WAIT_TIME |
| 101 self._DownloadTestResults(self._env.results_path) | 101 self._DownloadTestResults(self._env.results_path) |
| 102 |
| 103 if self._results['results']['exception']: |
| 104 raise remote_device_helper.RemoteDeviceError( |
| 105 self._results['results']['exception'], is_infra_error=True) |
| 106 |
| 102 return self._ParseTestResults() | 107 return self._ParseTestResults() |
| 103 | 108 |
| 104 #override | 109 #override |
| 105 def TearDown(self): | 110 def TearDown(self): |
| 106 """Tear down the test run.""" | 111 """Tear down the test run.""" |
| 107 if self._env.collect: | 112 if self._env.collect: |
| 108 self._CollectTearDown() | 113 self._CollectTearDown() |
| 109 elif self._env.trigger: | 114 elif self._env.trigger: |
| 110 assert isinstance(self._env.trigger, basestring), ( | 115 assert isinstance(self._env.trigger, basestring), ( |
| 111 'File for storing test_run_id must be a string.') | 116 'File for storing test_run_id must be a string.') |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) | 276 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) |
| 272 config.write(''.join('%s\n' % l for l in config_data)) | 277 config.write(''.join('%s\n' % l for l in config_data)) |
| 273 config.flush() | 278 config.flush() |
| 274 config.seek(0) | 279 config.seek(0) |
| 275 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, | 280 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, |
| 276 logging.WARNING): | 281 logging.WARNING): |
| 277 config_response = appurify_sanitized.api.config_upload( | 282 config_response = appurify_sanitized.api.config_upload( |
| 278 self._env.token, config, self._test_id) | 283 self._env.token, config, self._test_id) |
| 279 remote_device_helper.TestHttpResponse( | 284 remote_device_helper.TestHttpResponse( |
| 280 config_response, 'Unable to upload test config.') | 285 config_response, 'Unable to upload test config.') |
| OLD | NEW |