Commit 0fdf0209 authored by Yuzhu Shen's avatar Yuzhu Shen Committed by Commit Bot

Update run_telemetry_benchmark_as_googletest to support --xvfb flag.

This CL follows how run_telemetry_as_googletest.py handles --xvfb flag.

BUG=717738

Change-Id: I0bb746d18be7818c782b7086ca96605a60af0761
Reviewed-on: https://chromium-review.googlesource.com/595227
Commit-Queue: Yuzhu Shen <yzshen@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491092}
parent 9d3e5061
...@@ -48,19 +48,11 @@ def main(): ...@@ -48,19 +48,11 @@ def main():
'--isolated-script-test-chartjson-output', required=False) '--isolated-script-test-chartjson-output', required=False)
parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') parser.add_argument('--xvfb', help='Start xvfb.', action='store_true')
args, rest_args = parser.parse_known_args() args, rest_args = parser.parse_known_args()
xvfb_proc = None
openbox_proc = None
xcompmgr_proc = None
env = os.environ.copy() env = os.environ.copy()
# Assume we want to set up the sandbox environment variables all the # Assume we want to set up the sandbox environment variables all the
# time; doing so is harmless on non-Linux platforms and is needed # time; doing so is harmless on non-Linux platforms and is needed
# all the time on Linux. # all the time on Linux.
env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH
if args.xvfb and xvfb.should_start_xvfb(env):
xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env,
build_dir='.')
assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb'
try:
tempfile_dir = tempfile.mkdtemp('telemetry') tempfile_dir = tempfile.mkdtemp('telemetry')
valid = True valid = True
failures = [] failures = []
...@@ -70,10 +62,15 @@ def main(): ...@@ -70,10 +62,15 @@ def main():
results = None results = None
try: try:
rc = common.run_command([sys.executable] + rest_args + [ cmd = [sys.executable] + rest_args + [
'--output-dir', tempfile_dir, '--output-dir', tempfile_dir,
'--output-format=json-test-results', '--output-format=json-test-results',
], env=env) ]
if args.xvfb:
rc = xvfb.run_executable(cmd, env)
else:
rc = common.run_command(cmd, env=env)
# If we have also output chartjson read it in and return it. # If we have also output chartjson read it in and return it.
# results-chart.json is the file name output by telemetry when the # results-chart.json is the file name output by telemetry when the
# chartjson output format is included # chartjson output format is included
...@@ -126,11 +123,6 @@ def main(): ...@@ -126,11 +123,6 @@ def main():
json.dump(json_test_results, args.isolated_script_test_output) json.dump(json_test_results, args.isolated_script_test_output)
return rc return rc
finally:
xvfb.kill(xvfb_proc)
xvfb.kill(openbox_proc)
xvfb.kill(xcompmgr_proc)
# This is not really a "script test" so does not need to manually add # This is not really a "script test" so does not need to manually add
# any additional compile targets. # any additional compile targets.
......
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