| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 constants.SetAdbPath(args.adb_path) | 114 constants.SetAdbPath(args.adb_path) |
| 115 # Some things such as Forwarder require ADB to be in the environment path. | 115 # Some things such as Forwarder require ADB to be in the environment path. |
| 116 adb_dir = os.path.dirname(constants.GetAdbPath()) | 116 adb_dir = os.path.dirname(constants.GetAdbPath()) |
| 117 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | 117 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): |
| 118 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | 118 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] |
| 119 | 119 |
| 120 | 120 |
| 121 def AddRemoteDeviceOptions(parser): | 121 def AddRemoteDeviceOptions(parser): |
| 122 group = parser.add_argument_group('Remote Device Options') | 122 group = parser.add_argument_group('Remote Device Options') |
| 123 | 123 |
| 124 group.add_argument('--trigger', default='', | 124 group.add_argument('--trigger', |
| 125 help=('Only triggers the test if set. Stores test_run_id ' | 125 help=('Only triggers the test if set. Stores test_run_id ' |
| 126 'in given file path. ')) | 126 'in given file path. ')) |
| 127 group.add_argument('--collect', default='', | 127 group.add_argument('--collect', |
| 128 help=('Only collects the test results if set. ' | 128 help=('Only collects the test results if set. ' |
| 129 'Gets test_run_id from given file path.')) | 129 'Gets test_run_id from given file path.')) |
| 130 group.add_argument('--remote-device', default='', | 130 group.add_argument('--remote-device', action='append', |
| 131 help='Device type to run test on.') | 131 help='Device type to run test on.') |
| 132 group.add_argument('--remote-device-os', default='', | 132 group.add_argument('--results-path', |
| 133 help='OS to have on the device.') | |
| 134 group.add_argument('--results-path', default='', | |
| 135 help='File path to download results to.') | 133 help='File path to download results to.') |
| 136 group.add_argument('--api-protocol', | 134 group.add_argument('--api-protocol', |
| 137 help='HTTP protocol to use. (http or https)') | 135 help='HTTP protocol to use. (http or https)') |
| 138 group.add_argument('--api-address', help='Address to send HTTP requests.') | 136 group.add_argument('--api-address', |
| 139 group.add_argument('--api-port', help='Port to send HTTP requests to.') | 137 help='Address to send HTTP requests.') |
| 140 group.add_argument('--runner-type', default='', | 138 group.add_argument('--api-port', |
| 139 help='Port to send HTTP requests to.') |
| 140 group.add_argument('--runner-type', |
| 141 help='Type of test to run as.') | 141 help='Type of test to run as.') |
| 142 group.add_argument('--runner-package', help='Package name of test.') | 142 group.add_argument('--runner-package', |
| 143 group.add_argument('--device-type', default='Android', | 143 help='Package name of test.') |
| 144 group.add_argument('--device-type', |
| 144 choices=constants.VALID_DEVICE_TYPES, | 145 choices=constants.VALID_DEVICE_TYPES, |
| 145 help=('Type of device to run on. iOS or android')) | 146 help=('Type of device to run on. iOS or android')) |
| 147 group.add_argument('--device-oem', action='append', |
| 148 help='Device OEM to run on.') |
| 149 group.add_argument('--remote-device-file', |
| 150 help=('File with JSON to select remote device. ' |
| 151 'Overrides all other flags.')) |
| 152 |
| 153 device_os_group = group.add_mutually_exclusive_group() |
| 154 device_os_group.add_argument('--remote-device-minimum-os', |
| 155 help='Minimum OS on device.') |
| 156 device_os_group.add_argument('--remote-device-os', action='append', |
| 157 help='OS to have on the device.') |
| 146 | 158 |
| 147 api_secret_group = group.add_mutually_exclusive_group() | 159 api_secret_group = group.add_mutually_exclusive_group() |
| 148 api_secret_group.add_argument('--api-secret', default='', | 160 api_secret_group.add_argument('--api-secret', default='', |
| 149 help='API secret for remote devices.') | 161 help='API secret for remote devices.') |
| 150 api_secret_group.add_argument('--api-secret-file', default='', | 162 api_secret_group.add_argument('--api-secret-file', default='', |
| 151 help='Path to file that contains API secret.') | 163 help='Path to file that contains API secret.') |
| 152 | 164 |
| 153 api_key_group = group.add_mutually_exclusive_group() | 165 api_key_group = group.add_mutually_exclusive_group() |
| 154 api_key_group.add_argument('--api-key', default='', | 166 api_key_group.add_argument('--api-key', default='', |
| 155 help='API key for remote devices.') | 167 help='API key for remote devices.') |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 args.event_count, | 511 args.event_count, |
| 500 category, | 512 category, |
| 501 args.throttle, | 513 args.throttle, |
| 502 args.seed, | 514 args.seed, |
| 503 args.extra_args) | 515 args.extra_args) |
| 504 | 516 |
| 505 def AddUirobotTestOptions(parser): | 517 def AddUirobotTestOptions(parser): |
| 506 """Adds uirobot test options to |option_parser|.""" | 518 """Adds uirobot test options to |option_parser|.""" |
| 507 group = parser.add_argument_group('Uirobot Test Options') | 519 group = parser.add_argument_group('Uirobot Test Options') |
| 508 | 520 |
| 509 group.add_argument('--app-under-test', help='APK to run tests on.') | 521 group.add_argument('--app-under-test', required=True, |
| 522 help='APK to run tests on.') |
| 510 group.add_argument( | 523 group.add_argument( |
| 511 '--minutes', default=5, type=int, | 524 '--minutes', default=5, type=int, |
| 512 help='Number of minutes to run uirobot test [default: %default].') | 525 help='Number of minutes to run uirobot test [default: %default].') |
| 513 | 526 |
| 514 AddCommonOptions(parser) | 527 AddCommonOptions(parser) |
| 515 AddDeviceOptions(parser) | 528 AddDeviceOptions(parser) |
| 516 AddRemoteDeviceOptions(parser) | 529 AddRemoteDeviceOptions(parser) |
| 517 | 530 |
| 518 def AddPerfTestOptions(parser): | 531 def AddPerfTestOptions(parser): |
| 519 """Adds perf test options to |parser|.""" | 532 """Adds perf test options to |parser|.""" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 subparser = command_parsers.add_parser( | 1002 subparser = command_parsers.add_parser( |
| 990 test_type, usage='%(prog)s [options]', help=config.help_txt) | 1003 test_type, usage='%(prog)s [options]', help=config.help_txt) |
| 991 config.add_options_func(subparser) | 1004 config.add_options_func(subparser) |
| 992 | 1005 |
| 993 args = parser.parse_args() | 1006 args = parser.parse_args() |
| 994 return RunTestsCommand(args, parser) | 1007 return RunTestsCommand(args, parser) |
| 995 | 1008 |
| 996 | 1009 |
| 997 if __name__ == '__main__': | 1010 if __name__ == '__main__': |
| 998 sys.exit(main()) | 1011 sys.exit(main()) |
| OLD | NEW |