summaryrefslogtreecommitdiffstats
path: root/tools/perf/core
diff options
context:
space:
mode:
authornednguyen <nednguyen@google.com>2016-03-02 17:05:28 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-03 01:06:27 +0000
commit00068d02c120dcfbf6cae98ff949c627a3762883 (patch)
treef012145b80b776880488c489f73a06f1e42c9c8a /tools/perf/core
parent6a3bc7d3aa9920c8797a42ee883d313196adadad (diff)
downloadchromium_src-00068d02c120dcfbf6cae98ff949c627a3762883.zip
chromium_src-00068d02c120dcfbf6cae98ff949c627a3762883.tar.gz
chromium_src-00068d02c120dcfbf6cae98ff949c627a3762883.tar.bz2
[tools/perf] Raise parser error if trybot command failed to find a matching benchmark
After this: tools/perf/run_benchmark try linux octanez usage: Run telemetry benchmarks on trybot. You can add all the benchmark options available except the --browser option [-h] <trybot name> <benchmark name> Run telemetry benchmarks on trybot. You can add all the benchmark options available except the --browser option: error: No benchmark named "octanez". Do you mean any of those benchmarks below? octane oortonline BUG=591409 Review URL: https://codereview.chromium.org/1757773003 Cr-Commit-Position: refs/heads/master@{#378901}
Diffstat (limited to 'tools/perf/core')
-rw-r--r--tools/perf/core/trybot_command.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/perf/core/trybot_command.py b/tools/perf/core/trybot_command.py
index c6a6fbc..8d145f0 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):