OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Runs all types of tests from one unified interface. | 7 """Runs all types of tests from one unified interface. |
8 | 8 |
9 TODO(gkanwar): | 9 TODO(gkanwar): |
10 * Add options to run Monkey tests. | 10 * Add options to run Monkey tests. |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger', | 274 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger', |
275 action='store_true', | 275 action='store_true', |
276 help='Wait for debugger.') | 276 help='Wait for debugger.') |
277 option_parser.add_option('-I', dest='install_apk', action='store_true', | 277 option_parser.add_option('-I', dest='install_apk', action='store_true', |
278 help='Install test APK.') | 278 help='Install test APK.') |
279 option_parser.add_option( | 279 option_parser.add_option( |
280 '--test-apk', dest='test_apk', | 280 '--test-apk', dest='test_apk', |
281 help=('The name of the apk containing the tests ' | 281 help=('The name of the apk containing the tests ' |
282 '(without the .apk extension; e.g. "ContentShellTest"). ' | 282 '(without the .apk extension; e.g. "ContentShellTest"). ' |
283 'Alternatively, this can be a full path to the apk.')) | 283 'Alternatively, this can be a full path to the apk.')) |
284 option_parser.add_option('--coverage_dir', default=None, | |
frankf
2013/07/25 20:28:19
No need for default=None
gkanwar1
2013/08/01 02:14:35
Done.
| |
285 help=('Directory in which to place all generated ' | |
286 'EMMA coverage files.')) | |
284 | 287 |
285 | 288 |
286 def ProcessInstrumentationOptions(options, error_func): | 289 def ProcessInstrumentationOptions(options, error_func): |
287 """Processes options/arguments and populate |options| with defaults.""" | 290 """Processes options/arguments and populate |options| with defaults.""" |
288 | 291 |
289 ProcessJavaTestOptions(options, error_func) | 292 ProcessJavaTestOptions(options, error_func) |
290 | 293 |
291 if not options.test_apk: | 294 if not options.test_apk: |
292 error_func('--test-apk must be specified.') | 295 error_func('--test-apk must be specified.') |
293 | 296 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 results = base_test_result.TestRunResults() | 427 results = base_test_result.TestRunResults() |
425 exit_code = 0 | 428 exit_code = 0 |
426 | 429 |
427 if options.run_java_tests: | 430 if options.run_java_tests: |
428 runner_factory, tests = instrumentation_setup.Setup( | 431 runner_factory, tests = instrumentation_setup.Setup( |
429 options.test_apk_path, options.test_apk_jar_path, options.annotations, | 432 options.test_apk_path, options.test_apk_jar_path, options.annotations, |
430 options.exclude_annotations, options.test_filter, options.build_type, | 433 options.exclude_annotations, options.test_filter, options.build_type, |
431 options.test_data, options.install_apk, options.save_perf_json, | 434 options.test_data, options.install_apk, options.save_perf_json, |
432 options.screenshot_failures, options.tool, options.wait_for_debugger, | 435 options.screenshot_failures, options.tool, options.wait_for_debugger, |
433 options.disable_assertions, options.push_deps, | 436 options.disable_assertions, options.push_deps, |
434 options.cleanup_test_files) | 437 options.cleanup_test_files, options.coverage_dir) |
435 | 438 |
436 test_results, exit_code = test_dispatcher.RunTests( | 439 test_results, exit_code = test_dispatcher.RunTests( |
437 tests, runner_factory, options.wait_for_debugger, | 440 tests, runner_factory, options.wait_for_debugger, |
438 options.test_device, | 441 options.test_device, |
439 shard=True, | 442 shard=True, |
440 build_type=options.build_type, | 443 build_type=options.build_type, |
441 test_timeout=None, | 444 test_timeout=None, |
442 num_retries=options.num_retries) | 445 num_retries=options.num_retries) |
443 | 446 |
444 results.AddTestRunResults(test_results) | 447 results.AddTestRunResults(test_results) |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
644 return 0 | 647 return 0 |
645 command = argv[1] | 648 command = argv[1] |
646 VALID_COMMANDS[command].add_options_func(option_parser) | 649 VALID_COMMANDS[command].add_options_func(option_parser) |
647 options, args = option_parser.parse_args(argv) | 650 options, args = option_parser.parse_args(argv) |
648 return VALID_COMMANDS[command].run_command_func( | 651 return VALID_COMMANDS[command].run_command_func( |
649 command, options, args, option_parser) | 652 command, options, args, option_parser) |
650 | 653 |
651 | 654 |
652 if __name__ == '__main__': | 655 if __name__ == '__main__': |
653 sys.exit(main(sys.argv)) | 656 sys.exit(main(sys.argv)) |
OLD | NEW |