Commit d5ef815c authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[test] Pull exit-code logic to shared base runner

This makes the test runner and numfuzz share the same exit code behavior on
errors. This is needed as they also share the same infrastructure logic
to collect swarming tasks.

Bug: chromium:937228
Change-Id: I155b37c7b10dd22959a4dcf30bbd0321c452236b
Reviewed-on: https://chromium-review.googlesource.com/c/1495987Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59976}
parent e97dfa67
...@@ -270,7 +270,12 @@ class BaseTestRunner(object): ...@@ -270,7 +270,12 @@ class BaseTestRunner(object):
self._setup_env() self._setup_env()
print(">>> Running tests for %s.%s" % (self.build_config.arch, print(">>> Running tests for %s.%s" % (self.build_config.arch,
self.mode_name)) self.mode_name))
return self._do_execute(tests, args, options) exit_code = self._do_execute(tests, args, options)
if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
print("Force exit code 0 after failures. Json test results file "
"generated with failure information.")
exit_code = utils.EXIT_CODE_PASS
return exit_code
except TestRunnerError: except TestRunnerError:
traceback.print_exc() traceback.print_exc()
return utils.EXIT_CODE_INTERNAL_ERROR return utils.EXIT_CODE_INTERNAL_ERROR
......
...@@ -342,13 +342,7 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -342,13 +342,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
exit_code = utils.EXIT_CODE_NO_TESTS exit_code = utils.EXIT_CODE_NO_TESTS
# Indicate if a SIGINT or SIGTERM happened. # Indicate if a SIGINT or SIGTERM happened.
exit_code = max(exit_code, sigproc.exit_code) return max(exit_code, sigproc.exit_code)
if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
print("Force exit code 0 after failures. Json test results file "
"generated with failure information.")
exit_code = utils.EXIT_CODE_PASS
return exit_code
def _create_predictable_filter(self): def _create_predictable_filter(self):
if not self.build_config.predictable: if not self.build_config.predictable:
......
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