| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 '--test-apk=ChromiumTestShellTest') | 207 '--test-apk=ChromiumTestShellTest') |
| 208 | 208 |
| 209 AddJavaTestOptions(option_parser) | 209 AddJavaTestOptions(option_parser) |
| 210 AddCommonOptions(option_parser) | 210 AddCommonOptions(option_parser) |
| 211 | 211 |
| 212 option_parser.add_option('-j', '--java_only', action='store_true', | 212 option_parser.add_option('-j', '--java_only', action='store_true', |
| 213 default=False, help='Run only the Java tests.') | 213 default=False, help='Run only the Java tests.') |
| 214 option_parser.add_option('-p', '--python_only', action='store_true', | 214 option_parser.add_option('-p', '--python_only', action='store_true', |
| 215 default=False, | 215 default=False, |
| 216 help='Run only the host-driven tests.') | 216 help='Run only the host-driven tests.') |
| 217 option_parser.add_option('--python_test_root', | 217 option_parser.add_option('--python_test_root', '--host-driven-root', |
| 218 dest='host_driven_root', |
| 218 help='Root of the host-driven tests.') | 219 help='Root of the host-driven tests.') |
| 219 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger', | 220 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger', |
| 220 action='store_true', | 221 action='store_true', |
| 221 help='Wait for debugger.') | 222 help='Wait for debugger.') |
| 222 option_parser.add_option( | 223 option_parser.add_option( |
| 223 '--test-apk', dest='test_apk', | 224 '--test-apk', dest='test_apk', |
| 224 help=('The name of the apk containing the tests ' | 225 help=('The name of the apk containing the tests ' |
| 225 '(without the .apk extension; e.g. "ContentShellTest"). ' | 226 '(without the .apk extension; e.g. "ContentShellTest"). ' |
| 226 'Alternatively, this can be a full path to the apk.')) | 227 'Alternatively, this can be a full path to the apk.')) |
| 227 | 228 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 243 if options.java_only and options.python_only: | 244 if options.java_only and options.python_only: |
| 244 error_func('Options java_only (-j) and python_only (-p) ' | 245 error_func('Options java_only (-j) and python_only (-p) ' |
| 245 'are mutually exclusive.') | 246 'are mutually exclusive.') |
| 246 options.run_java_tests = True | 247 options.run_java_tests = True |
| 247 options.run_python_tests = True | 248 options.run_python_tests = True |
| 248 if options.java_only: | 249 if options.java_only: |
| 249 options.run_python_tests = False | 250 options.run_python_tests = False |
| 250 elif options.python_only: | 251 elif options.python_only: |
| 251 options.run_java_tests = False | 252 options.run_java_tests = False |
| 252 | 253 |
| 253 if not options.python_test_root: | 254 if not options.host_driven_root: |
| 254 options.run_python_tests = False | 255 options.run_python_tests = False |
| 255 | 256 |
| 256 if not options.test_apk: | 257 if not options.test_apk: |
| 257 error_func('--test-apk must be specified.') | 258 error_func('--test-apk must be specified.') |
| 258 | 259 |
| 259 if os.path.exists(options.test_apk): | 260 if os.path.exists(options.test_apk): |
| 260 # The APK is fully qualified, assume the JAR lives along side. | 261 # The APK is fully qualified, assume the JAR lives along side. |
| 261 options.test_apk_path = options.test_apk | 262 options.test_apk_path = options.test_apk |
| 262 options.test_apk_jar_path = (os.path.splitext(options.test_apk_path)[0] + | 263 options.test_apk_jar_path = (os.path.splitext(options.test_apk_path)[0] + |
| 263 '.jar') | 264 '.jar') |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 options.test_device, | 476 options.test_device, |
| 476 shard=True, | 477 shard=True, |
| 477 build_type=options.build_type, | 478 build_type=options.build_type, |
| 478 test_timeout=None, | 479 test_timeout=None, |
| 479 num_retries=options.num_retries) | 480 num_retries=options.num_retries) |
| 480 | 481 |
| 481 results.AddTestRunResults(test_results) | 482 results.AddTestRunResults(test_results) |
| 482 | 483 |
| 483 if options.run_python_tests: | 484 if options.run_python_tests: |
| 484 runner_factory, tests = host_driven_setup.InstrumentationSetup( | 485 runner_factory, tests = host_driven_setup.InstrumentationSetup( |
| 485 options.python_test_root, options.official_build, | 486 options.host_driven_root, options.official_build, |
| 486 instrumentation_options) | 487 instrumentation_options) |
| 487 | 488 |
| 488 if tests: | 489 if tests: |
| 489 test_results, test_exit_code = test_dispatcher.RunTests( | 490 test_results, test_exit_code = test_dispatcher.RunTests( |
| 490 tests, runner_factory, False, | 491 tests, runner_factory, False, |
| 491 options.test_device, | 492 options.test_device, |
| 492 shard=True, | 493 shard=True, |
| 493 build_type=options.build_type, | 494 build_type=options.build_type, |
| 494 test_timeout=None, | 495 test_timeout=None, |
| 495 num_retries=options.num_retries) | 496 num_retries=options.num_retries) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 option_parser.error('Invalid command.') | 686 option_parser.error('Invalid command.') |
| 686 command = argv[1] | 687 command = argv[1] |
| 687 VALID_COMMANDS[command].add_options_func(option_parser) | 688 VALID_COMMANDS[command].add_options_func(option_parser) |
| 688 options, args = option_parser.parse_args(argv) | 689 options, args = option_parser.parse_args(argv) |
| 689 return VALID_COMMANDS[command].run_command_func( | 690 return VALID_COMMANDS[command].run_command_func( |
| 690 command, options, args, option_parser) | 691 command, options, args, option_parser) |
| 691 | 692 |
| 692 | 693 |
| 693 if __name__ == '__main__': | 694 if __name__ == '__main__': |
| 694 sys.exit(main(sys.argv)) | 695 sys.exit(main(sys.argv)) |
| OLD | NEW |