OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import collections | 6 import collections |
7 import glob | 7 import glob |
8 import multiprocessing | 8 import multiprocessing |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 """ | 149 """ |
150 if print_step: | 150 if print_step: |
151 bb_annotations.PrintNamedStep('install_%s' % test.name.lower()) | 151 bb_annotations.PrintNamedStep('install_%s' % test.name.lower()) |
152 args = ['--apk', test.apk, '--apk_package', test.apk_package] | 152 args = ['--apk', test.apk, '--apk_package', test.apk_package] |
153 if options.target == 'Release': | 153 if options.target == 'Release': |
154 args.append('--release') | 154 args.append('--release') |
155 | 155 |
156 RunCmd(['build/android/adb_install_apk.py'] + args, halt_on_failure=True) | 156 RunCmd(['build/android/adb_install_apk.py'] + args, halt_on_failure=True) |
157 | 157 |
158 | 158 |
159 def RunInstrumentationSuite(options, test, flunk_on_failure=True): | 159 def RunInstrumentationSuite(options, test, flunk_on_failure=True, |
| 160 python_only=False): |
160 """Manages an invocation of test_runner.py for instrumentation tests. | 161 """Manages an invocation of test_runner.py for instrumentation tests. |
161 | 162 |
162 Args: | 163 Args: |
163 options: options object | 164 options: options object |
164 test: An I_TEST namedtuple | 165 test: An I_TEST namedtuple |
| 166 flunk_on_failure: Flunk the step if tests fail. |
| 167 Python: Run only host driven Python tests. |
165 """ | 168 """ |
166 bb_annotations.PrintNamedStep('%s_instrumentation_tests' % test.name.lower()) | 169 bb_annotations.PrintNamedStep('%s_instrumentation_tests' % test.name.lower()) |
167 | 170 |
168 InstallApk(options, test) | 171 InstallApk(options, test) |
169 args = ['--test-apk', test.test_apk, '--test_data', test.test_data, | 172 args = ['--test-apk', test.test_apk, '--test_data', test.test_data, |
170 '--verbose', '-I'] | 173 '--verbose', '-I'] |
171 if options.target == 'Release': | 174 if options.target == 'Release': |
172 args.append('--release') | 175 args.append('--release') |
173 if options.asan: | 176 if options.asan: |
174 args.append('--tool=asan') | 177 args.append('--tool=asan') |
175 if options.upload_to_flakiness_server: | 178 if options.upload_to_flakiness_server: |
176 args.append('--flakiness-dashboard-server=%s' % | 179 args.append('--flakiness-dashboard-server=%s' % |
177 constants.UPSTREAM_FLAKINESS_SERVER) | 180 constants.UPSTREAM_FLAKINESS_SERVER) |
178 if test.host_driven_root: | 181 if test.host_driven_root: |
179 args.append('--python_test_root=%s' % test.host_driven_root) | 182 args.append('--python_test_root=%s' % test.host_driven_root) |
180 if test.annotation: | 183 if test.annotation: |
181 args.extend(['-A', test.annotation]) | 184 args.extend(['-A', test.annotation]) |
182 if test.exclude_annotation: | 185 if test.exclude_annotation: |
183 args.extend(['-E', test.exclude_annotation]) | 186 args.extend(['-E', test.exclude_annotation]) |
184 if test.extra_flags: | 187 if test.extra_flags: |
185 args.extend(test.extra_flags) | 188 args.extend(test.extra_flags) |
| 189 if python_only: |
| 190 args.append('-p') |
186 | 191 |
187 RunCmd(['build/android/test_runner.py', 'instrumentation'] + args, | 192 RunCmd(['build/android/test_runner.py', 'instrumentation'] + args, |
188 flunk_on_failure=flunk_on_failure) | 193 flunk_on_failure=flunk_on_failure) |
189 | 194 |
190 | 195 |
191 def RunWebkitLint(target): | 196 def RunWebkitLint(target): |
192 """Lint WebKit's TestExpectation files.""" | 197 """Lint WebKit's TestExpectation files.""" |
193 bb_annotations.PrintNamedStep('webkit_lint') | 198 bb_annotations.PrintNamedStep('webkit_lint') |
194 RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py', | 199 RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py', |
195 '--lint-test-files', | 200 '--lint-test-files', |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return sys.exit('Unknown tests %s' % list(unknown_tests)) | 388 return sys.exit('Unknown tests %s' % list(unknown_tests)) |
384 | 389 |
385 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 390 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
386 | 391 |
387 MainTestWrapper(options) | 392 MainTestWrapper(options) |
388 provision_devices.KillHostHeartbeat() | 393 provision_devices.KillHostHeartbeat() |
389 | 394 |
390 | 395 |
391 if __name__ == '__main__': | 396 if __name__ == '__main__': |
392 sys.exit(main(sys.argv)) | 397 sys.exit(main(sys.argv)) |
OLD | NEW |