def test_render(self): self.setupStep(slave.RemoveDirectory(dir=properties.Property("x"))) self.properties.setProperty('x', 'XXX', 'here') self.expectCommands(Expect('rmdir', {'dir': 'XXX'}) + 0) self.expectOutcome(result=SUCCESS, status_text=["rmdir", "XXX"]) return self.runStep()
def test_success(self): self.setupStep(slave.RemoveDirectory(dir="d")) self.expectCommands(Expect('rmdir', {'dir': 'd'}) + 0) self.expectOutcome(result=SUCCESS, status_text=["rmdir", "d"]) return self.runStep()
def test_failure(self): self.setupStep(slave.RemoveDirectory(dir="d")) self.expectCommands(Expect('rmdir', {'dir': 'd'}) + 1) self.expectOutcome(result=FAILURE, status_text=["rmdir", "d", "failed"]) return self.runStep()
def gen_tarball_updated_factory(rooturl, nocheck=False, omega=True, bindings=True, configure_opts=[]): """ Make a factory for doing builds from tarballs. """ configure_cmd = [ "sh", "configure", ] + configure_opts f = factory.BuildFactory() f.addStep( shell.ShellCommand(command=[ "python", "-c", "try: import urllib2 as u\nexcept: import urllib.request as u\nopen('get_tarballs.py', 'wb').write(u.urlopen('%s').read())" % get_tarballs_url ], workdir='.', haltOnFailure=True)) f.addStep( shell.ShellCommand(command=["python", 'get_tarballs.py', rooturl], workdir='.', haltOnFailure=True)) f.addStep( shell.Configure(workdir='build/xapian-core', command=configure_cmd)) f.addStep(shell.Compile(workdir='build/xapian-core')) if not nocheck: f.addStep( shell.Test(workdir='build/xapian-core', name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) if omega: f.addStep( shell.Configure(workdir='build/xapian-omega', command=["./configure", xapian_config_arg] + configure_opts)) f.addStep(shell.Compile(workdir='build/xapian-omega')) if not nocheck: f.addStep( shell.Test(workdir='build/xapian-omega', name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) if bindings: f.addStep( shell.Configure(workdir='build/xapian-bindings', command=["./configure", xapian_config_arg] + configure_opts)) f.addStep( shell.Compile(workdir='build/xapian-bindings', command=["make"])) if not nocheck: f.addStep( shell.Test(workdir='build/xapian-bindings', name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) # If everything passed, there's not much point keeping the build - we'd # delete the old build tree and download new tarballs next time anyway. f.addStep(slave.RemoveDirectory('build')) return f
def __init__ ( self, baseURL, useBuildType=None, arguments=[]): """Factory for CMake out-of-source builds with extra buildbot code. Uses the following builder properties (strings) when generating a build: - generator: CMake generator - arguments: build-specific CMake arguments @cvar baseURL: url of the svn repository @cvar useBuildType: for multi-configuration generators (see CMAKE_BUILD_TYPE) @cvar arguments: extra CMake arguments """ assert baseURL is not None assert type(arguments) == type([]) from buildbot.steps import source, slave, shell from buildbot.process.properties import WithProperties, Property BuildFactory.__init__(self) if useBuildType is None: buildTypeArgument=[] else: buildTypeArgument=["--config", useBuildType] # update svn self.addStep(source.SVN( workdir=self.sourcedir, mode='update', baseURL=baseURL, defaultBranch='trunk', retry=(30,2) )) # recreate build dir self.addStep(slave.RemoveDirectory( dir=self.workdir, haltOnFailure=False, flunkOnFailure=False)) self.addStep(slave.MakeDirectory( dir=self.workdir)) # configure self.addStep(shell.Configure( command=["cmake", "../source", WithProperties("-G%s", 'generator'), arguments, Property('extra_arguments', default=[])], logEnviron=False)) # compile - the install target builds and then copies files to the # production directory (default is subdirectory 'install') and removes # full paths from library dependencies so it works when you copy the # production files elsewhere self.addStep(shell.Compile( command=["cmake", "--build", ".", "--target", "install"] + buildTypeArgument, logEnviron=False)) # package - the package target creates an installer/package/archive # that contains the production files; the target is only available if # CPack and a package generator are available self.addStep(shell.SetProperty( haltOnFailure = True, flunkOnFailure = True, extract_fn=lambda rc, stdout, stderr: {"WITH_CPACK": stdout.find("WITH_CPACK:BOOL=ON") != -1}, command=["cmake", "-N", "-LA"], logEnviron=False)) self.addStep(shell.ShellCommand( name = "Package", description = ["packaging"], descriptionDone = ["package"], haltOnFailure = False, flunkOnFailure = False, doStepIf=lambda step: step.build.getProperty("WITH_CPACK"), command=["cmake", "--build", ".", "--target", "package"] + buildTypeArgument, logEnviron=False))
def test_failure(self): self.setupStep(slave.RemoveDirectory(dir="d")) self.expectCommands(Expect('rmdir', {'dir': 'd'}) + 1) self.expectOutcome(result=FAILURE, state_string="Deleted (failure)") return self.runStep()
def test_success(self): self.setupStep(slave.RemoveDirectory(dir="d")) self.expectCommands(Expect('rmdir', {'dir': 'd'}) + 0) self.expectOutcome(result=SUCCESS, state_string="Deleted") return self.runStep()
def gen_rm_rf_factory(): f = factory.BuildFactory() f.addStep(slave.RemoveDirectory('build')) return f