[Buildbot-commits] buildbot/buildbot/test runutils.py, 1.28, 1.29 test_properties.py, 1.17, 1.18 test_run.py, 1.55, 1.56
Brian Warner
warner at users.sourceforge.net
Thu May 22 22:13:19 UTC 2008
- Previous message (by thread): [Buildbot-commits] buildbot/buildbot/process base.py, 1.82, 1.83 properties.py, 1.3, 1.4
- Next message (by thread): [Buildbot-commits] buildbot/buildbot buildset.py, 1.9, 1.10 interfaces.py, 1.65, 1.66 scheduler.py, 1.31, 1.32
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17668/buildbot/test
Modified Files:
runutils.py test_properties.py test_run.py
Log Message:
[project @ #124:schedulers-provide-properties.patch]
Make the scheduler classes actually provide properties to the buildsets
they submit. Triggerable schedulers also do a nice job of configurably
propagating properties from the triggering build.
Original author: dustin at v.igoro.us
Date: 2008-04-13 18:42:31+00:00
Index: runutils.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/runutils.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- runutils.py 22 May 2008 22:13:11 -0000 1.28
+++ runutils.py 22 May 2008 22:13:17 -0000 1.29
@@ -489,7 +489,8 @@
self.value = value
def start(self):
- _flags[self.flagname] = self.value
+ properties = self.build.getProperties()
+ _flags[self.flagname] = properties.render(self.value)
self.finished(builder.SUCCESS)
class TestFlagMixin:
Index: test_properties.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_properties.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- test_properties.py 22 May 2008 22:13:11 -0000 1.17
+++ test_properties.py 22 May 2008 22:13:17 -0000 1.18
@@ -25,15 +25,13 @@
botmaster = FakeBotMaster()
class FakeSlave:
slavename = "bot12"
- properties = Properties()
- properties.setProperty("slavename", slavename, "BuildSlave")
+ properties = Properties(slavename="bot12")
class FakeSlaveBuilder:
slave = FakeSlave()
def getSlaveCommandVersion(self, command, oldversion=None):
return "1.10"
class FakeScheduler:
name = "fakescheduler"
- properties = Properties(name=name)
class TestProperties(unittest.TestCase):
def setUp(self):
Index: test_run.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_run.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- test_run.py 22 Mar 2008 22:14:21 -0000 1.55
+++ test_run.py 22 May 2008 22:13:17 -0000 1.56
@@ -699,6 +699,108 @@
self.failIfFlagSet('triggeree_finished')
self.failIfFlagSet('triggerer_finished')
+class PropertyPropagation(RunMixin, TestFlagMixin, unittest.TestCase):
+ def setupTest(self, config, builders, checkFn):
+ self.clearFlags()
+ m = self.master
+ m.loadConfig(config)
+ m.readConfig = True
+ m.startService()
+
+ c = changes.Change("bob", ["Makefile", "foo/bar.c"], "changed stuff")
+ m.change_svc.addChange(c)
+
+ d = self.connectSlave(builders=builders)
+ d.addCallback(self.startTimer, 0.5, checkFn)
+ return d
+
+ def startTimer(self, res, time, next_fn):
+ d = defer.Deferred()
+ reactor.callLater(time, d.callback, None)
+ d.addCallback(next_fn)
+ return d
+
+ config_schprop = config_base + """
+from buildbot.scheduler import Scheduler
+from buildbot.steps.dummy import Dummy
+from buildbot.test.runutils import SetTestFlagStep
+from buildbot.process.properties import WithProperties
+c['schedulers'] = [
+ Scheduler('mysched', None, 0.1, ['flagcolor'], properties={'color':'red'}),
+]
+factory = factory.BuildFactory([
+ s(SetTestFlagStep, flagname='testresult',
+ value=WithProperties('color=%(color)s sched=%(scheduler)s')),
+ ])
+c['builders'] = [{'name': 'flagcolor', 'slavename': 'bot1',
+ 'builddir': 'test', 'factory': factory},
+ ]
+"""
+
+ def testScheduler(self):
+ def _check(res):
+ self.failUnlessEqual(self.getFlag('testresult'),
+ 'color=red sched=mysched')
+ return self.setupTest(self.config_schprop, ['flagcolor'], _check)
+
+ config_slaveprop = config_base + """
+from buildbot.scheduler import Scheduler
+from buildbot.steps.dummy import Dummy
+from buildbot.test.runutils import SetTestFlagStep
+from buildbot.process.properties import WithProperties
+c['schedulers'] = [
+ Scheduler('mysched', None, 0.1, ['flagcolor'])
+]
+c['slaves'] = [BuildSlave('bot1', 'sekrit', properties={'color':'orange'})]
+factory = factory.BuildFactory([
+ s(SetTestFlagStep, flagname='testresult',
+ value=WithProperties('color=%(color)s slavename=%(slavename)s')),
+ ])
+c['builders'] = [{'name': 'flagcolor', 'slavename': 'bot1',
+ 'builddir': 'test', 'factory': factory},
+ ]
+"""
+ def testSlave(self):
+ def _check(res):
+ self.failUnlessEqual(self.getFlag('testresult'),
+ 'color=orange slavename=bot1')
+ return self.setupTest(self.config_slaveprop, ['flagcolor'], _check)
+
+ config_trigger = config_base + """
+from buildbot.scheduler import Triggerable, Scheduler
+from buildbot.steps.trigger import Trigger
+from buildbot.steps.dummy import Dummy
+from buildbot.test.runutils import SetTestFlagStep
+from buildbot.process.properties import WithProperties
+c['schedulers'] = [
+ Scheduler('triggerer', None, 0.1, ['triggerer'],
+ properties={'color':'mauve', 'pls_trigger':'triggeree'}),
+ Triggerable('triggeree', ['triggeree'], properties={'color':'invisible'})
+]
+triggerer = factory.BuildFactory([
+ s(SetTestFlagStep, flagname='testresult', value='wrongone'),
+ s(Trigger, flunkOnFailure=True,
+ schedulerNames=[WithProperties('%(pls_trigger)s')],
+ set_properties={'color' : WithProperties('%(color)s')}),
+ s(SetTestFlagStep, flagname='testresult', value='triggered'),
+ ])
+triggeree = factory.BuildFactory([
+ s(SetTestFlagStep, flagname='testresult',
+ value=WithProperties('sched=%(scheduler)s color=%(color)s')),
+ ])
+c['builders'] = [{'name': 'triggerer', 'slavename': 'bot1',
+ 'builddir': 'triggerer', 'factory': triggerer},
+ {'name': 'triggeree', 'slavename': 'bot1',
+ 'builddir': 'triggeree', 'factory': triggeree}]
+"""
+ def testTrigger(self):
+ def _check(res):
+ self.failUnlessEqual(self.getFlag('testresult'),
+ 'sched=triggeree color=mauve')
+ return self.setupTest(self.config_trigger,
+ ['triggerer', 'triggeree'], _check)
+
+
config_test_flag = config_base + """
from buildbot.scheduler import Scheduler
c['schedulers'] = [Scheduler('quick', None, 0.1, ['dummy'])]
- Previous message (by thread): [Buildbot-commits] buildbot/buildbot/process base.py, 1.82, 1.83 properties.py, 1.3, 1.4
- Next message (by thread): [Buildbot-commits] buildbot/buildbot buildset.py, 1.9, 1.10 interfaces.py, 1.65, 1.66 scheduler.py, 1.31, 1.32
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commits
mailing list