[testrunner] catch unforeseen exceptions

Testrunner doesn't catch exceptions except TestRunnererror, KeyboardInterrupt.

Unforeseen exceptions should fail the CI step.

This CL returns an error exit code for uncaught exceptions.

R=machenbach@chromium.org
CC=yangguo@chromium.org,sergiyb@chromium.org

Bug: v8:8731
Change-Id: I7fb20dad4a3eea29f1dfa87ef91d45381ee08692
Reviewed-on: https://chromium-review.googlesource.com/c/1434034
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59278}
This commit is contained in:
Tamer Tas 2019-02-01 10:18:33 +01:00 committed by Commit Bot
parent a9e93572d4
commit 101fd4ddb7
2 changed files with 5 additions and 7 deletions

View File

@ -10,6 +10,7 @@ import optparse
import os
import shlex
import sys
import traceback
# Add testrunner to the path.
@ -266,9 +267,13 @@ class BaseTestRunner(object):
self.mode_name))
return self._do_execute(tests, args, options)
except TestRunnerError:
traceback.print_exc()
return utils.EXIT_CODE_INTERNAL_ERROR
except KeyboardInterrupt:
return utils.EXIT_CODE_INTERRUPTED
except Exception:
traceback.print_exc()
return utils.EXIT_CODE_INTERNAL_ERROR
finally:
command.tear_down()

View File

@ -401,13 +401,6 @@ class SystemTest(unittest.TestCase):
self.assertIn('Failed to load build config', result.stdout, result)
self.assertEqual(5, result.returncode, result)
def testGNOption(self):
"""Test using gn option, but no gn build folder is found."""
with temp_base() as basedir:
# TODO(machenbach): This should fail gracefully.
with self.assertRaises(OSError):
run_tests(basedir, '--gn')
def testInconsistentMode(self):
"""Test failing run when attempting to wrongly override the mode."""
with temp_base() as basedir: