OLD | NEW |
1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Set up and invoke telemetry tests.""" | 6 """Set up and invoke telemetry tests.""" |
7 | 7 |
8 import json | 8 import json |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 return commands, env | 150 return commands, env |
151 | 151 |
152 | 152 |
153 def main(argv): | 153 def main(argv): |
154 prog_desc = 'Invoke telemetry performance tests.' | 154 prog_desc = 'Invoke telemetry performance tests.' |
155 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc)) | 155 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc)) |
156 parser.add_option('--print-cmd', action='store_true', | 156 parser.add_option('--print-cmd', action='store_true', |
157 help='only print command instead of running it') | 157 help='only print command instead of running it') |
158 parser.add_option('--target-android-browser', | 158 parser.add_option('--target-android-browser', |
159 default='android-chromium-testshell', | 159 default='android-chrome-shell', |
160 help='target browser used on Android') | 160 help='target browser used on Android') |
161 parser.add_option('--factory-properties', action='callback', | 161 parser.add_option('--factory-properties', action='callback', |
162 callback=chromium_utils.convert_json, type='string', | 162 callback=chromium_utils.convert_json, type='string', |
163 nargs=1, default={}, | 163 nargs=1, default={}, |
164 help='factory properties in JSON format') | 164 help='factory properties in JSON format') |
165 | 165 |
166 options, _ = parser.parse_args(argv[1:]) | 166 options, _ = parser.parse_args(argv[1:]) |
167 if not options.factory_properties: | 167 if not options.factory_properties: |
168 print 'This program requires a factory properties to run.' | 168 print 'This program requires a factory properties to run.' |
169 return 1 | 169 return 1 |
170 | 170 |
171 commands, env = _GenerateTelemetryCommandSequence(options) | 171 commands, env = _GenerateTelemetryCommandSequence(options) |
172 | 172 |
173 retval = 0 | 173 retval = 0 |
174 for command in commands: | 174 for command in commands: |
175 if options.print_cmd: | 175 if options.print_cmd: |
176 print ' '.join("'%s'" % c for c in command) | 176 print ' '.join("'%s'" % c for c in command) |
177 continue | 177 continue |
178 | 178 |
179 retval = chromium_utils.RunCommand(command, env=env) | 179 retval = chromium_utils.RunCommand(command, env=env) |
180 if retval != 0: | 180 if retval != 0: |
181 break | 181 break |
182 return retval | 182 return retval |
183 | 183 |
184 | 184 |
185 if '__main__' == __name__: | 185 if '__main__' == __name__: |
186 sys.exit(main(sys.argv)) | 186 sys.exit(main(sys.argv)) |
OLD | NEW |