[Buildbot-commits] buildbot/buildbot/process step_twisted.py, 1.82, 1.83

Brian Warner warner at users.sourceforge.net
Sun Aug 6 20:05:40 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/process
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17513/buildbot/process

Modified Files:
	step_twisted.py 
Log Message:
[project @ Trial: fall back to 'cat' if the slave is too old to use logfiles=]

Original author: warner at lothar.com
Date: 2006-08-06 20:03:51

Index: step_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step_twisted.py,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- step_twisted.py	20 Jun 2006 08:09:21 -0000	1.82
+++ step_twisted.py	6 Aug 2006 20:05:38 -0000	1.83
@@ -444,20 +444,47 @@
         else:
             self.command.extend(self.tests)
         log.msg("Trial.start: command is", self.command)
+
+        # if our slave is too old to understand logfiles=, fetch them
+        # manually. This is a fallback for the Twisted buildbot and some old
+        # buildslaves.
+        self._needToPullTestDotLog = False
+        if self.slaveVersionIsOlderThan("shell", "2.1"):
+            log.msg("Trial: buildslave %s is too old to accept logfiles=" %
+                    self.getSlaveName())
+            log.msg(" falling back to 'cat _trial_temp/test.log' instead")
+            self.logfiles = {}
+            self._needToPullTestDotLog = True
+
         ShellCommand.start(self)
 
 
+    def commandComplete(self, cmd):
+        if not self._needToPullTestDotLog:
+            return self._gotTestDotLog(cmd)
+
+        # if the buildslave was too old, pull test.log now
+        catcmd = ["cat", "_trial_temp/test.log"]
+        c2 = step.RemoteShellCommand(command=catcmd, workdir=self.workdir)
+        loog = self.addLog("test.log")
+        c2.useLog(loog, True, logfileName="stdio")
+        self.cmd = c2 # to allow interrupts
+        d = c2.run(self, self.remote)
+        d.addCallback(lambda res: self._gotTestDotLog(cmd))
+        return d
+
     def rtext(self, fmt='%s'):
         if self.reactor:
             rtext = fmt % self.reactor
             return rtext.replace("reactor", "")
         return ""
 
-
-    def commandComplete(self, cmd):
+    def _gotTestDotLog(self, cmd):
         # figure out all status, then let the various hook functions return
         # different pieces of it
 
+        # 'cmd' is the original trial command, so cmd.logs['stdio'] is the
+        # trial output. We don't have access to test.log from here.
         output = cmd.logs['stdio'].getText()
         counts = countFailedTests(output)
 





More information about the Commits mailing list