android: fix gtest output parsing of type-parameterized tests.

Ran into this while investigating android_browsertests failures on
android-pie-x86-fyi-rel. A failing test w/ a TypeParam was being
incorrectly parsed as UNKNOWN despite clearly failing. This CL fixes
that case.

Change-Id: Iad47e1620b2f0b98348097302ca39a8342e1a116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028252
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#736462}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 94ea5a19945ac6479514668102b4a101f2d18ab4
This commit is contained in:
John Budorick 2020-01-29 18:47:35 +00:00 коммит произвёл Commit Bot
Родитель e129ba2a04
Коммит 1161395e72
2 изменённых файлов: 32 добавлений и 3 удалений

Просмотреть файл

@ -83,8 +83,14 @@ _RE_TEST_STATUS = re.compile(
r'\[ +((?:RUN)|(?:FAILED)|(?:OK)|(?:CRASHED)) +\] ?'
# Test name.
r'([^ ]+)?'
# Optional test parameter.
r'(?:, where GetParam\(\) = [^()]*)?'
# Optional parameters.
r'(?:, where'
# Type parameter
r'(?: TypeParam = [^()]*(?: and)?)?'
# Value parameter
r'(?: GetParam\(\) = [^()]*)?'
# End of optional parameters.
')?'
# Optional test execution time.
r'(?: \((\d+) ms\))?$')
# Crash detection constants.

Просмотреть файл

@ -177,7 +177,18 @@ class GtestTestInstanceTests(unittest.TestCase):
self.assertEquals(1, actual[0].GetDuration())
self.assertEquals(base_test_result.ResultType.PASS, actual[0].GetType())
def testParseGTestOutput_parameterized(self):
def testParseGTestOutput_typeParameterized(self):
raw_output = [
'[ RUN ] Baz/FooTest.Bar/0',
'[ FAILED ] Baz/FooTest.Bar/0, where TypeParam = (1 ms)',
]
actual = gtest_test_instance.ParseGTestOutput(raw_output, None, None)
self.assertEquals(1, len(actual))
self.assertEquals('Baz/FooTest.Bar/0', actual[0].GetName())
self.assertEquals(1, actual[0].GetDuration())
self.assertEquals(base_test_result.ResultType.FAIL, actual[0].GetType())
def testParseGTestOutput_valueParameterized(self):
raw_output = [
'[ RUN ] Baz/FooTest.Bar/0',
'[ FAILED ] Baz/FooTest.Bar/0,' +
@ -189,6 +200,18 @@ class GtestTestInstanceTests(unittest.TestCase):
self.assertEquals(1, actual[0].GetDuration())
self.assertEquals(base_test_result.ResultType.FAIL, actual[0].GetType())
def testParseGTestOutput_typeAndValueParameterized(self):
raw_output = [
'[ RUN ] Baz/FooTest.Bar/0',
'[ FAILED ] Baz/FooTest.Bar/0,' +
' where TypeParam = and GetParam() = (1 ms)',
]
actual = gtest_test_instance.ParseGTestOutput(raw_output, None, None)
self.assertEquals(1, len(actual))
self.assertEquals('Baz/FooTest.Bar/0', actual[0].GetName())
self.assertEquals(1, actual[0].GetDuration())
self.assertEquals(base_test_result.ResultType.FAIL, actual[0].GetType())
def testParseGTestXML_none(self):
actual = gtest_test_instance.ParseGTestXML(None)
self.assertEquals([], actual)