[tools] Flexible perf runner path.

Improved flexibility for the perf runner, by adding option to
specify precisely shell binary.

NOTRY=true

Review URL: https://codereview.chromium.org/1659483003

Cr-Commit-Position: refs/heads/master@{#33649}
This commit is contained in:
mtrofin 2016-02-01 12:27:23 -08:00 committed by Commit bot
parent 6298f4fc5b
commit 0eb083155c

View File

@ -350,9 +350,9 @@ class Node(object):
class DefaultSentinel(Node):
"""Fake parent node with all default values."""
def __init__(self):
def __init__(self, binary = "d8"):
super(DefaultSentinel, self).__init__()
self.binary = "d8"
self.binary = binary
self.run_count = 10
self.timeout = 60
self.path = []
@ -543,11 +543,10 @@ def MakeGraphConfig(suite, arch, parent):
raise Exception("Invalid suite configuration.")
def BuildGraphConfigs(suite, arch, parent=None):
def BuildGraphConfigs(suite, arch, parent):
"""Builds a tree structure of graph objects that corresponds to the suite
configuration.
"""
parent = parent or DefaultSentinel()
# TODO(machenbach): Implement notion of cpu type?
if arch not in suite.get("archs", SUPPORTED_ARCHS):
@ -813,6 +812,11 @@ def Main(args):
default="out")
parser.add_option("--outdir-no-patch",
help="Base directory with compile output without patch")
parser.add_option("--binary-override-path",
help="JavaScript engine binary. By default, d8 under "
"architecture-specific build dir. "
"Not supported in conjunction with outdir-no-patch.")
(options, args) = parser.parse_args(args)
if len(args) == 0: # pragma: no cover
@ -843,7 +847,18 @@ def Main(args):
else:
build_config = "%s.release" % options.arch
options.shell_dir = os.path.join(workspace, options.outdir, build_config)
if options.binary_override_path == None:
options.shell_dir = os.path.join(workspace, options.outdir, build_config)
default_binary_name = "d8"
else:
if not os.path.isfile(options.binary_override_path):
print "binary-override-path must be a file name"
return 1
if options.outdir_no_patch:
print "specify either binary-override-path or outdir-no-patch"
return 1
options.shell_dir = os.path.dirname(options.binary_override_path)
default_binary_name = os.path.basename(options.binary_override_path)
if options.outdir_no_patch:
options.shell_dir_no_patch = os.path.join(
@ -872,7 +887,8 @@ def Main(args):
platform.PreExecution()
# Build the graph/trace tree structure.
root = BuildGraphConfigs(suite, options.arch)
default_parent = DefaultSentinel(default_binary_name)
root = BuildGraphConfigs(suite, options.arch, default_parent)
# Callback to be called on each node on traversal.
def NodeCB(node):