OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Parses the command line, discovers the appropriate benchmarks, and runs them. | 4 """Parses the command line, discovers the appropriate benchmarks, and runs them. |
5 | 5 |
6 Handles benchmark configuration, but all the logic for | 6 Handles benchmark configuration, but all the logic for |
7 actually running the benchmark is in Benchmark and PageRunner.""" | 7 actually running the benchmark is in Benchmark and PageRunner.""" |
8 | 8 |
9 import argparse | 9 import argparse |
10 import logging | 10 import logging |
11 import os | 11 import os |
12 import sys | 12 import sys |
13 | 13 |
14 from telemetry import benchmark | 14 from telemetry import benchmark |
15 from telemetry import decorators | 15 from telemetry import decorators |
16 from telemetry.internal.browser import browser_finder | 16 from telemetry.internal.browser import browser_finder |
17 from telemetry.internal.browser import browser_options | 17 from telemetry.internal.browser import browser_options |
18 from telemetry.internal.util import binary_manager | 18 from telemetry.internal.util import binary_manager |
19 from telemetry.internal.util import command_line | 19 from telemetry.internal.util import command_line |
20 from telemetry.internal.util import ps_util | 20 from telemetry.internal.util import ps_util |
| 21 from telemetry.internal.util import log_stream |
21 from telemetry.util import matching | 22 from telemetry.util import matching |
22 | 23 |
23 from py_utils import discover | 24 from py_utils import discover |
24 | 25 |
25 # Right now, we only have one of each of our power perf bots. This means that | 26 # Right now, we only have one of each of our power perf bots. This means that |
26 # all eligible Telemetry benchmarks are run unsharded, which results in very | 27 # all eligible Telemetry benchmarks are run unsharded, which results in very |
27 # long (12h) cycle times. We'd like to reduce the number of tests that we run | 28 # long (12h) cycle times. We'd like to reduce the number of tests that we run |
28 # on each bot drastically until we get more of the same hardware to shard tests | 29 # on each bot drastically until we get more of the same hardware to shard tests |
29 # with, but we can't do so until we've verified that the hardware configuration | 30 # with, but we can't do so until we've verified that the hardware configuration |
30 # is a viable one for Chrome Telemetry tests. This is done by seeing at least | 31 # is a viable one for Chrome Telemetry tests. This is done by seeing at least |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 return None | 280 return None |
280 return matched[0] | 281 return matched[0] |
281 | 282 |
282 | 283 |
283 def main(environment, extra_commands=None, **log_config_kwargs): | 284 def main(environment, extra_commands=None, **log_config_kwargs): |
284 # The log level is set in browser_options. | 285 # The log level is set in browser_options. |
285 # Clear the log handlers to ensure we can set up logging properly here. | 286 # Clear the log handlers to ensure we can set up logging properly here. |
286 logging.getLogger().handlers = [] | 287 logging.getLogger().handlers = [] |
287 log_config_kwargs.pop('level', None) | 288 log_config_kwargs.pop('level', None) |
288 log_config_kwargs.setdefault('format', DEFAULT_LOG_FORMAT) | 289 log_config_kwargs.setdefault('format', DEFAULT_LOG_FORMAT) |
| 290 stream = log_stream.InitiateLogStream() |
| 291 log_config_kwargs.setdefault('stream', stream) |
289 logging.basicConfig(**log_config_kwargs) | 292 logging.basicConfig(**log_config_kwargs) |
290 | 293 |
291 ps_util.EnableListingStrayProcessesUponExitHook() | 294 ps_util.EnableListingStrayProcessesUponExitHook() |
292 | 295 |
293 # Get the command name from the command line. | 296 # Get the command name from the command line. |
294 if len(sys.argv) > 1 and sys.argv[1] == '--help': | 297 if len(sys.argv) > 1 and sys.argv[1] == '--help': |
295 sys.argv[1] = 'help' | 298 sys.argv[1] = 'help' |
296 | 299 |
297 command_name = 'run' | 300 command_name = 'run' |
298 for arg in sys.argv[1:]: | 301 for arg in sys.argv[1:]: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 command.ProcessCommandLineArgs(parser, options, environment) | 348 command.ProcessCommandLineArgs(parser, options, environment) |
346 | 349 |
347 if command == Help: | 350 if command == Help: |
348 command_instance = command(all_commands) | 351 command_instance = command(all_commands) |
349 else: | 352 else: |
350 command_instance = command() | 353 command_instance = command() |
351 if isinstance(command_instance, command_line.OptparseCommand): | 354 if isinstance(command_instance, command_line.OptparseCommand): |
352 return command_instance.Run(options) | 355 return command_instance.Run(options) |
353 else: | 356 else: |
354 return command_instance.Run(options, args) | 357 return command_instance.Run(options, args) |
OLD | NEW |