[Buildbot-commits] buildbot/buildbot/test runutils.py, 1.4, 1.5 test_properties.py, 1.3, 1.4

Brian Warner warner at users.sourceforge.net
Mon May 29 00:10:40 UTC 2006


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

Modified Files:
	runutils.py test_properties.py 
Log Message:
[project @ improve test_properties, mitigate the occasional lockup against Twisted-1.3.0]

Original author: warner at lothar.com
Date: 2006-05-29 00:06:27

Index: runutils.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/runutils.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- runutils.py	22 May 2006 00:35:26 -0000	1.4
+++ runutils.py	29 May 2006 00:10:38 -0000	1.5
@@ -8,7 +8,7 @@
 from buildbot.slave import bot
 from buildbot.process.base import BuildRequest
 from buildbot.sourcestamp import SourceStamp
-from buildbot.status.builder import SUCCESS
+from buildbot.status import builder
 
 class MyBot(bot.Bot):
     def remote_getSlaveInfo(self):
@@ -106,9 +106,26 @@
         return req.waitUntilFinished()
 
     def failUnlessBuildSucceeded(self, bs):
-        self.failUnless(bs.getResults() == SUCCESS)
+        if bs.getResults() != builder.SUCCESS:
+            log.msg("failUnlessBuildSucceeded noticed that the build failed")
+            self.logBuildResults(bs)
+        self.failUnless(bs.getResults() == builder.SUCCESS)
         return bs # useful for chaining
 
+    def logBuildResults(self, bs):
+        # emit the build status and the contents of all logs to test.log
+        log.msg("logBuildResults starting")
+        log.msg(" bs.getResults() == %s" % builder.Results[bs.getResults()])
+        log.msg(" bs.isFinished() == %s" % bs.isFinished())
+        for s in bs.getSteps():
+            for l in s.getLogs():
+                log.msg("--- START step %s / log %s ---" % (s.getName(),
+                                                            l.getName()))
+                if not l.getName().endswith(".html"):
+                    log.msg(l.getTextWithHeaders())
+                log.msg("--- STOP ---")
+        log.msg("logBuildResults finished")
+
     def tearDown(self):
         log.msg("doing tearDown")
         d = self.shutdownAllSlaves()

Index: test_properties.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_properties.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_properties.py	23 May 2006 16:29:55 -0000	1.3
+++ test_properties.py	29 May 2006 00:10:38 -0000	1.4
@@ -128,10 +128,20 @@
 c['schedulers'] = []
 c['slavePortnum'] = 0
 
+# Note: when run against twisted-1.3.0, this locks up about 5% of the time. I
+# suspect that a command with no output that finishes quickly triggers a race
+# condition in 1.3.0's process-reaping code. The 'touch' process becomes a
+# zombie and the step never completes. To keep this from messing up the unit
+# tests too badly, this step runs with a reduced timeout.
+
 f1 = factory.BuildFactory([s(step.ShellCommand,
+                             flunkOnFailure=True,
                              command=['touch',
                                       WithProperties('%s-slave', 'slavename'),
-                                      ])])
+                                      ],
+                             workdir='.',
+                             timeout=10,
+                             )])
 
 b1 = {'name': 'full1', 'slavename': 'bot1', 'builddir': 'bd1', 'factory': f1}
 c['builders'] = [b1]
@@ -146,6 +156,11 @@
         d.addCallback(lambda res: self.connectOneSlave("bot1"))
         d.addCallback(lambda res: self.requestBuild("full1"))
         d.addCallback(self.failUnlessBuildSucceeded)
+        def _check_touch(res):
+            f = os.path.join("slavebase-bot1", "bd1", "bot1-slave")
+            self.failUnless(os.path.exists(f))
+            return res
+        d.addCallback(_check_touch)
         return maybeWait(d)
 
 





More information about the Commits mailing list