| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 commands.append(ref_cmd) | 123 commands.append(ref_cmd) |
| 124 | 124 |
| 125 return commands, env | 125 return commands, env |
| 126 | 126 |
| 127 | 127 |
| 128 def main(argv): | 128 def main(argv): |
| 129 prog_desc = 'Invoke telemetry performance tests.' | 129 prog_desc = 'Invoke telemetry performance tests.' |
| 130 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc)) | 130 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc)) |
| 131 parser.add_option('--print-cmd', action='store_true', | 131 parser.add_option('--print-cmd', action='store_true', |
| 132 help='only print command instead of running it') | 132 help='only print command instead of running it') |
| 133 parser.add_option('--target-android-browser', default='android-content-shell', | 133 parser.add_option('--target-android-browser', |
| 134 default='android-chromium-testshell', |
| 134 help='target browser used on Android') | 135 help='target browser used on Android') |
| 135 parser.add_option('--factory-properties', action='callback', | 136 parser.add_option('--factory-properties', action='callback', |
| 136 callback=chromium_utils.convert_json, type='string', | 137 callback=chromium_utils.convert_json, type='string', |
| 137 nargs=1, default={}, | 138 nargs=1, default={}, |
| 138 help='factory properties in JSON format') | 139 help='factory properties in JSON format') |
| 139 | 140 |
| 140 options, _ = parser.parse_args(argv[1:]) | 141 options, _ = parser.parse_args(argv[1:]) |
| 141 if not options.factory_properties: | 142 if not options.factory_properties: |
| 142 print 'This program requires a factory properties to run.' | 143 print 'This program requires a factory properties to run.' |
| 143 return 1 | 144 return 1 |
| 144 | 145 |
| 145 commands, env = _GenerateTelemetryCommandSequence(options) | 146 commands, env = _GenerateTelemetryCommandSequence(options) |
| 146 | 147 |
| 147 retval = 0 | 148 retval = 0 |
| 148 for command in commands: | 149 for command in commands: |
| 149 if options.print_cmd: | 150 if options.print_cmd: |
| 150 print ' '.join("'%s'" % c for c in command) | 151 print ' '.join("'%s'" % c for c in command) |
| 151 continue | 152 continue |
| 152 | 153 |
| 153 retval = chromium_utils.RunCommand(command, env=env) | 154 retval = chromium_utils.RunCommand(command, env=env) |
| 154 if retval != 0: | 155 if retval != 0: |
| 155 break | 156 break |
| 156 return retval | 157 return retval |
| 157 | 158 |
| 158 | 159 |
| 159 if '__main__' == __name__: | 160 if '__main__' == __name__: |
| 160 sys.exit(main(sys.argv)) | 161 sys.exit(main(sys.argv)) |
| OLD | NEW |