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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/perf/scripts_smoke_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/core/trybot_command.py
diff --git a/tools/perf/core/trybot_command.py b/tools/perf/core/trybot_command.py
index c6a6fbc7b3ce6392af44a31d1d8a86a579dfa7a1..8d145f0c7d2453a8e3a41ab49f2016ce9a85d7d8 100644
--- a/tools/perf/core/trybot_command.py
+++ b/tools/perf/core/trybot_command.py
@@ -10,7 +10,12 @@ import subprocess
import urllib2
import json
+from core import path_util
+
+from telemetry import benchmark
+from telemetry.core import discover
from telemetry.util import command_line
+from telemetry.util import matching
CHROMIUM_CONFIG_FILENAME = 'tools/run-perf-test.cfg'
@@ -163,10 +168,22 @@ class Trybot(command_line.ArgParseCommand):
@classmethod
def ProcessCommandLineArgs(cls, parser, options, extra_args, environment):
- del options, environment # unused
+ del environment # unused
for arg in extra_args:
if arg == '--browser' or arg.startswith('--browser='):
parser.error('--browser=... is not allowed when running trybot.')
+ all_benchmarks = discover.DiscoverClasses(
+ start_dir=path_util.GetPerfBenchmarksDir(),
+ top_level_dir=path_util.GetPerfDir(),
+ base_class=benchmark.Benchmark).values()
+ all_benchmark_names = [b.Name() for b in all_benchmarks]
+ if options.benchmark_name not in all_benchmark_names:
+ possible_benchmark_names = matching.GetMostLikelyMatchedObject(
+ all_benchmark_names, options.benchmark_name)
+ parser.error(
+ 'No benchmark named "%s". Do you mean any of those benchmarks '
+ 'below?\n%s' %
+ (options.benchmark_name, '\n'.join(possible_benchmark_names)))
@classmethod
def AddCommandLineArgs(cls, parser, environment):
« 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