| 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 import collections | 9 import collections |
| 10 import logging | 10 import logging |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 def AddDeviceOptions(option_parser): | 92 def AddDeviceOptions(option_parser): |
| 93 group = optparse.OptionGroup(option_parser, 'Device Options') | 93 group = optparse.OptionGroup(option_parser, 'Device Options') |
| 94 group.add_option('-c', dest='cleanup_test_files', | 94 group.add_option('-c', dest='cleanup_test_files', |
| 95 help='Cleanup test files on the device after run', | 95 help='Cleanup test files on the device after run', |
| 96 action='store_true') | 96 action='store_true') |
| 97 group.add_option('--tool', | 97 group.add_option('--tool', |
| 98 dest='tool', | 98 dest='tool', |
| 99 help=('Run the test under a tool ' | 99 help=('Run the test under a tool ' |
| 100 '(use --tool help to list them)')) | 100 '(use --tool help to list them)')) |
| 101 group.add_option('--skip-deps-push', dest='push_deps', | |
| 102 action='store_false', default=True, | |
| 103 help=('Do not push dependencies to the device. ' | |
| 104 'Use this at own risk for speeding up test ' | |
| 105 'execution on local machine.')) | |
| 106 group.add_option('-d', '--device', dest='test_device', | 101 group.add_option('-d', '--device', dest='test_device', |
| 107 help=('Target device for the test suite ' | 102 help=('Target device for the test suite ' |
| 108 'to run on.')) | 103 'to run on.')) |
| 109 option_parser.add_option_group(group) | 104 option_parser.add_option_group(group) |
| 110 | 105 |
| 111 | 106 |
| 112 def AddGTestOptions(option_parser): | 107 def AddGTestOptions(option_parser): |
| 113 """Adds gtest options to |option_parser|.""" | 108 """Adds gtest options to |option_parser|.""" |
| 114 | 109 |
| 115 option_parser.usage = '%prog gtest [options]' | 110 option_parser.usage = '%prog gtest [options]' |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 constants.SDK_BUILD_TEST_JAVALIB_DIR, | 296 constants.SDK_BUILD_TEST_JAVALIB_DIR, |
| 302 '%s.jar' % options.test_apk) | 297 '%s.jar' % options.test_apk) |
| 303 options.test_support_apk_path = '%sSupport%s' % ( | 298 options.test_support_apk_path = '%sSupport%s' % ( |
| 304 os.path.splitext(options.test_apk_path)) | 299 os.path.splitext(options.test_apk_path)) |
| 305 | 300 |
| 306 options.test_runner = apk_helper.GetInstrumentationName(options.test_apk_path) | 301 options.test_runner = apk_helper.GetInstrumentationName(options.test_apk_path) |
| 307 | 302 |
| 308 return instrumentation_test_options.InstrumentationOptions( | 303 return instrumentation_test_options.InstrumentationOptions( |
| 309 options.tool, | 304 options.tool, |
| 310 options.cleanup_test_files, | 305 options.cleanup_test_files, |
| 311 options.push_deps, | |
| 312 options.annotations, | 306 options.annotations, |
| 313 options.exclude_annotations, | 307 options.exclude_annotations, |
| 314 options.test_filter, | 308 options.test_filter, |
| 315 options.test_data, | 309 options.test_data, |
| 316 options.save_perf_json, | 310 options.save_perf_json, |
| 317 options.screenshot_failures, | 311 options.screenshot_failures, |
| 318 options.wait_for_debugger, | 312 options.wait_for_debugger, |
| 319 options.coverage_dir, | 313 options.coverage_dir, |
| 320 options.test_apk, | 314 options.test_apk, |
| 321 options.test_apk_path, | 315 options.test_apk_path, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 constants.GetOutDirectory(), | 374 constants.GetOutDirectory(), |
| 381 constants.SDK_BUILD_JAVALIB_DIR, | 375 constants.SDK_BUILD_JAVALIB_DIR, |
| 382 '%s.dex.jar' % options.test_jar) | 376 '%s.dex.jar' % options.test_jar) |
| 383 options.uiautomator_info_jar = ( | 377 options.uiautomator_info_jar = ( |
| 384 options.uiautomator_jar[:options.uiautomator_jar.find('.dex.jar')] + | 378 options.uiautomator_jar[:options.uiautomator_jar.find('.dex.jar')] + |
| 385 '_java.jar') | 379 '_java.jar') |
| 386 | 380 |
| 387 return uiautomator_test_options.UIAutomatorOptions( | 381 return uiautomator_test_options.UIAutomatorOptions( |
| 388 options.tool, | 382 options.tool, |
| 389 options.cleanup_test_files, | 383 options.cleanup_test_files, |
| 390 options.push_deps, | |
| 391 options.annotations, | 384 options.annotations, |
| 392 options.exclude_annotations, | 385 options.exclude_annotations, |
| 393 options.test_filter, | 386 options.test_filter, |
| 394 options.test_data, | 387 options.test_data, |
| 395 options.save_perf_json, | 388 options.save_perf_json, |
| 396 options.screenshot_failures, | 389 options.screenshot_failures, |
| 397 options.uiautomator_jar, | 390 options.uiautomator_jar, |
| 398 options.uiautomator_info_jar, | 391 options.uiautomator_info_jar, |
| 399 options.package) | 392 options.package) |
| 400 | 393 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 """Subcommand of RunTestsCommands which runs gtests.""" | 577 """Subcommand of RunTestsCommands which runs gtests.""" |
| 585 ProcessGTestOptions(options) | 578 ProcessGTestOptions(options) |
| 586 | 579 |
| 587 exit_code = 0 | 580 exit_code = 0 |
| 588 for suite_name in options.suite_name: | 581 for suite_name in options.suite_name: |
| 589 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for | 582 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for |
| 590 # the gtest command. | 583 # the gtest command. |
| 591 gtest_options = gtest_test_options.GTestOptions( | 584 gtest_options = gtest_test_options.GTestOptions( |
| 592 options.tool, | 585 options.tool, |
| 593 options.cleanup_test_files, | 586 options.cleanup_test_files, |
| 594 options.push_deps, | |
| 595 options.test_filter, | 587 options.test_filter, |
| 596 options.run_disabled, | 588 options.run_disabled, |
| 597 options.test_arguments, | 589 options.test_arguments, |
| 598 options.timeout, | 590 options.timeout, |
| 599 options.isolate_file_path, | 591 options.isolate_file_path, |
| 600 suite_name) | 592 suite_name) |
| 601 runner_factory, tests = gtest_setup.Setup(gtest_options, devices) | 593 runner_factory, tests = gtest_setup.Setup(gtest_options, devices) |
| 602 | 594 |
| 603 results, test_exit_code = test_dispatcher.RunTests( | 595 results, test_exit_code = test_dispatcher.RunTests( |
| 604 tests, runner_factory, devices, shard=True, test_timeout=None, | 596 tests, runner_factory, devices, shard=True, test_timeout=None, |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 | 936 |
| 945 def main(): | 937 def main(): |
| 946 signal.signal(signal.SIGUSR1, DumpThreadStacks) | 938 signal.signal(signal.SIGUSR1, DumpThreadStacks) |
| 947 option_parser = command_option_parser.CommandOptionParser( | 939 option_parser = command_option_parser.CommandOptionParser( |
| 948 commands_dict=VALID_COMMANDS) | 940 commands_dict=VALID_COMMANDS) |
| 949 return command_option_parser.ParseAndExecute(option_parser) | 941 return command_option_parser.ParseAndExecute(option_parser) |
| 950 | 942 |
| 951 | 943 |
| 952 if __name__ == '__main__': | 944 if __name__ == '__main__': |
| 953 sys.exit(main()) | 945 sys.exit(main()) |
| OLD | NEW |