[PATCH] Fix the problem that the last test failure not always displayed on test summary page for LitTestCommand
Ying Chen
chying at google.com
Tue Mar 10 17:54:51 PDT 2015
Fix the problem that the last test failure not always displayed on test summary page for LitTestCommand
Summary:
- Bug http://b/19664754
- Use "Testing Failing" line as indicator, assert summary lines don't have verbose msg
- Output lines before above indicator still follow original logic
- Add failure code to summary display
http://reviews.llvm.org/D8229
Files:
zorg/buildbot/commands/LitTestCommand.py
Index: zorg/buildbot/commands/LitTestCommand.py
===================================================================
--- zorg/buildbot/commands/LitTestCommand.py
+++ zorg/buildbot/commands/LitTestCommand.py
@@ -36,6 +36,7 @@
self.activeVerboseLog = None
# Current line will be parsed as result steps only if parserStarted is True
self.parserStarted = not parseSummaryOnly
+ self.summaryLine = False
def hadFailure(self):
for code in self.failingCodes:
@@ -67,15 +68,29 @@
# Otherwise, we run out of the allowed name length on some hosts.
name_part = name.rpartition('::')
self.step.addCompleteLog(
- name_part[0].strip() + name_part[1] + basename(name_part[2]),
+ code + ': ' + name_part[0].strip() + name_part[1] + basename(name_part[2]),
'\n'.join(self.activeVerboseLog))
self.numLogs += 1
# Reset the current state.
self.lastTestResult = None
self.activeVerboseLog = None
+ def summaryLineReceived(self, line):
+ # Check for test status line
+ m = self.kTestLineRE.match(line.strip())
+ if m:
+ # Remember the last test result and update the result counts.
+ self.lastTestResult = (code, name) = m.groups()
+ self.resultCounts[code] = self.resultCounts.get(code, 0) + 1
+ self.testInfoFinished()
+ return
+
def outLineReceived(self, line):
+ # Assert - Lines after "Failing Test (\d)" will be summary line and will not contain verbose message
+ if self.summaryLine is True:
+ self.summaryLineReceived(line)
+ return
# If we are inside a verbose log, just accumulate lines until we reach the
# stop marker.
if self.activeVerboseLog is not None:
@@ -103,6 +118,7 @@
if self.kStartSummaryRE.match(line):
self.parserStarted = True;
+ self.summaryLine = True;
#Assign result line only if summary marker has been matched
#Or if all lines should be parsed
@@ -188,7 +204,7 @@
""")
self.assertEqual(obs.resultCounts, { 'FAIL' : 1, 'PASS' : 2 })
- self.assertEqual(obs.step.logs, [('test-two', 'FAIL: test-two')])
+ self.assertEqual(obs.step.logs, [('FAIL: test-two', 'FAIL: test-two')])
def test_verbose_logs(self):
obs = self.parse_log("""
@@ -202,12 +218,12 @@
self.assertEqual(obs.resultCounts, { 'FAIL' : 3 })
self.assertEqual(obs.step.logs, [
- ('test-one', 'FAIL: test-one'),
- ('test-two', """\
+ ('FAIL: test-one', 'FAIL: test-one'),
+ ('FAIL: test-two', """\
**** TEST 'test-two' FAILED ****
bla bla bla
**********"""),
- ('test-three', 'FAIL: test-three')])
+ ('FAIL: test-three', 'FAIL: test-three')])
class TestCommand(unittest.TestCase):
def parse_log(self, text, **kwargs):
@@ -233,7 +249,7 @@
FAIL: test-one (1 of 2)
FAIL: test-two (2 of 2)
""", max_logs=1)
- self.assertEqual(cmd.logObserver.step.logs, [('test-one', 'FAIL: test-one')])
+ self.assertEqual(cmd.logObserver.step.logs, [('FAIL: test-one', 'FAIL: test-one')])
if __name__ == '__main__':
unittest.main()
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8229.21667.patch
Type: text/x-patch
Size: 3104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150311/556cc8bc/attachment.bin>
More information about the llvm-commits
mailing list