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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 # Some things such as Forwarder require ADB to be in the environment path. | 116 # Some things such as Forwarder require ADB to be in the environment path. |
117 adb_dir = os.path.dirname(constants.GetAdbPath()) | 117 adb_dir = os.path.dirname(constants.GetAdbPath()) |
118 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | 118 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): |
119 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | 119 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] |
120 | 120 |
121 | 121 |
122 def AddRemoteDeviceOptions(parser): | 122 def AddRemoteDeviceOptions(parser): |
123 group = parser.add_argument_group('Remote Device Options') | 123 group = parser.add_argument_group('Remote Device Options') |
124 | 124 |
125 group.add_argument('--trigger', default='', | 125 group.add_argument('--trigger', default='', |
126 help=('Only triggers the test if set. Stores test_run_id ' | 126 help=('Only triggers the test if set. Stores test_run_id ' |
127 'in given file path. ')) | 127 'in given file path. ')) |
128 group.add_argument('--collect', default='', | 128 group.add_argument('--collect', default='', |
129 help=('Only collects the test results if set. ' | 129 help=('Only collects the test results if set. ' |
130 'Gets test_run_id from given file path.')) | 130 'Gets test_run_id from given file path.')) |
131 group.add_argument('--remote-device', default='', | 131 group.add_argument('--remote-device', default='', |
132 help=('Device type to run test on.')) | 132 help='Device type to run test on.') |
133 group.add_argument('--remote-device-os', default='', | 133 group.add_argument('--remote-device-os', default='', |
134 help=('OS to have on the device.')) | 134 help='OS to have on the device.') |
135 group.add_argument('--results-path', default='', | 135 group.add_argument('--results-path', default='', |
136 help=('File path to download results to.')) | 136 help='File path to download results to.') |
137 group.add_argument('--api-protocol', | 137 group.add_argument('--api-protocol', |
138 help=('HTTP protocol to use. (http or https)')) | 138 help='HTTP protocol to use. (http or https)') |
139 group.add_argument('--api-address', help=('Address to send HTTP requests.')) | 139 group.add_argument('--api-address', help='Address to send HTTP requests.') |
140 group.add_argument('--api-port', help=('Port to send HTTP requests to.')) | 140 group.add_argument('--api-port', help='Port to send HTTP requests to.') |
141 group.add_argument('--runner-type', default='', | 141 group.add_argument('--runner-type', default='', |
142 help=('Type of test to run as.')) | 142 help='Type of test to run as.') |
143 group.add_argument('--runner-package', default='', | 143 group.add_argument('--runner-package', default='', |
144 help=('Package name of test.')) | 144 help='Package name of test.') |
145 group.add_argument('--apk-under-test', default='apks/Chrome.apk', | 145 group.add_argument('--apk-under-test', default='apks/Chrome.apk', |
146 help=('APK to run tests on.')) | 146 help='APK to run tests on.') |
147 | 147 |
148 api_secret_group = group.add_mutually_exclusive_group() | 148 api_secret_group = group.add_mutually_exclusive_group() |
149 api_secret_group.add_argument('--api-secret', default='', | 149 api_secret_group.add_argument('--api-secret', default='', |
150 help=('API secret for remote devices.')) | 150 help='API secret for remote devices.') |
151 api_secret_group.add_argument('--api-secret-file', default='', | 151 api_secret_group.add_argument('--api-secret-file', default='', |
152 help=('Path to file that contains API secret.')) | 152 help='Path to file that contains API secret.') |
153 | 153 |
154 api_key_group = group.add_mutually_exclusive_group() | 154 api_key_group = group.add_mutually_exclusive_group() |
155 api_key_group.add_argument('--api-key', default='', | 155 api_key_group.add_argument('--api-key', default='', |
156 help=('API key for remote devices.')) | 156 help='API key for remote devices.') |
157 api_key_group.add_argument('--api-key-file', default='', | 157 api_key_group.add_argument('--api-key-file', default='', |
158 help=('Path to file that contains API key.')) | 158 help='Path to file that contains API key.') |
159 | 159 |
160 | 160 |
161 def AddDeviceOptions(parser): | 161 def AddDeviceOptions(parser): |
162 """Adds device options to |parser|.""" | 162 """Adds device options to |parser|.""" |
163 group = parser.add_argument_group(title='Device Options') | 163 group = parser.add_argument_group(title='Device Options') |
164 group.add_argument('-c', dest='cleanup_test_files', | 164 group.add_argument('-c', dest='cleanup_test_files', |
165 help='Cleanup test files on the device after run', | 165 help='Cleanup test files on the device after run', |
166 action='store_true') | 166 action='store_true') |
167 group.add_argument('--tool', | 167 group.add_argument('--tool', |
168 dest='tool', | 168 dest='tool', |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 subparser = command_parsers.add_parser( | 988 subparser = command_parsers.add_parser( |
989 test_type, usage='%(prog)s [options]', help=config.help_txt) | 989 test_type, usage='%(prog)s [options]', help=config.help_txt) |
990 config.add_options_func(subparser) | 990 config.add_options_func(subparser) |
991 | 991 |
992 args = parser.parse_args() | 992 args = parser.parse_args() |
993 return RunTestsCommand(args, parser) | 993 return RunTestsCommand(args, parser) |
994 | 994 |
995 | 995 |
996 if __name__ == '__main__': | 996 if __name__ == '__main__': |
997 sys.exit(main()) | 997 sys.exit(main()) |
OLD | NEW |