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

Side by Side Diff: tools/perf/core/trybot_command.py

Issue 1757773003: [tools/perf] Raise parser error if trybot command failed to find a matching benchmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | tools/perf/scripts_smoke_unittest.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 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import os 6 import os
7 import logging 7 import logging
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import urllib2 10 import urllib2
11 import json 11 import json
12 12
13 from core import path_util
14
15 from telemetry import benchmark
16 from telemetry.core import discover
13 from telemetry.util import command_line 17 from telemetry.util import command_line
18 from telemetry.util import matching
14 19
15 20
16 CHROMIUM_CONFIG_FILENAME = 'tools/run-perf-test.cfg' 21 CHROMIUM_CONFIG_FILENAME = 'tools/run-perf-test.cfg'
17 BLINK_CONFIG_FILENAME = 'Tools/run-perf-test.cfg' 22 BLINK_CONFIG_FILENAME = 'Tools/run-perf-test.cfg'
18 SUCCESS, NO_CHANGES, ERROR = range(3) 23 SUCCESS, NO_CHANGES, ERROR = range(3)
19 # Unsupported Perf bisect bots. 24 # Unsupported Perf bisect bots.
20 EXCLUDED_BOTS = { 25 EXCLUDED_BOTS = {
21 'win_xp_perf_bisect', # Goma issues: crbug.com/330900 26 'win_xp_perf_bisect', # Goma issues: crbug.com/330900
22 'win_perf_bisect_builder', 27 'win_perf_bisect_builder',
23 'win64_nv_tester', 28 'win64_nv_tester',
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 @classmethod 161 @classmethod
157 def CreateParser(cls): 162 def CreateParser(cls):
158 parser = argparse.ArgumentParser( 163 parser = argparse.ArgumentParser(
159 ('Run telemetry benchmarks on trybot. You can add all the benchmark ' 164 ('Run telemetry benchmarks on trybot. You can add all the benchmark '
160 'options available except the --browser option'), 165 'options available except the --browser option'),
161 formatter_class=argparse.RawTextHelpFormatter) 166 formatter_class=argparse.RawTextHelpFormatter)
162 return parser 167 return parser
163 168
164 @classmethod 169 @classmethod
165 def ProcessCommandLineArgs(cls, parser, options, extra_args, environment): 170 def ProcessCommandLineArgs(cls, parser, options, extra_args, environment):
166 del options, environment # unused 171 del environment # unused
167 for arg in extra_args: 172 for arg in extra_args:
168 if arg == '--browser' or arg.startswith('--browser='): 173 if arg == '--browser' or arg.startswith('--browser='):
169 parser.error('--browser=... is not allowed when running trybot.') 174 parser.error('--browser=... is not allowed when running trybot.')
175 all_benchmarks = discover.DiscoverClasses(
176 start_dir=path_util.GetPerfBenchmarksDir(),
177 top_level_dir=path_util.GetPerfDir(),
178 base_class=benchmark.Benchmark).values()
179 all_benchmark_names = [b.Name() for b in all_benchmarks]
180 if options.benchmark_name not in all_benchmark_names:
181 possible_benchmark_names = matching.GetMostLikelyMatchedObject(
182 all_benchmark_names, options.benchmark_name)
183 parser.error(
184 'No benchmark named "%s". Do you mean any of those benchmarks '
185 'below?\n%s' %
186 (options.benchmark_name, '\n'.join(possible_benchmark_names)))
170 187
171 @classmethod 188 @classmethod
172 def AddCommandLineArgs(cls, parser, environment): 189 def AddCommandLineArgs(cls, parser, environment):
173 del environment # unused 190 del environment # unused
174 available_bots = _GetTrybotList(cls._GetBuilderList()) 191 available_bots = _GetTrybotList(cls._GetBuilderList())
175 parser.add_argument( 192 parser.add_argument(
176 'trybot', choices=available_bots, 193 'trybot', choices=available_bots,
177 help=('specify which bots to run telemetry benchmarks on. ' 194 help=('specify which bots to run telemetry benchmarks on. '
178 ' Allowed values are:\n' + '\n'.join(available_bots)), 195 ' Allowed values are:\n' + '\n'.join(available_bots)),
179 metavar='<trybot name>') 196 metavar='<trybot name>')
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return ERROR # pylint: disable=lost-exception 412 return ERROR # pylint: disable=lost-exception
396 logging.info('Checked out original branch: %s', original_branchname) 413 logging.info('Checked out original branch: %s', original_branchname)
397 returncode, out, err = _RunProcess( 414 returncode, out, err = _RunProcess(
398 ['git', 'branch', '-D', 'telemetry-tryjob']) 415 ['git', 'branch', '-D', 'telemetry-tryjob'])
399 if returncode: 416 if returncode:
400 logging.error('Could not delete telemetry-tryjob branch. ' 417 logging.error('Could not delete telemetry-tryjob branch. '
401 'Please delete it manually: %s', err) 418 'Please delete it manually: %s', err)
402 return ERROR # pylint: disable=lost-exception 419 return ERROR # pylint: disable=lost-exception
403 logging.info('Deleted temp branch: telemetry-tryjob') 420 logging.info('Deleted temp branch: telemetry-tryjob')
404 return SUCCESS 421 return SUCCESS
OLDNEW
« no previous file with comments | « no previous file | tools/perf/scripts_smoke_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698