Commit 687e6ddf authored by machenbach's avatar machenbach Committed by Commit bot

[test] Make perf runner able to pass extra flags to d8.

TEST=tools/run_perf.py --arch x64 --extra-flags="--turbo --turbo-verify-allocation --turbo-greedy-regalloc" /path/to/SunSpider.json
BUG=484208
LOG=n
TBR=tandrii@chromium.org
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#28384}
parent 2111d18d
......@@ -310,13 +310,14 @@ class Runnable(Graph):
bench_dir = os.path.normpath(os.path.join(*self.path))
os.chdir(os.path.join(suite_dir, bench_dir))
def GetCommandFlags(self):
def GetCommandFlags(self, extra_flags=None):
suffix = ["--"] + self.test_flags if self.test_flags else []
return self.flags + [self.main] + suffix
return self.flags + (extra_flags or []) + [self.main] + suffix
def GetCommand(self, shell_dir):
def GetCommand(self, shell_dir, extra_flags=None):
# TODO(machenbach): This requires +.exe if run on windows.
return [os.path.join(shell_dir, self.binary)] + self.GetCommandFlags()
cmd = [os.path.join(shell_dir, self.binary)]
return cmd + self.GetCommandFlags(extra_flags=extra_flags)
def Run(self, runner):
"""Iterates over several runs and handles the output for all traces."""
......@@ -474,6 +475,7 @@ class Platform(object):
class DesktopPlatform(Platform):
def __init__(self, options):
self.shell_dir = options.shell_dir
self.extra_flags = options.extra_flags.split()
def PreExecution(self):
pass
......@@ -487,8 +489,10 @@ class DesktopPlatform(Platform):
def Run(self, runnable, count):
try:
output = commands.Execute(runnable.GetCommand(self.shell_dir),
timeout=runnable.timeout)
output = commands.Execute(
runnable.GetCommand(self.shell_dir, self.extra_flags),
timeout=runnable.timeout,
)
except OSError as e:
print ">>> OSError (#%d):" % (count + 1)
print e
......@@ -509,6 +513,7 @@ class AndroidPlatform(Platform): # pragma: no cover
def __init__(self, options):
self.shell_dir = options.shell_dir
self.extra_flags = options.extra_flags.split()
LoadAndroidBuildTools(options.android_build_tools)
if not options.device:
......@@ -596,7 +601,7 @@ class AndroidPlatform(Platform): # pragma: no cover
cache = cache_control.CacheControl(self.device)
cache.DropRamCaches()
binary_on_device = AndroidPlatform.DEVICE_DIR + runnable.binary
cmd = [binary_on_device] + runnable.GetCommandFlags()
cmd = [binary_on_device] + runnable.GetCommandFlags(self.extra_flags)
# Relative path to benchmark directory.
if runnable.path:
......@@ -636,6 +641,9 @@ def Main(args):
parser.add_option("--device",
help="The device ID to run Android tests on. If not given "
"it will be autodetected.")
parser.add_option("--extra-flags",
help="Additional flags to pass to the test executable",
default="")
parser.add_option("--json-test-results",
help="Path to a file for storing json results.")
parser.add_option("--outdir", help="Base directory with compile output",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment