Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Merge 1a074d6 into ed375ba
Browse files Browse the repository at this point in the history
  • Loading branch information
warcholprzemo committed May 11, 2018
2 parents ed375ba + 1a074d6 commit 317c174
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions master/buildbot/steps/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from twisted.python import log, failure
from twisted.spread import pb
from buildbot.process import buildstep
from buildbot.process.properties import Interpolate
from buildbot.status.results import SUCCESS, WARNINGS, FAILURE
from buildbot.status.logfile import STDOUT, STDERR
from buildbot import config
Expand Down Expand Up @@ -198,6 +199,8 @@ def _describe(self, done=False):
return ["???"]

words = self.command
if isinstance(words, Interpolate):
words = words.getRenderingFor(self.build).result
if isinstance(words, (str, unicode)):
words = words.split()

Expand Down
15 changes: 15 additions & 0 deletions master/buildbot/test/unit/test_steps_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
import re
import textwrap
from twisted.trial import unittest
from buildbot.process.properties import Interpolate
from buildbot.steps import shell
from buildbot.status.results import SKIPPED, SUCCESS, WARNINGS, FAILURE
from buildbot.status.results import EXCEPTION
from buildbot.test.util import steps, compat
from buildbot.test.util import config as configmixin
from buildbot.test.fake.fakebuild import FakeBuild
from buildbot.test.fake.remotecommand import ExpectShell, Expect
from buildbot.test.fake.remotecommand import ExpectRemoteRef
from buildbot import config
Expand Down Expand Up @@ -71,6 +73,19 @@ def test_constructor_args_validity(self):
lambda: shell.ShellCommand('build', "echo Hello World",
wrongArg1=1, wrongArg2='two'))

def test_describe_with_command_Interpolate(self):
bash_command = "sleep %d"
bash_command_arg = 60
expected_output = ["'sleep", "60'"]
build = FakeBuild()

command = Interpolate(bash_command, bash_command_arg)
step = shell.ShellCommand(command=command)
step.build = build
output = step.describe()

self.assertEqual(expected_output, output)

def test_describe_no_command(self):
step = shell.ShellCommand(workdir='build')
self.assertEqual((step.describe(), step.describe(done=True)),
Expand Down

0 comments on commit 317c174

Please sign in to comment.