Commit 1754d8c4 authored by Caleb Rouleau's avatar Caleb Rouleau Committed by Commit Bot

[Benchmarking] fail gracefully and report accurately when gtests fail.

Bug: 1039019, 1040300
Change-Id: I2beaa0276d9481c3316b7719ba6ffc34723d94e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992807
Commit-Queue: Caleb Rouleau <crouleau@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Auto-Submit: Caleb Rouleau <crouleau@chromium.org>
Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729618}
parent afb96dd2
...@@ -282,8 +282,13 @@ def execute_gtest_perf_test(command_generator, output_paths, use_xvfb=False): ...@@ -282,8 +282,13 @@ def execute_gtest_perf_test(command_generator, output_paths, use_xvfb=False):
command, env, stdoutfile=output_paths.logs) command, env, stdoutfile=output_paths.logs)
else: else:
with open(output_paths.logs, 'w') as handle: with open(output_paths.logs, 'w') as handle:
return_code = test_env.run_command_output_to_handle( try:
command, handle, env=env) return_code = test_env.run_command_output_to_handle(
command, handle, env=env)
except OSError as e:
print('Command to run gtest perf test %s failed with an OSError: %s' %
e)
return_code = 1
if not os.path.exists(output_paths.perf_results): if not os.path.exists(output_paths.perf_results):
# Get the correct json format from the stdout to write to the perf # Get the correct json format from the stdout to write to the perf
# results file if gtest does not generate one. # results file if gtest does not generate one.
...@@ -296,12 +301,17 @@ def execute_gtest_perf_test(command_generator, output_paths, use_xvfb=False): ...@@ -296,12 +301,17 @@ def execute_gtest_perf_test(command_generator, output_paths, use_xvfb=False):
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
return_code = 1 return_code = 1
if command_generator.executable_name in GTEST_CONVERSION_WHITELIST: if os.path.exists(output_paths.perf_results):
with path_util.SysPath(path_util.GetTracingDir()): if command_generator.executable_name in GTEST_CONVERSION_WHITELIST:
# pylint: disable=no-name-in-module with path_util.SysPath(path_util.GetTracingDir()):
from tracing.value import gtest_json_converter # pylint: disable=no-name-in-module
# pylint: enable=no-name-in-module from tracing.value import gtest_json_converter
gtest_json_converter.ConvertGtestJsonFile(output_paths.perf_results) # pylint: enable=no-name-in-module
gtest_json_converter.ConvertGtestJsonFile(output_paths.perf_results)
else:
print('ERROR: gtest perf test %s did not generate perf output' %
output_paths.name)
return_code = 1
write_simple_test_results(return_code, output_paths.test_results, write_simple_test_results(return_code, output_paths.test_results,
output_paths.name) output_paths.name)
return return_code return return_code
......
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