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

Side by Side Diff: tools/telemetry/telemetry/benchmark_runner.py

Issue 1280903003: Add dependency_manager initialization to binary_manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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 4
5 """Parses the command line, discovers the appropriate benchmarks, and runs them. 5 """Parses the command line, discovers the appropriate benchmarks, and runs them.
6 6
7 Handles benchmark configuration, but all the logic for 7 Handles benchmark configuration, but all the logic for
8 actually running the benchmark is in Benchmark and PageRunner.""" 8 actually running the benchmark is in Benchmark and PageRunner."""
9 9
10 import hashlib 10 import hashlib
11 import inspect 11 import inspect
12 import json 12 import json
13 import os 13 import os
14 import sys 14 import sys
15 15
16 from telemetry import benchmark 16 from telemetry import benchmark
17 from telemetry.core import discover 17 from telemetry.core import discover
18 from telemetry import decorators 18 from telemetry import decorators
19 from telemetry.internal.browser import browser_finder 19 from telemetry.internal.browser import browser_finder
20 from telemetry.internal.browser import browser_options 20 from telemetry.internal.browser import browser_options
21 from telemetry.internal.util import binary_manager
21 from telemetry.internal.util import command_line 22 from telemetry.internal.util import command_line
22 23
23 24
24 def PrintBenchmarkList(benchmarks, possible_browser, output_pipe=sys.stdout): 25 def PrintBenchmarkList(benchmarks, possible_browser, output_pipe=sys.stdout):
25 """ Print benchmarks that are not filtered in the same order of benchmarks in 26 """ Print benchmarks that are not filtered in the same order of benchmarks in
26 the |benchmarks| list. 27 the |benchmarks| list.
27 28
28 Args: 29 Args:
29 benchmarks: the list of benchmarks to be printed (in the same order of the 30 benchmarks: the list of benchmarks to be printed (in the same order of the
30 list). 31 list).
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 69
69 class ProjectConfig(object): 70 class ProjectConfig(object):
70 """Contains information about the benchmark runtime environment. 71 """Contains information about the benchmark runtime environment.
71 72
72 Attributes: 73 Attributes:
73 top_level_dir: A dir that contains benchmark, page test, and/or story 74 top_level_dir: A dir that contains benchmark, page test, and/or story
74 set dirs and associated artifacts. 75 set dirs and associated artifacts.
75 benchmark_dirs: A list of dirs containing benchmarks. 76 benchmark_dirs: A list of dirs containing benchmarks.
76 benchmark_aliases: A dict of name:alias string pairs to be matched against 77 benchmark_aliases: A dict of name:alias string pairs to be matched against
77 exactly during benchmark selection. 78 exactly during benchmark selection.
79 dependency_config: A path to a ProjectDependencies json file.
80 TODO(aiolos): Add link to description/example of a ProjectDependency file.
eakuefner 2015/08/10 17:07:03 Can you move the todo out of the docstring itself?
aiolos (Not reviewing) 2015/08/10 20:37:26 Done.
78 """ 81 """
79 def __init__(self, top_level_dir, benchmark_dirs=None, 82 def __init__(self, top_level_dir, benchmark_dirs=None,
80 benchmark_aliases=None): 83 benchmark_aliases=None, dependency_config=None):
81 self._top_level_dir = top_level_dir 84 self._top_level_dir = top_level_dir
82 self._benchmark_dirs = benchmark_dirs or [] 85 self._benchmark_dirs = benchmark_dirs or []
83 self._benchmark_aliases = benchmark_aliases or dict() 86 self._benchmark_aliases = benchmark_aliases or dict()
84 87 self._dependency_config = dependency_config
85 if benchmark_aliases:
86 self._benchmark_aliases = benchmark_aliases
87 else:
88 self._benchmark_aliases = {}
89 88
90 @property 89 @property
91 def top_level_dir(self): 90 def top_level_dir(self):
92 return self._top_level_dir 91 return self._top_level_dir
93 92
94 @property 93 @property
95 def benchmark_dirs(self): 94 def benchmark_dirs(self):
96 return self._benchmark_dirs 95 return self._benchmark_dirs
97 96
98 @property 97 @property
99 def benchmark_aliases(self): 98 def benchmark_aliases(self):
100 return self._benchmark_aliases 99 return self._benchmark_aliases
101 100
101 @property
102 def dependency_config(self):
103 return self._dependency_config
102 104
103 class Help(command_line.OptparseCommand): 105 class Help(command_line.OptparseCommand):
104 """Display help information about a command""" 106 """Display help information about a command"""
105 107
106 usage = '[command]' 108 usage = '[command]'
107 109
108 def Run(self, args): 110 def Run(self, args):
109 if len(args.positional_args) == 1: 111 if len(args.positional_args) == 1:
110 commands = _MatchingCommands(args.positional_args[0]) 112 commands = _MatchingCommands(args.positional_args[0])
111 if len(commands) == 1: 113 if len(commands) == 1:
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 % (command_name, _ScriptName())) 403 % (command_name, _ScriptName()))
402 for command in commands: 404 for command in commands:
403 print >> sys.stderr, ' %-10s %s' % ( 405 print >> sys.stderr, ' %-10s %s' % (
404 command.Name(), command.Description()) 406 command.Name(), command.Description())
405 return 1 407 return 1
406 if commands: 408 if commands:
407 command = commands[0] 409 command = commands[0]
408 else: 410 else:
409 command = Run 411 command = Run
410 412
413 binary_manager.InitDependencyManager(environment.dependency_config)
414
411 # Parse and run the command. 415 # Parse and run the command.
412 parser = command.CreateParser() 416 parser = command.CreateParser()
413 command.AddCommandLineArgs(parser, environment) 417 command.AddCommandLineArgs(parser, environment)
414 options, args = parser.parse_args() 418 options, args = parser.parse_args()
415 if commands: 419 if commands:
416 args = args[1:] 420 args = args[1:]
417 options.positional_args = args 421 options.positional_args = args
418 command.ProcessCommandLineArgs(parser, options, environment) 422 command.ProcessCommandLineArgs(parser, options, environment)
419 return command().Run(options) 423 return command().Run(options)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698