[test] More robust perf runner with profiler option.
NOTRY=true Review URL: https://codereview.chromium.org/1341213002 Cr-Commit-Position: refs/heads/master@{#30731}
This commit is contained in:
parent
8d77f788e7
commit
18d2c58cfd
@ -121,6 +121,7 @@ SUPPORTED_ARCHS = ["arm",
|
||||
GENERIC_RESULTS_RE = re.compile(r"^RESULT ([^:]+): ([^=]+)= ([^ ]+) ([^ ]*)$")
|
||||
RESULT_STDDEV_RE = re.compile(r"^\{([^\}]+)\}$")
|
||||
RESULT_LIST_RE = re.compile(r"^\[([^\]]+)\]$")
|
||||
TOOLS_BASE = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def LoadAndroidBuildTools(path): # pragma: no cover
|
||||
@ -460,7 +461,7 @@ class RunnableConfig(GraphConfig):
|
||||
# TODO(machenbach): This requires +.exe if run on windows.
|
||||
extra_flags = extra_flags or []
|
||||
cmd = [os.path.join(shell_dir, self.binary)]
|
||||
if self.binary != 'd8' and '--prof' in self.extra_flags:
|
||||
if self.binary != 'd8' and '--prof' in extra_flags:
|
||||
print "Profiler supported only on a benchmark run with d8"
|
||||
return cmd + self.GetCommandFlags(extra_flags=extra_flags)
|
||||
|
||||
@ -645,18 +646,12 @@ class DesktopPlatform(Platform):
|
||||
if output.timed_out:
|
||||
print ">>> Test timed out after %ss." % runnable.timeout
|
||||
if '--prof' in self.extra_flags:
|
||||
if utils.GuessOS() == "linux":
|
||||
tick_tools = os.path.abspath(os.path.join(shell_dir, "..", "..",
|
||||
"tools",
|
||||
"linux-tick-processor"))
|
||||
elif utils.GuessOS() == "macos":
|
||||
tick_tools = os.path.abspath(os.path.join(shell_dir, "..", "..",
|
||||
"tools",
|
||||
"mac-tick-processor"))
|
||||
else:
|
||||
os_prefix = {"linux": "linux", "macos": "mac"}.get(utils.GuessOS())
|
||||
if os_prefix:
|
||||
tick_tools = os.path.join(TOOLS_BASE, "%s-tick-processor" % os_prefix)
|
||||
subprocess.check_call(tick_tools + " --only-summary", shell=True)
|
||||
else: # pragma: no cover
|
||||
print "Profiler option currently supported on Linux and Mac OS."
|
||||
prof_cmd = tick_tools + " --only-summary"
|
||||
subprocess.check_call(prof_cmd, shell=True)
|
||||
return output.stdout
|
||||
|
||||
|
||||
|
@ -10,7 +10,9 @@ from mock import DEFAULT
|
||||
from mock import MagicMock
|
||||
import os
|
||||
from os import path, sys
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
@ -129,6 +131,9 @@ class PerfTest(unittest.TestCase):
|
||||
self.assertEquals(dirs.pop(), args[0])
|
||||
os.chdir = MagicMock(side_effect=chdir)
|
||||
|
||||
subprocess.check_call = MagicMock()
|
||||
platform.system = MagicMock(return_value='Linux')
|
||||
|
||||
def _CallMain(self, *args):
|
||||
self._test_output = path.join(TEST_WORKSPACE, "results.json")
|
||||
all_args=[
|
||||
@ -448,6 +453,19 @@ class PerfTest(unittest.TestCase):
|
||||
(path.join("out-no-patch", "x64.release", "d7"), "--flag", "run.js"),
|
||||
)
|
||||
|
||||
def testWrongBinaryWithProf(self):
|
||||
test_input = dict(V8_JSON)
|
||||
self._WriteTestInput(test_input)
|
||||
self._MockCommand(["."], ["x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n"])
|
||||
self.assertEquals(0, self._CallMain("--extra-flags=--prof"))
|
||||
self._VerifyResults("test", "score", [
|
||||
{"name": "Richards", "results": ["1.234"], "stddev": ""},
|
||||
{"name": "DeltaBlue", "results": ["10657567.0"], "stddev": ""},
|
||||
])
|
||||
self._VerifyErrors([])
|
||||
self._VerifyMock(path.join("out", "x64.release", "d7"),
|
||||
"--flag", "--prof", "run.js")
|
||||
|
||||
def testUnzip(self):
|
||||
def Gen():
|
||||
for i in [1, 2, 3]:
|
||||
|
Loading…
Reference in New Issue
Block a user