[PATCH] [zorg] LitTestCommand aborts if Verbose log line is not preceded by a valid test status line.
Rick Foos
rfoos at codeaurora.org
Tue Apr 21 15:16:19 PDT 2015
Changed testInfoFinished so normal case is first.
http://reviews.llvm.org/D9091
Files:
zorg/buildbot/commands/LitTestCommand.py
Index: zorg/buildbot/commands/LitTestCommand.py
===================================================================
--- zorg/buildbot/commands/LitTestCommand.py
+++ zorg/buildbot/commands/LitTestCommand.py
@@ -53,24 +53,29 @@
def testInfoFinished(self):
# We have finished getting information for one test, handle it.
- code, name = self.lastTestResult
+ if self.lastTestResult:
+ code, name = self.lastTestResult
- # If the test failed, add a log entry for it (unless we have reached the
- # max).
- if code in self.failingCodes and (self.maxLogs is None or
- self.numLogs < self.maxLogs):
- # If a verbose log was not provided, just add a one line description.
- if self.activeVerboseLog is None:
- self.activeVerboseLog = ['%s: %s' % (code, name)]
-
- # Add the log to the build status.
- # Make the test name short, the qualified test name is in the log anyway.
- # Otherwise, we run out of the allowed name length on some hosts.
- name_part = name.rpartition('::')
- self.step.addCompleteLog(
- code + ': ' + name_part[0].strip() + name_part[1] + basename(name_part[2]),
- '\n'.join(self.activeVerboseLog))
- self.numLogs += 1
+ # If the test failed, add a log entry for it (unless we have reached the
+ # max).
+ if code in self.failingCodes and (self.maxLogs is None or
+ self.numLogs < self.maxLogs):
+ # If a verbose log was not provided, just add a one line description.
+ if self.activeVerboseLog is None:
+ self.activeVerboseLog = ['%s: %s' % (code, name)]
+
+ # Add the log to the build status.
+ # Make the test name short, the qualified test name is in the log anyway.
+ # Otherwise, we run out of the allowed name length on some hosts.
+ name_part = name.rpartition('::')
+ self.step.addCompleteLog(
+ code + ': ' + name_part[0].strip() + name_part[1] + basename(name_part[2]),
+ '\n'.join(self.activeVerboseLog))
+ self.numLogs += 1
+ else:
+ if self.activeVerboseLog:
+ self.activeVerboseLog.append(
+ "error: missing test status line, skipping log")
# Reset the current state.
self.lastTestResult = None
@@ -101,7 +106,11 @@
m = self.kTestVerboseLogStartRE.match(line.strip())
if m:
self.activeVerboseLog = [line]
- if m.group(1) != self.lastTestResult[1]:
+ if self.lastTestResult is None:
+ if self.activeVerboseLog:
+ self.activeVerboseLog.append(
+ "error: missing test line before verbose log start.")
+ elif m.group(1) != self.lastTestResult[1]:
# This is bogus, the verbose log test name doesn't match what we
# expect. Just note it in the log but otherwise accumulate as normal.
self.activeVerboseLog.append(
@@ -208,6 +217,20 @@
self.assertEqual(obs.resultCounts, { 'FAIL' : 1, 'TIMEOUT' : 1, 'PASS' : 2 })
self.assertEqual(obs.step.logs, [('FAIL: test-two', 'FAIL: test-two'), ('TIMEOUT: test-four', 'TIMEOUT: test-four')])
+ def test_missing_lastresult(self):
+ obs = self.parse_log("""
+FAIL: LLDB :: 10-breakpoint-by-address-multiple-hit-first-add-next
+********** TEST 'LLDB :: 10-breakpoint-by-address-multiple-hit-first-add-next' FAIL **********
+bla bla bla
+**********
+ TIMEOUT: LLDB :: 57-dlopen-breakpoint (51 of 57)
+ ********** TEST 'LLDB :: 57-dlopen-breakpoint' TIMEOUT **********
+ bla
+ **********
+""")
+
+ self.assertEqual(obs.resultCounts, {'TIMEOUT': 1})
+
def test_verbose_logs(self):
obs = self.parse_log("""
FAIL: test-one (1 of 3)
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9091.24177.patch
Type: text/x-patch
Size: 3820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150421/b2c6d178/attachment.bin>
More information about the llvm-commits
mailing list