Index: zorg/buildbot/commands/LitTestCommand.py =================================================================== --- zorg/buildbot/commands/LitTestCommand.py +++ zorg/buildbot/commands/LitTestCommand.py @@ -58,21 +58,24 @@ # 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( - name_part[0].strip() + name_part[1] + basename(name_part[2]), + + if self.activeVerboseLog is not None: + self.step.logs[-1]=( + code + ': ' + name_part[0].strip() + name_part[1] + basename(name_part[2]), + '\n'.join(self.activeVerboseLog)) + # If a verbose log was not provided, just add a one line description. + else: + self.activeVerboseLog = ['%s: %s' % (code, name)] + self.step.addCompleteLog( + code + ': ' + name_part[0].strip() + name_part[1] + basename(name_part[2]), '\n'.join(self.activeVerboseLog)) - self.numLogs += 1 + self.numLogs += 1 # Reset the current state. - self.lastTestResult = None self.activeVerboseLog = None def outLineReceived(self, line): @@ -93,13 +96,7 @@ "error: verbose log output name didn't match expected test name") return - # Otherwise, if we had any previous test consider it finished. - # - # FIXME: This assumes that we will always have at least one line following - # the last test result to properly record each test; we could fix this if - # buildbot provided us a hook for when the log is done. - if self.lastTestResult: - self.testInfoFinished() + self.lastTestResult = None if self.kStartSummaryRE.match(line): self.parserStarted = True; @@ -113,6 +110,7 @@ # 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 class LitTestCommand(Test): @@ -188,7 +186,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 +200,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 +231,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()