def gen_tarball_updated_factory(rooturl, nocheck=False, omega=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())" % 'http://trac.xapian.org/export/HEAD/trunk/xapian-maintainer-tools/buildbot/scripts/get_tarballs.py'], 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="])) 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 gen_tarball_updated_factory(rooturl, 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", "import urllib2;open('get_tarballs.py', 'wb').write(urllib2.urlopen('%s').read())" % 'http://trac.xapian.org/export/HEAD/trunk/xapian-maintainer-tools/buildbot/scripts/get_tarballs.py' ], workdir='.', haltOnFailure=True)) f.addStep( shell.ShellCommand(command=["python", 'get_tarballs.py'], workdir='.', haltOnFailure=True)) f.addStep( shell.Configure(workdir='build/xapian-core', command=configure_cmd)) f.addStep(shell.Compile(workdir='build/xapian-core')) f.addStep( shell.Test(workdir='build/xapian-core', name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) f.addStep( shell.Configure(workdir='build/xapian-omega', command=["./configure", xapian_config_arg] + configure_opts)) f.addStep(shell.Compile(workdir='build/xapian-omega')) f.addStep( shell.Test(workdir='build/xapian-omega', name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) 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"])) f.addStep( shell.Test(workdir='build/xapian-bindings', name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) return f
def gen_svn_updated_valgrind_factory(baseURL, configure_opts=[]): """ Factory for doing HEAD build from SVN, without cleaning first, and using valgrind to check. This one is much more expensive, so should be run with a higher stable time. """ f = factory.BuildFactory() f.addStep(source.SVN(baseURL=baseURL, defaultBranch='trunk', mode="update")) f.addStep(Bootstrap()) f.addStep( shell.Configure(command=["sh", "configure", "CXXFLAGS=-O0 -g"] + configure_opts)) f.addStep(shell.Compile()) f.addStep( shell.Test(name="check", command=["make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain"], workdir='build/xapian-core')) #for target in ("check-none", "check-inmemory", "check-remoteprog", # "check-chert"): # f.addStep(shell.Test(name=target, command = ["make", target, "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=/home/olly/install/bin/valgrind"], workdir='build/xapian-core')) # ## Currently, valgrind incorrectly reports leaked memory for the remotetcp ## backend, so check that one without using valgrind. #f.addStep(shell.Test(name="check-remotetcp", command = ["make", "check-remotetcp", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=/home/olly/install/bin/valgrind"], workdir='build/xapian-core')) return f
def gen_svn_updated_valgrind_factory(baseURL, configure_opts=[]): """ Factory for doing HEAD build from SVN, without cleaning first, and using valgrind to check. This one is much more expensive, so should be run with a higher stable time. """ f = factory.BuildFactory() f.addStep(source.SVN(baseURL=baseURL, defaultBranch='trunk', mode="update")) f.addStep(Bootstrap()) configure_opts.append("--disable-documentation") f.addStep( shell.Configure(command=["sh", "configure", "CXXFLAGS=-O0 -g"] + configure_opts)) f.addStep( QuietenLibtool([ 'xapian-core/libtool', 'xapian-applications/omega/libtool', 'xapian-bindings/libtool' ])) f.addStep(shell.Compile()) f.addStep( shell.Test(name="check", command=["make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain"], workdir='build/xapian-core')) return f
def gen_svn_debug_updated_factory(baseURL, opts, nocheck=False): """ Make a factory for doing a debug HEAD build from SVN, but without cleaning first. This build is intended to catch commonly made mistakes quickly. """ f = factory.BuildFactory() f.addStep(source.SVN(baseURL=baseURL, defaultBranch='trunk', mode="update")) f.addStep(Bootstrap()) opts.append("--disable-documentation") f.addStep(shell.Configure(command=[ "sh", "configure", ] + opts)) f.addStep( QuietenLibtool([ 'xapian-core/libtool', 'xapian-applications/omega/libtool', 'xapian-bindings/libtool' ])) f.addStep(shell.Compile()) if not nocheck: f.addStep( shell.Test(name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) return f
def core_factory(repourl, usedocs=False, configure=None, audit=False, clean=False, nocheck = False, configure_opts=None): f = factory.BuildFactory() mode = "update" if clean: #f.addStep(MakeWritable, workdir='.') f.addStep(shell.ShellCommand(command = ["chmod", "-R", "+w", "."], workdir='.')) mode = "clobber" f.addStep(source.Git(repourl=repourl, mode=mode)) if audit: f.addStep(shell.ShellCommand(command = ["python", 'audit.py'], workdir='build/xapian-maintainer-tools')) f.addStep(shell.ShellCommand(command = ["chmod", '644', 'copyright.csv', 'fixmes.csv'], workdir='build/xapian-maintainer-tools')) f.addStep(shell.ShellCommand(command = ["mv", 'copyright.csv', 'fixmes.csv', '/var/www/'], workdir='build/xapian-maintainer-tools')) f.addStep(Bootstrap()) if configure: f.addStep(shell.Configure(command=configure)) else: if configure_opts is None: configure_opts = [] if not usedocs: configure_opts.append("--disable-documentation") if configure_opts: f.addStep(shell.Configure(command=["sh", "configure"] + configure_opts)) else: f.addStep(shell.Configure()) f.addStep(shell.Compile()) if not nocheck: f.addStep(shell.Test(name="check", command=["make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND="])) return f
def test_describe_done(self): step = self.setupStep(shell.Test()) self.step_statistics['tests-total'] = 93 self.step_statistics['tests-failed'] = 10 self.step_statistics['tests-passed'] = 20 self.step_statistics['tests-warnings'] = 30 self.assertEqual(step.describe(done=True), ['test', '93 tests', '20 passed', '30 warnings', '10 failed'])
def test_describe_done_no_total(self): step = self.setupStep(shell.Test()) self.step_statistics['tests-total'] = 0 self.step_statistics['tests-failed'] = 10 self.step_statistics['tests-passed'] = 20 self.step_statistics['tests-warnings'] = 30 # describe calculates 60 = 10+20+30 self.assertEqual(step.describe(done=True), ['test', '60 tests', '20 passed', '30 warnings', '10 failed'])
def test_describe_done(self): step = self.setupStep(shell.Test()) step.rendered = True step.results = SUCCESS step.statistics['tests-total'] = 93 step.statistics['tests-failed'] = 10 step.statistics['tests-passed'] = 20 step.statistics['tests-warnings'] = 30 self.assertEqual(step.getResultSummary(), {'step': '93 tests 20 passed 30 warnings 10 failed'})
def test_describe_done_no_total(self): step = self.setup_step(shell.Test()) step.rendered = True step.results = SUCCESS step.statistics['tests-total'] = 0 step.statistics['tests-failed'] = 10 step.statistics['tests-passed'] = 20 step.statistics['tests-warnings'] = 30 # describe calculates 60 = 10+20+30 self.assertEqual(step.getResultSummary(), {'step': '60 tests 20 passed 30 warnings 10 failed'})
def gen_git_debug_updated_factory(repourl, opts, nocheck=False): """ Make a factory for doing a debug build from git master, but without cleaning first. This build is intended to catch commonly made mistakes quickly. """ f = factory.BuildFactory() f.addStep(source.Git(repourl=repourl, mode="update")) f.addStep(Bootstrap()) opts.append("--disable-documentation") f.addStep(shell.Configure(command = ["sh", "configure", ] + opts)) f.addStep(shell.Compile()) if not nocheck: f.addStep(shell.Test(name="check", command = ["make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND="])) return f
def gen_git_updated_valgrind_factory(repourl, configure_opts=[]): """ Factory for doing build from git master, without cleaning first, and using valgrind to check. This one is much more expensive, so should be run with a higher stable time. """ f = factory.BuildFactory() f.addStep(source.Git(repourl=repourl, mode="update")) f.addStep(Bootstrap()) configure_opts.append("--disable-documentation") f.addStep(shell.Configure(command = ["sh", "configure", "CXXFLAGS=-O0 -g"] + configure_opts)) f.addStep(shell.Compile()) f.addStep(shell.Test(name="check", command = ["make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain"], workdir='build/xapian-core')) return f
def test_setTestResults(self): step = self.setupStep(shell.Test()) step.setTestResults(total=10, failed=3, passed=5, warnings=3) self.assertEqual(step.statistics, { 'tests-total': 10, 'tests-failed': 3, 'tests-passed': 5, 'tests-warnings': 3, }) # ensure that they're additive step.setTestResults(total=1, failed=2, passed=3, warnings=4) self.assertEqual(step.statistics, { 'tests-total': 11, 'tests-failed': 5, 'tests-passed': 8, 'tests-warnings': 7, })
def gen_svn_debug_updated_factory(baseURL, opts): """ Make a factory for doing a debug HEAD build from SVN, but without cleaning first. This build is intended to catch commonly made mistakes quickly. """ f = factory.BuildFactory() f.addStep(source.SVN(baseURL=baseURL, defaultBranch='trunk', mode="update")) f.addStep(Bootstrap()) f.addStep(shell.Configure(command=[ "sh", "configure", ] + opts)) f.addStep(shell.Compile()) f.addStep( shell.Test(name="check", command=[ "make", "check", "XAPIAN_TESTSUITE_OUTPUT=plain", "VALGRIND=" ])) return f
def testAllSteps(self): # make sure that steps can be created from the factories that they # return for s in ( dummy.Dummy(), dummy.FailingDummy(), dummy.RemoteDummy(), maxq.MaxQ("testdir"), python.BuildEPYDoc(), python.PyFlakes(), python_twisted.HLint(), python_twisted.Trial(testpath=None, tests="tests"), python_twisted.ProcessDocs(), python_twisted.BuildDebs(), python_twisted.RemovePYCs(), shell.ShellCommand(), shell.TreeSize(), shell.Configure(), shell.Compile(), shell.Test(), source.CVS("cvsroot", "module"), source.SVN("svnurl"), source.Darcs("repourl"), source.Git("repourl"), source.Arch("url", "version"), source.Bazaar("url", "version", "archive"), source.Bzr("repourl"), source.Mercurial("repourl"), source.P4("p4base"), source.P4Sync(1234, "p4user", "passwd", "client", mode="copy"), source.Monotone("server", "branch"), transfer.FileUpload("src", "dest"), transfer.FileDownload("src", "dest"), ): try: self._loop(s) except: print "error checking %s" % s raise
def test_describe_not_done(self): step = self.setupStep(shell.Test()) step.rendered = True self.assertEqual(step.describe(), None)
def test_describe_not_done(self): step = self.setupStep(shell.Test()) self.assertEqual(step.describe(), ['testing'])
def test_describe_not_done(self): step = self.setupStep(shell.Test()) step.results = SUCCESS step.rendered = True self.assertEqual(step.getResultSummary(), {'step': 'test'})