| 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()
|
|
|