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) |
86 if not tests: | 87 if not tests: |
87 logging.error('No instrumentation tests to run with current args.') | 88 logging.error('No instrumentation tests to run with current args.') |
88 | 89 |
89 if test_options.test_data: | 90 if test_options.test_data: |
90 device_utils.DeviceUtils.parallel(devices).pMap( | 91 device_utils.DeviceUtils.parallel(devices).pMap( |
91 _PushDataDeps, test_options) | 92 _PushDataDeps, test_options) |
92 | 93 |
93 if test_options.isolate_file_path: | 94 if test_options.isolate_file_path: |
94 i = base_setup.GenerateDepsDirUsingIsolate(test_options.test_apk, | 95 i = base_setup.GenerateDepsDirUsingIsolate(test_options.test_apk, |
95 test_options.isolate_file_path, | 96 test_options.isolate_file_path, |
96 ISOLATE_FILE_PATHS, | 97 ISOLATE_FILE_PATHS, |
97 DEPS_EXCLUSION_LIST) | 98 DEPS_EXCLUSION_LIST) |
98 def push_data_deps_to_device_dir(device): | 99 def push_data_deps_to_device_dir(device): |
99 base_setup.PushDataDeps(device, device.GetExternalStoragePath(), | 100 base_setup.PushDataDeps(device, device.GetExternalStoragePath(), |
100 test_options) | 101 test_options) |
101 device_utils.DeviceUtils.parallel(devices).pMap( | 102 device_utils.DeviceUtils.parallel(devices).pMap( |
102 push_data_deps_to_device_dir) | 103 push_data_deps_to_device_dir) |
103 if i: | 104 if i: |
104 i.Clear() | 105 i.Clear() |
105 | 106 |
106 device_utils.DeviceUtils.parallel(devices).pMap( | 107 device_utils.DeviceUtils.parallel(devices).pMap( |
107 _PushExtraSuiteDataDeps, test_options.test_apk) | 108 _PushExtraSuiteDataDeps, test_options.test_apk) |
108 | 109 |
109 def TestRunnerFactory(device, shard_index): | 110 def TestRunnerFactory(device, shard_index): |
110 return test_runner.TestRunner(test_options, device, shard_index, | 111 return test_runner.TestRunner(test_options, device, shard_index, |
111 test_pkg) | 112 test_pkg) |
112 | 113 |
113 return (TestRunnerFactory, tests) | 114 return (TestRunnerFactory, tests) |
OLD | NEW |