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 re | 10 import re |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 def _AmInstrumentTestSetup(self, app_path, test_path, runner_package, | 224 def _AmInstrumentTestSetup(self, app_path, test_path, runner_package, |
225 environment_variables, extra_apks=None): | 225 environment_variables, extra_apks=None): |
226 config = {'runner': runner_package} | 226 config = {'runner': runner_package} |
227 if environment_variables: | 227 if environment_variables: |
228 config['environment_vars'] = ','.join( | 228 config['environment_vars'] = ','.join( |
229 '%s=%s' % (k, v) for k, v in environment_variables.iteritems()) | 229 '%s=%s' % (k, v) for k, v in environment_variables.iteritems()) |
230 | 230 |
231 self._app_id = self._UploadAppToDevice(app_path) | 231 self._app_id = self._UploadAppToDevice(app_path) |
232 | 232 |
233 # TODO(agrieve): If AMP is ever ressurected, this needs to be changed to put | |
234 # test files under /sdcard/gtestdata. http://crbug.com/607169 | |
235 data_deps = self._test_instance.GetDataDependencies() | 233 data_deps = self._test_instance.GetDataDependencies() |
236 if data_deps: | 234 if data_deps: |
237 with tempfile.NamedTemporaryFile(suffix='.zip') as test_with_deps: | 235 with tempfile.NamedTemporaryFile(suffix='.zip') as test_with_deps: |
238 sdcard_files = [] | 236 sdcard_files = [] |
239 additional_apks = [] | 237 additional_apks = [] |
240 host_test = os.path.basename(test_path) | 238 host_test = os.path.basename(test_path) |
241 with zipfile.ZipFile(test_with_deps.name, 'w') as zip_file: | 239 with zipfile.ZipFile(test_with_deps.name, 'w') as zip_file: |
242 zip_file.write(test_path, host_test, zipfile.ZIP_DEFLATED) | 240 zip_file.write(test_path, host_test, zipfile.ZIP_DEFLATED) |
243 for h, _ in data_deps: | 241 for h, _ in data_deps: |
244 if os.path.isdir(h): | 242 if os.path.isdir(h): |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 self._LogLogcat() | 381 self._LogLogcat() |
384 self._LogAdbTraceLog() | 382 self._LogAdbTraceLog() |
385 raise remote_device_helper.RemoteDeviceError( | 383 raise remote_device_helper.RemoteDeviceError( |
386 'Remote service unable to reach device.', is_infra_error=True) | 384 'Remote service unable to reach device.', is_infra_error=True) |
387 else: | 385 else: |
388 # Remote service is reporting a failure, but no failure in results obj. | 386 # Remote service is reporting a failure, but no failure in results obj. |
389 if results.DidRunPass(): | 387 if results.DidRunPass(): |
390 results.AddResult(base_test_result.BaseTestResult( | 388 results.AddResult(base_test_result.BaseTestResult( |
391 'Remote service detected error.', | 389 'Remote service detected error.', |
392 base_test_result.ResultType.UNKNOWN)) | 390 base_test_result.ResultType.UNKNOWN)) |
OLD | NEW |