Skip to content

Commit 0ceb1c5

Browse files
authored
Fixed incorrect parsing of the failed LLVM/Clang Unit test names (#73)
#49
1 parent f187d5a commit 0ceb1c5

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

zorg/buildbot/commands/LitTestCommand.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class LitLogObserver(LogLineObserver):
1616
# output always immediately follow a test.
1717
kTestVerboseLogStartRE = re.compile(r"""\*{4,80} TEST '(.*)' .*""")
1818
kTestVerboseLogStopRE = re.compile(r"""\*{10,80}""")
19+
kTestVerboseGTestUnitRE = re.compile(r'^(.*)\/(\d+)\/(\d+)$')
20+
kTestVerboseGTestPathRE = re.compile(r'^(.+)\s+--gtest_filter=(\w+).(\w+)(\s|$)')
1921

2022
# These are the codes for which we will include the log output in the buildbot
2123
# step results.
@@ -34,6 +36,8 @@ def __init__(self, maxLogs=None, parseSummaryOnly=False):
3436

3537
# If non-null, a list of lines in the current log.
3638
self.activeVerboseLog = None
39+
self.activeVerboseGTest = None
40+
3741
# Current line will be parsed as result steps only if parserStarted is True
3842
self.parserStarted = not parseSummaryOnly
3943
self.simplifiedLog = False
@@ -47,6 +51,10 @@ def handleVerboseLogLine(self, line):
4751
# Append to the log.
4852
self.activeVerboseLog.append(line)
4953

54+
m = self.kTestVerboseGTestPathRE.match(line.strip())
55+
if m:
56+
self.activeVerboseGTest = [m.group(2), m.group(3)]
57+
5058
# If this is a stop marker, process the test info.
5159
if self.kTestVerboseLogStopRE.match(line.strip()):
5260
self.testInfoFinished()
@@ -68,8 +76,15 @@ def testInfoFinished(self):
6876
# Make the test name short, the qualified test name is in the log anyway.
6977
# Otherwise, we run out of the allowed name length on some hosts.
7078
name_part = name.rpartition('::')
79+
name_part2 = basename(name_part[2])
80+
81+
if self.activeVerboseGTest:
82+
m = self.kTestVerboseGTestUnitRE.match(name_part[2].strip())
83+
if m:
84+
name_part2 = '/'.join([basename(m.group(1)),] + self.activeVerboseGTest)
85+
7186
self.step.addCompleteLog(
72-
code + ': ' + name_part[0].strip() + name_part[1] + basename(name_part[2]),
87+
code + ': ' + name_part[0].strip() + name_part[1] + name_part2,
7388
'\n'.join(self.activeVerboseLog))
7489
self.numLogs += 1
7590
else:
@@ -80,6 +95,7 @@ def testInfoFinished(self):
8095
# Reset the current state.
8196
self.lastTestResult = None
8297
self.activeVerboseLog = None
98+
self.activeVerboseGTest = None
8399

84100
def handleSimplifiedLogLine(self, line):
85101
# Check for test status line

0 commit comments

Comments
 (0)