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