@@ -16,6 +16,8 @@ class LitLogObserver(LogLineObserver):
16
16
# output always immediately follow a test.
17
17
kTestVerboseLogStartRE = re .compile (r"""\*{4,80} TEST '(.*)' .*""" )
18
18
kTestVerboseLogStopRE = re .compile (r"""\*{10,80}""" )
19
+ kTestVerboseGTestUnitRE = re .compile (r'^(.*)\/(\d+)\/(\d+)$' )
20
+ kTestVerboseGTestPathRE = re .compile (r'^(.+)\s+--gtest_filter=(\w+).(\w+)(\s|$)' )
19
21
20
22
# These are the codes for which we will include the log output in the buildbot
21
23
# step results.
@@ -34,6 +36,8 @@ def __init__(self, maxLogs=None, parseSummaryOnly=False):
34
36
35
37
# If non-null, a list of lines in the current log.
36
38
self .activeVerboseLog = None
39
+ self .activeVerboseGTest = None
40
+
37
41
# Current line will be parsed as result steps only if parserStarted is True
38
42
self .parserStarted = not parseSummaryOnly
39
43
self .simplifiedLog = False
@@ -47,6 +51,10 @@ def handleVerboseLogLine(self, line):
47
51
# Append to the log.
48
52
self .activeVerboseLog .append (line )
49
53
54
+ m = self .kTestVerboseGTestPathRE .match (line .strip ())
55
+ if m :
56
+ self .activeVerboseGTest = [m .group (2 ), m .group (3 )]
57
+
50
58
# If this is a stop marker, process the test info.
51
59
if self .kTestVerboseLogStopRE .match (line .strip ()):
52
60
self .testInfoFinished ()
@@ -68,8 +76,15 @@ def testInfoFinished(self):
68
76
# Make the test name short, the qualified test name is in the log anyway.
69
77
# Otherwise, we run out of the allowed name length on some hosts.
70
78
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
+
71
86
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 ,
73
88
'\n ' .join (self .activeVerboseLog ))
74
89
self .numLogs += 1
75
90
else :
@@ -80,6 +95,7 @@ def testInfoFinished(self):
80
95
# Reset the current state.
81
96
self .lastTestResult = None
82
97
self .activeVerboseLog = None
98
+ self .activeVerboseGTest = None
83
99
84
100
def handleSimplifiedLogLine (self , line ):
85
101
# Check for test status line
0 commit comments