| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Generates test runner factory and tests for instrumentation tests.""" | 5 """Generates test runner factory and tests for instrumentation tests.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 from pylib import constants | 10 from pylib import constants |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (test_options.coverage_dir and not | 75 if (test_options.coverage_dir and not |
| 76 os.path.exists(test_options.coverage_dir)): | 76 os.path.exists(test_options.coverage_dir)): |
| 77 os.makedirs(test_options.coverage_dir) | 77 os.makedirs(test_options.coverage_dir) |
| 78 | 78 |
| 79 test_pkg = test_package.TestPackage(test_options.test_apk_path, | 79 test_pkg = test_package.TestPackage(test_options.test_apk_path, |
| 80 test_options.test_apk_jar_path, | 80 test_options.test_apk_jar_path, |
| 81 test_options.test_support_apk_path) | 81 test_options.test_support_apk_path) |
| 82 tests = test_pkg.GetAllMatchingTests( | 82 tests = test_pkg.GetAllMatchingTests( |
| 83 test_options.annotations, | 83 test_options.annotations, |
| 84 test_options.exclude_annotations, | 84 test_options.exclude_annotations, |
| 85 test_options.test_filter, | 85 test_options.test_filter) |
| 86 devices) | |
| 87 if not tests: | 86 if not tests: |
| 88 logging.error('No instrumentation tests to run with current args.') | 87 logging.error('No instrumentation tests to run with current args.') |
| 89 | 88 |
| 90 if test_options.test_data: | 89 if test_options.test_data: |
| 91 device_utils.DeviceUtils.parallel(devices).pMap( | 90 device_utils.DeviceUtils.parallel(devices).pMap( |
| 92 _PushDataDeps, test_options) | 91 _PushDataDeps, test_options) |
| 93 | 92 |
| 94 if test_options.isolate_file_path: | 93 if test_options.isolate_file_path: |
| 95 i = base_setup.GenerateDepsDirUsingIsolate(test_options.test_apk, | 94 i = base_setup.GenerateDepsDirUsingIsolate(test_options.test_apk, |
| 96 test_options.isolate_file_path, | 95 test_options.isolate_file_path, |
| 97 ISOLATE_FILE_PATHS, | 96 ISOLATE_FILE_PATHS, |
| 98 DEPS_EXCLUSION_LIST) | 97 DEPS_EXCLUSION_LIST) |
| 99 def push_data_deps_to_device_dir(device): | 98 def push_data_deps_to_device_dir(device): |
| 100 base_setup.PushDataDeps(device, device.GetExternalStoragePath(), | 99 base_setup.PushDataDeps(device, device.GetExternalStoragePath(), |
| 101 test_options) | 100 test_options) |
| 102 device_utils.DeviceUtils.parallel(devices).pMap( | 101 device_utils.DeviceUtils.parallel(devices).pMap( |
| 103 push_data_deps_to_device_dir) | 102 push_data_deps_to_device_dir) |
| 104 if i: | 103 if i: |
| 105 i.Clear() | 104 i.Clear() |
| 106 | 105 |
| 107 device_utils.DeviceUtils.parallel(devices).pMap( | 106 device_utils.DeviceUtils.parallel(devices).pMap( |
| 108 _PushExtraSuiteDataDeps, test_options.test_apk) | 107 _PushExtraSuiteDataDeps, test_options.test_apk) |
| 109 | 108 |
| 110 def TestRunnerFactory(device, shard_index): | 109 def TestRunnerFactory(device, shard_index): |
| 111 return test_runner.TestRunner(test_options, device, shard_index, | 110 return test_runner.TestRunner(test_options, device, shard_index, |
| 112 test_pkg) | 111 test_pkg) |
| 113 | 112 |
| 114 return (TestRunnerFactory, tests) | 113 return (TestRunnerFactory, tests) |
| OLD | NEW |