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

Unified Diff: telemetry/telemetry/benchmark_runner.py

Issue 2291313002: [Telemetry] Add 'check_independent' command to benchmark_runner (Closed)
Patch Set: add testdata __init__.py Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « telemetry/examples/run_benchmark ('k') | telemetry/telemetry/benchmark_runner_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/benchmark_runner.py
diff --git a/telemetry/telemetry/benchmark_runner.py b/telemetry/telemetry/benchmark_runner.py
index 598bc5315e1937707c3cb2461f00a39586ab008f..1212a0e2f9196f0686abfbea8fce81c413a58c54 100644
--- a/telemetry/telemetry/benchmark_runner.py
+++ b/telemetry/telemetry/benchmark_runner.py
@@ -196,7 +196,7 @@ class Run(command_line.OptparseCommand):
matching_benchmark.SetArgumentDefaults(parser)
@classmethod
- def ProcessCommandLineArgs(cls, parser, args, environment):
+ def _FindBenchmark(cls, parser, args, environment):
all_benchmarks = _Benchmarks(environment)
if not args.positional_args:
possible_browser = (
@@ -231,6 +231,12 @@ class Run(command_line.OptparseCommand):
assert issubclass(benchmark_class, benchmark.Benchmark), (
'Trying to run a non-Benchmark?!')
+ return benchmark_class
+
+ @classmethod
+ def ProcessCommandLineArgs(cls, parser, args, environment):
+ benchmark_class = cls._FindBenchmark(parser, args, environment)
+
benchmark.ProcessCommandLineArgs(parser, args)
benchmark_class.ProcessCommandLineArgs(parser, args)
@@ -240,6 +246,22 @@ class Run(command_line.OptparseCommand):
return min(255, self._benchmark().Run(args))
+class CheckIndependent(Run):
+ """Return 0 if benchmark stories are independent, 1 if not."""
+
+ usage = '[benchmark_name]'
+
+ @classmethod
+ def ProcessCommandLineArgs(cls, parser, args, environment):
+ cls._benchmark = cls._FindBenchmark(parser, args, environment)
+
+ def Run(self, args):
+ if self._benchmark.ShouldTearDownStateAfterEachStoryRun():
+ sys.exit(0)
+ else:
+ sys.exit(1)
+
+
def _ScriptName():
return os.path.basename(sys.argv[0])
@@ -401,7 +423,7 @@ def main(environment, extra_commands=None, **log_config_kwargs):
if extra_commands is None:
extra_commands = []
- all_commands = [Help, List, Run] + extra_commands
+ all_commands = [Help, CheckIndependent, List, Run] + extra_commands
# Validate and interpret the command name.
commands = _MatchingCommands(command_name, all_commands)
@@ -417,7 +439,8 @@ def main(environment, extra_commands=None, **log_config_kwargs):
else:
command = Run
- binary_manager.InitDependencyManager(environment.client_configs)
+ if binary_manager.NeedsInit():
+ binary_manager.InitDependencyManager(environment.client_configs)
# Parse and run the command.
parser = command.CreateParser()
« no previous file with comments | « telemetry/examples/run_benchmark ('k') | telemetry/telemetry/benchmark_runner_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698