| 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 argparse | 9 import argparse |
| 10 import collections | 10 import collections |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 help=('Target device for the test suite ' | 209 help=('Target device for the test suite ' |
| 210 'to run on.')) | 210 'to run on.')) |
| 211 group.add_argument('--blacklist-file', help='Device blacklist file.') | 211 group.add_argument('--blacklist-file', help='Device blacklist file.') |
| 212 group.add_argument('--enable-device-cache', action='store_true', | 212 group.add_argument('--enable-device-cache', action='store_true', |
| 213 help='Cache device state to disk between runs') | 213 help='Cache device state to disk between runs') |
| 214 group.add_argument('--incremental-install', action='store_true', | 214 group.add_argument('--incremental-install', action='store_true', |
| 215 help='Use an _incremental apk.') | 215 help='Use an _incremental apk.') |
| 216 group.add_argument('--enable-concurrent-adb', action='store_true', | 216 group.add_argument('--enable-concurrent-adb', action='store_true', |
| 217 help='Run multiple adb commands at the same time, even ' | 217 help='Run multiple adb commands at the same time, even ' |
| 218 'for the same device.') | 218 'for the same device.') |
| 219 group.add_argument('--skip-clear-data', action='store_true', |
| 220 help='Do not wipe app data between tests. Use this to ' |
| 221 'speed up local development and never on bots ' |
| 222 '(increases flakiness)') |
| 219 | 223 |
| 220 | 224 |
| 221 def AddGTestOptions(parser): | 225 def AddGTestOptions(parser): |
| 222 """Adds gtest options to |parser|.""" | 226 """Adds gtest options to |parser|.""" |
| 223 | 227 |
| 224 group = parser.add_argument_group('GTest Options') | 228 group = parser.add_argument_group('GTest Options') |
| 225 group.add_argument('-s', '--suite', dest='suite_name', | 229 group.add_argument('-s', '--suite', dest='suite_name', |
| 226 nargs='+', metavar='SUITE_NAME', required=True, | 230 nargs='+', metavar='SUITE_NAME', required=True, |
| 227 help='Executable name of the test suite to run.') | 231 help='Executable name of the test suite to run.') |
| 228 group.add_argument('--gtest_also_run_disabled_tests', | 232 group.add_argument('--gtest_also_run_disabled_tests', |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 args.test_apk_jar_path, | 464 args.test_apk_jar_path, |
| 461 args.test_runner, | 465 args.test_runner, |
| 462 args.test_support_apk_path, | 466 args.test_support_apk_path, |
| 463 args.device_flags, | 467 args.device_flags, |
| 464 args.isolate_file_path, | 468 args.isolate_file_path, |
| 465 args.set_asserts, | 469 args.set_asserts, |
| 466 args.delete_stale_data, | 470 args.delete_stale_data, |
| 467 args.timeout_scale, | 471 args.timeout_scale, |
| 468 args.apk_under_test, | 472 args.apk_under_test, |
| 469 args.additional_apks, | 473 args.additional_apks, |
| 470 args.strict_mode) | 474 args.strict_mode, |
| 475 args.skip_clear_data) |
| 471 | 476 |
| 472 | 477 |
| 473 def AddUIAutomatorTestOptions(parser): | 478 def AddUIAutomatorTestOptions(parser): |
| 474 """Adds UI Automator test options to |parser|.""" | 479 """Adds UI Automator test options to |parser|.""" |
| 475 | 480 |
| 476 group = parser.add_argument_group('UIAutomator Test Options') | 481 group = parser.add_argument_group('UIAutomator Test Options') |
| 477 AddJavaTestOptions(group) | 482 AddJavaTestOptions(group) |
| 478 group.add_argument( | 483 group.add_argument( |
| 479 '--package', required=True, choices=constants.PACKAGE_INFO.keys(), | 484 '--package', required=True, choices=constants.PACKAGE_INFO.keys(), |
| 480 metavar='PACKAGE', help='Package under test.') | 485 metavar='PACKAGE', help='Package under test.') |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 if e.is_infra_error: | 1106 if e.is_infra_error: |
| 1102 return constants.INFRA_EXIT_CODE | 1107 return constants.INFRA_EXIT_CODE |
| 1103 return constants.ERROR_EXIT_CODE | 1108 return constants.ERROR_EXIT_CODE |
| 1104 except: # pylint: disable=W0702 | 1109 except: # pylint: disable=W0702 |
| 1105 logging.exception('Unrecognized error occurred.') | 1110 logging.exception('Unrecognized error occurred.') |
| 1106 return constants.ERROR_EXIT_CODE | 1111 return constants.ERROR_EXIT_CODE |
| 1107 | 1112 |
| 1108 | 1113 |
| 1109 if __name__ == '__main__': | 1114 if __name__ == '__main__': |
| 1110 sys.exit(main()) | 1115 sys.exit(main()) |
| OLD | NEW |