| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 'No test found with name %s' % (test_name)) | 163 'No test found with name %s' % (test_name)) |
| 164 | 164 |
| 165 def _DownloadTestResults(self, results_path): | 165 def _DownloadTestResults(self, results_path): |
| 166 """Download the test results from remote device service. | 166 """Download the test results from remote device service. |
| 167 | 167 |
| 168 Args: | 168 Args: |
| 169 results_path: path to download results to. | 169 results_path: path to download results to. |
| 170 """ | 170 """ |
| 171 if results_path: | 171 if results_path: |
| 172 logging.info('Downloading results to %s.' % results_path) | 172 logging.info('Downloading results to %s.' % results_path) |
| 173 if not os.path.exists(os.path.basename(results_path)): | 173 if not os.path.exists(os.path.dirname(results_path)): |
| 174 os.makedirs(os.path.basename(results_path)) | 174 os.makedirs(os.path.dirname(results_path)) |
| 175 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, | 175 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, |
| 176 logging.WARNING): | 176 logging.WARNING): |
| 177 appurify_sanitized.utils.wget(self._results['results']['url'], | 177 appurify_sanitized.utils.wget(self._results['results']['url'], |
| 178 results_path) | 178 results_path) |
| 179 | 179 |
| 180 def _GetTestStatus(self, test_run_id): | 180 def _GetTestStatus(self, test_run_id): |
| 181 """Checks the state of the test, and sets self._results | 181 """Checks the state of the test, and sets self._results |
| 182 | 182 |
| 183 Args: | 183 Args: |
| 184 test_run_id: Id of test on on remote service. | 184 test_run_id: Id of test on on remote service. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) | 270 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) |
| 271 config.write(''.join('%s\n' % l for l in config_data)) | 271 config.write(''.join('%s\n' % l for l in config_data)) |
| 272 config.flush() | 272 config.flush() |
| 273 config.seek(0) | 273 config.seek(0) |
| 274 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, | 274 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, |
| 275 logging.WARNING): | 275 logging.WARNING): |
| 276 config_response = appurify_sanitized.api.config_upload( | 276 config_response = appurify_sanitized.api.config_upload( |
| 277 self._env.token, config, self._test_id) | 277 self._env.token, config, self._test_id) |
| 278 remote_device_helper.TestHttpResponse( | 278 remote_device_helper.TestHttpResponse( |
| 279 config_response, 'Unable to upload test config.') | 279 config_response, 'Unable to upload test config.') |
| OLD | NEW |