[Buildbot-commits] buildbot/buildbot/test runutils.py,1.3,1.4 test_properties.py,1.1,1.2
Brian Warner
warner at users.sourceforge.net
Mon May 22 00:35:29 UTC 2006
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22712/buildbot/test
Modified Files:
runutils.py test_properties.py
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-557
Creator: Brian Warner <warner at lothar.com>
fix (and add test for) a serious build-properties bug in ShellCommand
* buildbot/process/step.py (ShellCommand.start): make
testInterpolate pass. I was passing the uninterpolated command to
the RemoteShellCommand constructor
* buildbot/test/test_properties.py (Run.testInterpolate): new test
to actually try to use build properties in a real build. This test
fails.
* buildbot/test/runutils.py (RunMixin.requestBuild): utility methods
to start and evaluate builds
Index: runutils.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/runutils.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- runutils.py 14 Oct 2005 19:42:39 -0000 1.3
+++ runutils.py 22 May 2006 00:35:26 -0000 1.4
@@ -6,6 +6,9 @@
from buildbot import master, interfaces
from buildbot.twcompat import maybeWait
from buildbot.slave import bot
+from buildbot.process.base import BuildRequest
+from buildbot.sourcestamp import SourceStamp
+from buildbot.status.builder import SUCCESS
class MyBot(bot.Bot):
def remote_getSlaveInfo(self):
@@ -94,6 +97,18 @@
d = self.master.botmaster.waitUntilBuilderAttached("dummy")
return d
+ # things to start builds
+ def requestBuild(self, builder):
+ # returns a Deferred that fires with an IBuildStatus object when the
+ # build is finished
+ req = BuildRequest("forced build", SourceStamp())
+ self.control.getBuilder(builder).requestBuild(req)
+ return req.waitUntilFinished()
+
+ def failUnlessBuildSucceeded(self, bs):
+ self.failUnless(bs.getResults() == SUCCESS)
+ return bs # useful for chaining
+
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.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_properties.py 24 Apr 2006 06:45:36 -0000 1.1
+++ test_properties.py 22 May 2006 00:35:26 -0000 1.2
@@ -4,11 +4,13 @@
from twisted.trial import unittest
+from buildbot.twcompat import maybeWait
from buildbot.sourcestamp import SourceStamp
from buildbot.process import base
from buildbot.process.step import ShellCommand, WithProperties
from buildbot.status import builder
from buildbot.slave.commands import rmdirRecursive
+from buildbot.test.runutils import RunMixin
class MyBuildStep(ShellCommand):
def _interpolateProperties(self, command):
@@ -105,4 +107,36 @@
["touch", "bot12-slave"])
+run_config = """
+from buildbot.process import step, factory
+from buildbot.process.step import ShellCommand, WithProperties
+s = factory.s
+
+BuildmasterConfig = c = {}
+c['bots'] = [('bot1', 'sekrit')]
+c['sources'] = []
+c['schedulers'] = []
+c['slavePortnum'] = 0
+
+f1 = factory.BuildFactory([s(step.ShellCommand,
+ command=['touch',
+ WithProperties('%s-slave', 'slavename'),
+ ])])
+
+b1 = {'name': 'full1', 'slavename': 'bot1', 'builddir': 'bd1', 'factory': f1}
+c['builders'] = [b1]
+
+"""
+
+class Run(RunMixin, unittest.TestCase):
+ def testInterpolate(self):
+ # run an actual build with a step that interpolates a build property
+ d = self.master.loadConfig(run_config)
+ d.addCallback(lambda res: self.master.startService())
+ d.addCallback(lambda res: self.connectOneSlave("bot1"))
+ d.addCallback(lambda res: self.requestBuild("full1"))
+ d.addCallback(self.failUnlessBuildSucceeded)
+ return maybeWait(d)
+
+
# we test got_revision in test_vc
More information about the Commits
mailing list