Skip to content

Commit

Permalink
Update text in Source and ShellCommand's status on hookup.
Browse files Browse the repository at this point in the history
start does not set text in Source and ShellCommand's
status soon enough to be captured in the status
receiver's notification.  Setting the text here prepares
the status for being sent when start is called.

Set a default description and descriptionDone for
TreeSize to fix an error in a test.

Add a test to verify that a ShellCommand's step_status
text is correctly set at setup and after it is complete.
  • Loading branch information
chasephillips committed Feb 5, 2010
1 parent 7761c32 commit 559cfcc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions buildbot/steps/shell.py
Expand Up @@ -101,6 +101,13 @@ def __init__(self, workdir=None,
# we need to stash the RemoteShellCommand's args too
self.addFactoryArguments(**kwargs)

def setStepStatus(self, step_status):
LoggingBuildStep.setStepStatus(self, step_status)

# start doesn't set text soon enough to capture our description in
# the stepStarted status notification. Set text here so it's included.
self.step_status.setText(self.describe(False))

def setDefaultWorkdir(self, workdir):
rkw = self.remote_kwargs
rkw['workdir'] = rkw['workdir'] or workdir
Expand Down Expand Up @@ -221,6 +228,11 @@ class TreeSize(ShellCommand):
command = ["du", "-s", "-k", "."]
kib = None

def __init__(self, *args, **kwargs):
kwargs.setdefault('description', 'taking tree size')
kwargs.setdefault('descriptionDone', 'tree sized')
ShellCommand.__init__(self, *args, **kwargs)

def commandComplete(self, cmd):
out = cmd.logs['stdio'].getText()
m = re.search(r'^(\d+)', out)
Expand Down
7 changes: 7 additions & 0 deletions buildbot/steps/source.py
Expand Up @@ -142,6 +142,13 @@ def __init__(self, workdir=None, mode='update', alwaysUseLatest=False,
self.description = description
self.descriptionDone = descriptionDone

def setStepStatus(self, step_status):
LoggingBuildStep.setStepStatus(self, step_status)

# start doesn't set text soon enough to capture our description in
# the stepStarted status notification. Set text here so it's included.
self.step_status.setText(self.describe(False))

def setDefaultWorkdir(self, workdir):
self.args['workdir'] = self.args['workdir'] or workdir

Expand Down
3 changes: 3 additions & 0 deletions buildbot/test/runs/test_steps.py
Expand Up @@ -714,6 +714,7 @@ def testCompile5(self):
warningExtractor=shell.Compile.warnExtractFromRegexpGroups,
suppressionFile="warnings.supp",
command=[sys.executable, "-c", printStatement])
self.failUnlessEqual(step.step_status.getText(), ['compiling'])
slavesrc = os.path.join(self.slavebase,
self.slavebuilderbase,
"build",
Expand All @@ -731,6 +732,8 @@ def _checkResult(result):
self.failUnlessEqual(len(lines), 2)
self.failUnlessEqual(lines[0].strip(), "baz.c:34: warning: `magic' defined but not used")
self.failUnlessEqual(lines[1].strip(), "foo.c:100: warning: `xyzzy' defined but not used")
self.failUnlessEqual(step.step_status.getText(), ['compile',
'warnings'])

d.addCallback(_checkResult)
return d
Expand Down

0 comments on commit 559cfcc

Please sign in to comment.