Skip to content

Commit

Permalink
Add additional regex check for crashes.
Browse files Browse the repository at this point in the history
Check for DCHECK fatal crashes.

Bug: 1191453,1191716
Change-Id: I45874bdcb65e3268510c6106f70ab6218cefe656
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2785974
Reviewed-by: Chan Li <chanli@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: benjamin joyce <bjoyce@chromium.org>
Cr-Commit-Position: refs/heads/master@{#866674}
  • Loading branch information
Ben Joyce authored and Chromium LUCI CQ committed Mar 25, 2021
1 parent 4ba91c4 commit d26b913
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
18 changes: 12 additions & 6 deletions build/android/pylib/gtest/gtest_test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@
# Crash detection constants.
_RE_TEST_ERROR = re.compile(r'FAILURES!!! Tests run: \d+,'
r' Failures: \d+, Errors: 1')
_RE_TEST_CURRENTLY_RUNNING = re.compile(r'\[ERROR:.*?\]'
r' Currently running: (.*)')
_RE_TEST_CURRENTLY_RUNNING = re.compile(
r'\[ERROR:.*?\] Currently running: (.*)')
_RE_TEST_DCHECK_FATAL = re.compile(r'\[.*:FATAL:.*\] (.*)')
_RE_DISABLED = re.compile(r'DISABLED_')
_RE_FLAKY = re.compile(r'FLAKY_')

Expand Down Expand Up @@ -202,10 +203,15 @@ def handle_possibly_unknown_test():
duration = int(matcher.group(3)) if matcher.group(3) else 0

else:
# Needs another matcher here to match crashes, like those of DCHECK.
matcher = _RE_TEST_CURRENTLY_RUNNING.match(l)
if matcher:
test_name = matcher.group(1)
# Can possibly add more matchers, such as different results from DCHECK.
currently_running_matcher = _RE_TEST_CURRENTLY_RUNNING.match(l)
dcheck_matcher = _RE_TEST_DCHECK_FATAL.match(l)

if currently_running_matcher:
test_name = currently_running_matcher.group(1)
result_type = base_test_result.ResultType.CRASH
duration = 0 # Don't know.
elif dcheck_matcher:
result_type = base_test_result.ResultType.CRASH
duration = 0 # Don't know.

Expand Down
11 changes: 11 additions & 0 deletions build/android/pylib/gtest/gtest_test_instance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ def testParseGTestOutput_errorCrash(self):
self.assertEquals(0, actual[0].GetDuration())
self.assertEquals(base_test_result.ResultType.CRASH, actual[0].GetType())

def testParseGTestOutput_fatalDcheck(self):
raw_output = [
'[ RUN ] FooTest.Bar',
'[0324/183029.116334:FATAL:test_timeouts.cc(103)] Check failed: !init',
]
actual = gtest_test_instance.ParseGTestOutput(raw_output, None, None)
self.assertEquals(1, len(actual))
self.assertEquals('FooTest.Bar', actual[0].GetName())
self.assertEquals(0, actual[0].GetDuration())
self.assertEquals(base_test_result.ResultType.CRASH, actual[0].GetType())

def testParseGTestOutput_unknown(self):
raw_output = [
'[ RUN ] FooTest.Bar',
Expand Down

0 comments on commit d26b913

Please sign in to comment.