| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if not options.keep_test_server_ports: | 258 if not options.keep_test_server_ports: |
| 259 if not ports.ResetTestServerPortAllocation(): | 259 if not ports.ResetTestServerPortAllocation(): |
| 260 raise Exception('Failed to reset test server port.') | 260 raise Exception('Failed to reset test server port.') |
| 261 | 261 |
| 262 | 262 |
| 263 def AddInstrumentationTestOptions(option_parser): | 263 def AddInstrumentationTestOptions(option_parser): |
| 264 """Adds Instrumentation test options to |option_parser|.""" | 264 """Adds Instrumentation test options to |option_parser|.""" |
| 265 | 265 |
| 266 option_parser.usage = '%prog instrumentation [options]' | 266 option_parser.usage = '%prog instrumentation [options]' |
| 267 option_parser.command_list = [] | 267 option_parser.command_list = [] |
| 268 option_parser.example = ('%prog instrumentation -I ' | 268 option_parser.example = ('%prog instrumentation ' |
| 269 '--test-apk=ChromiumTestShellTest') | 269 '--test-apk=ChromiumTestShellTest') |
| 270 | 270 |
| 271 AddJavaTestOptions(option_parser) | 271 AddJavaTestOptions(option_parser) |
| 272 AddCommonOptions(option_parser) | 272 AddCommonOptions(option_parser) |
| 273 | 273 |
| 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 #TODO(craigdh): Remove option once -I is no longer passed downstream. |
| 277 option_parser.add_option('-I', dest='install_apk', action='store_true', | 278 option_parser.add_option('-I', dest='install_apk', action='store_true', |
| 278 help='Install test APK.') | 279 help='(DEPRECATED) Install the test apk.') |
| 279 option_parser.add_option( | 280 option_parser.add_option( |
| 280 '--test-apk', dest='test_apk', | 281 '--test-apk', dest='test_apk', |
| 281 help=('The name of the apk containing the tests ' | 282 help=('The name of the apk containing the tests ' |
| 282 '(without the .apk extension; e.g. "ContentShellTest"). ' | 283 '(without the .apk extension; e.g. "ContentShellTest"). ' |
| 283 'Alternatively, this can be a full path to the apk.')) | 284 'Alternatively, this can be a full path to the apk.')) |
| 284 | 285 |
| 285 | 286 |
| 286 def ProcessInstrumentationOptions(options, error_func): | 287 def ProcessInstrumentationOptions(options, error_func): |
| 287 """Processes options/arguments and populate |options| with defaults.""" | 288 """Processes options/arguments and populate |options| with defaults.""" |
| 288 | 289 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 """Subcommand of RunTestsCommands which runs instrumentation tests.""" | 422 """Subcommand of RunTestsCommands which runs instrumentation tests.""" |
| 422 ProcessInstrumentationOptions(options, error_func) | 423 ProcessInstrumentationOptions(options, error_func) |
| 423 | 424 |
| 424 results = base_test_result.TestRunResults() | 425 results = base_test_result.TestRunResults() |
| 425 exit_code = 0 | 426 exit_code = 0 |
| 426 | 427 |
| 427 if options.run_java_tests: | 428 if options.run_java_tests: |
| 428 runner_factory, tests = instrumentation_setup.Setup( | 429 runner_factory, tests = instrumentation_setup.Setup( |
| 429 options.test_apk_path, options.test_apk_jar_path, options.annotations, | 430 options.test_apk_path, options.test_apk_jar_path, options.annotations, |
| 430 options.exclude_annotations, options.test_filter, options.build_type, | 431 options.exclude_annotations, options.test_filter, options.build_type, |
| 431 options.test_data, options.install_apk, options.save_perf_json, | 432 options.test_data, options.save_perf_json, options.screenshot_failures, |
| 432 options.screenshot_failures, options.tool, options.wait_for_debugger, | 433 options.tool, options.wait_for_debugger, options.disable_assertions, |
| 433 options.disable_assertions, options.push_deps, | 434 options.push_deps, options.cleanup_test_files) |
| 434 options.cleanup_test_files) | |
| 435 | 435 |
| 436 test_results, exit_code = test_dispatcher.RunTests( | 436 test_results, exit_code = test_dispatcher.RunTests( |
| 437 tests, runner_factory, options.wait_for_debugger, | 437 tests, runner_factory, options.wait_for_debugger, |
| 438 options.test_device, | 438 options.test_device, |
| 439 shard=True, | 439 shard=True, |
| 440 build_type=options.build_type, | 440 build_type=options.build_type, |
| 441 test_timeout=None, | 441 test_timeout=None, |
| 442 num_retries=options.num_retries) | 442 num_retries=options.num_retries) |
| 443 | 443 |
| 444 results.AddTestRunResults(test_results) | 444 results.AddTestRunResults(test_results) |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 return 0 | 644 return 0 |
| 645 command = argv[1] | 645 command = argv[1] |
| 646 VALID_COMMANDS[command].add_options_func(option_parser) | 646 VALID_COMMANDS[command].add_options_func(option_parser) |
| 647 options, args = option_parser.parse_args(argv) | 647 options, args = option_parser.parse_args(argv) |
| 648 return VALID_COMMANDS[command].run_command_func( | 648 return VALID_COMMANDS[command].run_command_func( |
| 649 command, options, args, option_parser) | 649 command, options, args, option_parser) |
| 650 | 650 |
| 651 | 651 |
| 652 if __name__ == '__main__': | 652 if __name__ == '__main__': |
| 653 sys.exit(main(sys.argv)) | 653 sys.exit(main(sys.argv)) |
| OLD | NEW |