Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: scripts/slave/telemetry.py

Issue 565973005: Revert of Update buildbots to parse new telemetry JSON format. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « scripts/slave/runtest.py ('k') | scripts/slave/telemetry_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 test_specification = [test_name] 71 test_specification = [test_name]
72 72
73 env = os.environ 73 env = os.environ
74 74
75 # List of command line arguments common to all test platforms. 75 # List of command line arguments common to all test platforms.
76 common_args = [ 76 common_args = [
77 # INFO level verbosity. 77 # INFO level verbosity.
78 '-v', 78 '-v',
79 # Output results in the format the buildbot expects. 79 # Output results in the format the buildbot expects.
80 '--output-format=chartjson' 80 '--output-format=buildbot',
81 ] 81 ]
82 82
83 if profile_type: 83 if profile_type:
84 profile_dir = os.path.join( 84 profile_dir = os.path.join(
85 build_dir, target, 'generated_profile', profile_type) 85 build_dir, target, 'generated_profile', profile_type)
86 common_args.append('--profile-dir=' + profile_dir) 86 common_args.append('--profile-dir=' + profile_dir)
87 if extra_args: 87 if extra_args:
88 common_args.extend(extra_args) 88 common_args.extend(extra_args)
89 89
90 commands = [] 90 commands = []
(...skipping 10 matching lines...) Expand all
101 '--'] 101 '--']
102 # If an executable is passed, use that instead. 102 # If an executable is passed, use that instead.
103 if browser_exe: 103 if browser_exe:
104 browser_info = ['--browser=exact', 104 browser_info = ['--browser=exact',
105 '--browser-executable=%s' % browser_exe] 105 '--browser-executable=%s' % browser_exe]
106 else: 106 else:
107 browser_info = ['--browser=%s' % browser] 107 browser_info = ['--browser=%s' % browser]
108 test_args = list(common_args) 108 test_args = list(common_args)
109 test_args.extend(browser_info) 109 test_args.extend(browser_info)
110 test_args.extend(test_specification) 110 test_args.extend(test_specification)
111 test_args.extend(['--output=%s' % options.chart_output_filename])
112 test_cmd = _GetPythonTestCommand(script, target, test_args, 111 test_cmd = _GetPythonTestCommand(script, target, test_args,
113 wrapper_args=wrapper_args, fp=fp) 112 wrapper_args=wrapper_args, fp=fp)
114 commands.append(test_cmd) 113 commands.append(test_cmd)
115 114
116 # Run the test against the target chrome build for different user profiles on 115 # Run the test against the target chrome build for different user profiles on
117 # certain page cyclers. 116 # certain page cyclers.
118 if target_os != 'android': 117 if target_os != 'android':
119 if test_name in ('page_cycler_moz', 'page_cycler_morejs'): 118 if test_name in ('page_cycler_moz', 'page_cycler_morejs'):
120 test_args = list(common_args) 119 test_args = list(common_args)
121 test_args.extend(['--profile-type=typical_user', 120 test_args.extend(['--profile-type=typical_user',
(...skipping 13 matching lines...) Expand all
135 134
136 # Run the test against the reference build on platforms where it exists. 135 # Run the test against the reference build on platforms where it exists.
137 ref_build = _GetReferenceBuildPath(target_os, target_platform) 136 ref_build = _GetReferenceBuildPath(target_os, target_platform)
138 ref_build = fp.get('reference_build_executable', ref_build) 137 ref_build = fp.get('reference_build_executable', ref_build)
139 if ref_build and fp.get('run_reference_build', True): 138 if ref_build and fp.get('run_reference_build', True):
140 ref_args = list(common_args) 139 ref_args = list(common_args)
141 ref_args.extend(['--browser=exact', 140 ref_args.extend(['--browser=exact',
142 '--browser-executable=%s' % ref_build, 141 '--browser-executable=%s' % ref_build,
143 '--output-trace-tag=_ref']) 142 '--output-trace-tag=_ref'])
144 ref_args.extend(test_specification) 143 ref_args.extend(test_specification)
145 ref_args.extend(['--output=%s' % options.ref_output_filename])
146 ref_cmd = _GetPythonTestCommand(script, target, ref_args, fp=fp) 144 ref_cmd = _GetPythonTestCommand(script, target, ref_args, fp=fp)
147 commands.append(ref_cmd) 145 commands.append(ref_cmd)
148 146
149 return commands, env 147 return commands, env
150 148
151 149
152 def main(argv): 150 def main(argv):
153 prog_desc = 'Invoke telemetry performance tests.' 151 prog_desc = 'Invoke telemetry performance tests.'
154 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc)) 152 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc))
155 parser.add_option('--print-cmd', action='store_true', 153 parser.add_option('--print-cmd', action='store_true',
156 help='only print command instead of running it') 154 help='only print command instead of running it')
157 parser.add_option('--target-android-browser', 155 parser.add_option('--target-android-browser',
158 default='android-chrome-shell', 156 default='android-chrome-shell',
159 help='target browser used on Android') 157 help='target browser used on Android')
160 parser.add_option('--factory-properties', action='callback', 158 parser.add_option('--factory-properties', action='callback',
161 callback=chromium_utils.convert_json, type='string', 159 callback=chromium_utils.convert_json, type='string',
162 nargs=1, default={}, 160 nargs=1, default={},
163 help='factory properties in JSON format') 161 help='factory properties in JSON format')
164 parser.add_option('--chart-output-filename',
165 help='file to save telemetry test output')
166 parser.add_option('--ref-output-filename',
167 help='file to save reference telemetry test output')
168 162
169 options, _ = parser.parse_args(argv[1:]) 163 options, _ = parser.parse_args(argv[1:])
170 if not options.factory_properties: 164 if not options.factory_properties:
171 print 'This program requires a factory properties to run.' 165 print 'This program requires a factory properties to run.'
172 return 1 166 return 1
173 167
174 commands, env = _GenerateTelemetryCommandSequence(options) 168 commands, env = _GenerateTelemetryCommandSequence(options)
175 169
176 retval = 0 170 retval = 0
177 for command in commands: 171 for command in commands:
178 if options.print_cmd: 172 if options.print_cmd:
179 print ' '.join("'%s'" % c for c in command) 173 print ' '.join("'%s'" % c for c in command)
180 continue 174 continue
181 175
182 retval = chromium_utils.RunCommand(command, env=env) 176 retval = chromium_utils.RunCommand(command, env=env)
183 if retval != 0: 177 if retval != 0:
184 break 178 break
185 return retval 179 return retval
186 180
187 181
188 if '__main__' == __name__: 182 if '__main__' == __name__:
189 sys.exit(main(sys.argv)) 183 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « scripts/slave/runtest.py ('k') | scripts/slave/telemetry_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698