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

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

Issue 545803002: Update buildbots to parse new telemetry JSON format. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Addressed review comments 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=buildbot', 80 '--output-format=chartjson'
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])
111 test_cmd = _GetPythonTestCommand(script, target, test_args, 112 test_cmd = _GetPythonTestCommand(script, target, test_args,
112 wrapper_args=wrapper_args, fp=fp) 113 wrapper_args=wrapper_args, fp=fp)
113 commands.append(test_cmd) 114 commands.append(test_cmd)
114 115
115 # Run the test against the target chrome build for different user profiles on 116 # Run the test against the target chrome build for different user profiles on
116 # certain page cyclers. 117 # certain page cyclers.
117 if target_os != 'android': 118 if target_os != 'android':
118 if test_name in ('page_cycler_moz', 'page_cycler_morejs'): 119 if test_name in ('page_cycler_moz', 'page_cycler_morejs'):
119 test_args = list(common_args) 120 test_args = list(common_args)
120 test_args.extend(['--profile-type=typical_user', 121 test_args.extend(['--profile-type=typical_user',
(...skipping 13 matching lines...) Expand all
134 135
135 # Run the test against the reference build on platforms where it exists. 136 # Run the test against the reference build on platforms where it exists.
136 ref_build = _GetReferenceBuildPath(target_os, target_platform) 137 ref_build = _GetReferenceBuildPath(target_os, target_platform)
137 ref_build = fp.get('reference_build_executable', ref_build) 138 ref_build = fp.get('reference_build_executable', ref_build)
138 if ref_build and fp.get('run_reference_build', True): 139 if ref_build and fp.get('run_reference_build', True):
139 ref_args = list(common_args) 140 ref_args = list(common_args)
140 ref_args.extend(['--browser=exact', 141 ref_args.extend(['--browser=exact',
141 '--browser-executable=%s' % ref_build, 142 '--browser-executable=%s' % ref_build,
142 '--output-trace-tag=_ref']) 143 '--output-trace-tag=_ref'])
143 ref_args.extend(test_specification) 144 ref_args.extend(test_specification)
145 ref_args.extend(['--output=%s' % options.ref_output_filename])
144 ref_cmd = _GetPythonTestCommand(script, target, ref_args, fp=fp) 146 ref_cmd = _GetPythonTestCommand(script, target, ref_args, fp=fp)
145 commands.append(ref_cmd) 147 commands.append(ref_cmd)
146 148
147 return commands, env 149 return commands, env
148 150
149 151
150 def main(argv): 152 def main(argv):
151 prog_desc = 'Invoke telemetry performance tests.' 153 prog_desc = 'Invoke telemetry performance tests.'
152 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc)) 154 parser = optparse.OptionParser(usage=('%prog [options]' + '\n\n' + prog_desc))
153 parser.add_option('--print-cmd', action='store_true', 155 parser.add_option('--print-cmd', action='store_true',
154 help='only print command instead of running it') 156 help='only print command instead of running it')
155 parser.add_option('--target-android-browser', 157 parser.add_option('--target-android-browser',
156 default='android-chrome-shell', 158 default='android-chrome-shell',
157 help='target browser used on Android') 159 help='target browser used on Android')
158 parser.add_option('--factory-properties', action='callback', 160 parser.add_option('--factory-properties', action='callback',
159 callback=chromium_utils.convert_json, type='string', 161 callback=chromium_utils.convert_json, type='string',
160 nargs=1, default={}, 162 nargs=1, default={},
161 help='factory properties in JSON format') 163 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')
162 168
163 options, _ = parser.parse_args(argv[1:]) 169 options, _ = parser.parse_args(argv[1:])
164 if not options.factory_properties: 170 if not options.factory_properties:
165 print 'This program requires a factory properties to run.' 171 print 'This program requires a factory properties to run.'
166 return 1 172 return 1
167 173
168 commands, env = _GenerateTelemetryCommandSequence(options) 174 commands, env = _GenerateTelemetryCommandSequence(options)
169 175
170 retval = 0 176 retval = 0
171 for command in commands: 177 for command in commands:
172 if options.print_cmd: 178 if options.print_cmd:
173 print ' '.join("'%s'" % c for c in command) 179 print ' '.join("'%s'" % c for c in command)
174 continue 180 continue
175 181
176 retval = chromium_utils.RunCommand(command, env=env) 182 retval = chromium_utils.RunCommand(command, env=env)
177 if retval != 0: 183 if retval != 0:
178 break 184 break
179 return retval 185 return retval
180 186
181 187
182 if '__main__' == __name__: 188 if '__main__' == __name__:
183 sys.exit(main(sys.argv)) 189 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