From b060cf9b5d56366b6e505e81722004885f40cec6 Mon Sep 17 00:00:00 2001 From: warner Date: Sat, 15 Dec 2007 06:58:16 +0100 Subject: [PATCH] ShellCommand: record RemoteShellCommand args to, to get 'workdir' and 'env' and 'timeout'. Ought to fix #150. --- ChangeLog | 7 +++++++ buildbot/steps/shell.py | 2 ++ buildbot/test/test_steps.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/ChangeLog b/ChangeLog index b74f73e..ff42f68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-12-14 Brian Warner + + * buildbot/steps/shell.py (ShellCommand.__init__): stash the + RemoteShellCommands args too, so things like 'workdir' and 'env' + and 'timeout' are preserved. This ought to fix #150. + * buildbot/test/test_steps.py (Steps.testClone): test it + 2007-12-11 Brian Warner * buildbot/scripts/startup.py (launch): use twisted.__version__, diff --git a/buildbot/steps/shell.py b/buildbot/steps/shell.py index 4e8fdc4..bb5100f 100644 --- a/buildbot/steps/shell.py +++ b/buildbot/steps/shell.py @@ -116,6 +116,8 @@ class ShellCommand(LoggingBuildStep): # everything left over goes to the RemoteShellCommand kwargs['workdir'] = workdir # including a copy of 'workdir' self.remote_kwargs = kwargs + # we need to stash the RemoteShellCommand's args too + self.addFactoryArguments(**kwargs) def setDefaultWorkdir(self, workdir): rkw = self.remote_kwargs diff --git a/buildbot/test/test_steps.py b/buildbot/test/test_steps.py index 3351d81..68d5ad8 100644 --- a/buildbot/test/test_steps.py +++ b/buildbot/test/test_steps.py @@ -200,6 +200,36 @@ class Steps(unittest.TestCase): b = f.newBuild([req]) #for s in b.steps: print s.name + def failUnlessClones(self, s1, attrnames): + f1 = s1.getStepFactory() + f,args = f1 + s2 = f(**args) + for name in attrnames: + self.failUnlessEqual(getattr(s1, name), getattr(s2, name)) + + def clone(self, s1): + f1 = s1.getStepFactory() + f,args = f1 + s2 = f(**args) + return s2 + + def testClone(self): + s1 = shell.ShellCommand(command=["make", "test"], + timeout=1234, + workdir="here", + description="yo", + descriptionDone="yoyo", + env={'key': 'value'}, + want_stdout=False, + want_stderr=False, + logfiles={"name": "filename"}, + ) + shellparms = (buildstep.BuildStep.parms + + ("remote_kwargs description descriptionDone " + "command logfiles").split() ) + self.failUnlessClones(s1, shellparms) + + # test the various methods available to buildsteps def test_getProperty(self): -- 2.11.4.GIT