def test_mode_incremental(self): self.setup_step( darcs.Darcs(repourl='http://localhost/darcs', mode='incremental')) self.expect_commands( ExpectShell(workdir='wkdir', command=['darcs', '--version']).exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(1), ExpectStat(file='wkdir/_darcs', log_environ=True).exit(0), ExpectShell(workdir='wkdir', command=['darcs', 'pull', '--all', '--verbose']).exit(0), ExpectShell( workdir='wkdir', command=['darcs', 'changes', '--max-count=1']).stdout( 'Tue Aug 20 09:18:41 IST 2013 [email protected]').exit(0)) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs') return self.run_step()
def test_mode_full_clean_patch(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='clean'), patch=(1, 'patch')) self.expect_commands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/.bzr', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'clean-tree', '--ignored', '--force']) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'update']) .exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef(remotetransfer.FileReader), workerdest='.buildbot-diff', workdir='wkdir', mode=None) .exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef(remotetransfer.FileReader), workerdest='.buildbot-patched', workdir='wkdir', mode=None) .exit(0), ExpectShell(workdir='wkdir', command=['patch', '-p1', '--remove-empty-files', '--force', '--forward', '-i', '.buildbot-diff']) .exit(0), ExpectRmdir(dir='wkdir/.buildbot-diff', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'version-info', '--custom', "--template='{revno}"]) .stdout('100') .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', '100', 'Bzr') return self.run_step()
def test_database_migration(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='incremental', branch='master')) self.expect_commands( ExpectShell(workdir='wkdir', command=['mtn', '--version']) .stdout(self.MTN_VER) .exit(0), ExpectStat(file='db.mtn', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'info', '--db', 'db.mtn']) .stdout('migration needed') .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'migrate', '--db', 'db.mtn']) .exit(0), ExpectShell(workdir='.', command=['mtn', 'pull', 'mtn://localhost/monotone?master', '--db', 'db.mtn', '--ticker=dot']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/_MTN', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'update', '--revision', 'h:master', '--branch', 'master']) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'automate', 'select', 'w:']) .stdout(self.REVID) .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', self.REVID, 'Monotone') return self.run_step()
def test_mode_incremental_existing_repo_added_files_old_rmdir(self): self.setup_step( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='incremental', branchType='inrepo')) self.patch_workerVersionIsOlderThan(True) self.expect_commands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']).exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(1), ExpectStat(file='wkdir/.hg', log_environ=True).exit(0), # directory exists ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'pull', 'http://hg.mozilla.org', '--rev', 'default' ]).exit(0), ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--branch']).stdout('default').exit(0), ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'locate', 'set:added()' ]).stdout('foo\nbar/baz\n').exit(1), ExpectRmdir(dir='wkdir/foo', log_environ=True).exit(0), ExpectRmdir(dir='wkdir/bar/baz', log_environ=True).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'update', '--clean', '--rev', 'default' ]).exit(0), ExpectShell( workdir='wkdir', command=[ 'hg', '--verbose', 'parents', '--template', '{node}\\n' ]).stdout('\n').stdout( 'f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_mode_full_clean_no_existing_checkout(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='full', method='clean', branch='master')) self.expect_commands( ExpectShell(workdir='wkdir', command=['mtn', '--version']) .stdout(self.MTN_VER) .exit(0), ExpectStat(file='db.mtn', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'info', '--db', 'db.mtn']) .stdout('') .exit(0), ExpectShell(workdir='.', command=['mtn', 'pull', 'mtn://localhost/monotone?master', '--db', 'db.mtn', '--ticker=dot']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/_MTN', log_environ=True) .exit(1), ExpectRmdir(dir='wkdir', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'checkout', 'wkdir', '--db', 'db.mtn', '--branch', 'master']) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'automate', 'select', 'w:']) .stdout(self.REVID) .exit(0), ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', self.REVID, 'Monotone') return self.run_step()
def test_mode_incremental_given_revision(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='incremental', branch='master'), dict(revision='abcdef01',)) self.expect_commands( ExpectShell(workdir='wkdir', command=['mtn', '--version']) .stdout(self.MTN_VER) .exit(0), ExpectStat(file='db.mtn', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'info', '--db', 'db.mtn']) .stdout('') .exit(0), ExpectShell(workdir='.', command=['mtn', 'pull', 'mtn://localhost/monotone?master', '--db', 'db.mtn', '--ticker=dot']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/_MTN', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'update', '--revision', 'abcdef01', '--branch', 'master']) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'automate', 'select', 'w:']) .stdout('abcdef019a9f8b6f5c9664e3807cd34617ea928c') .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property( 'got_revision', 'abcdef019a9f8b6f5c9664e3807cd34617ea928c', 'Monotone') return self.run_step()
def test_mode_full_no_method(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='full', branch='master')) self.expect_commands( ExpectShell(workdir='wkdir', command=['mtn', '--version']) .stdout(self.MTN_VER) .exit(0), ExpectStat(file='db.mtn', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'info', '--db', 'db.mtn']) .stdout('') .exit(0), ExpectShell(workdir='.', command=['mtn', 'pull', 'mtn://localhost/monotone?master', '--db', 'db.mtn', '--ticker=dot']) .exit(0), ExpectRmdir(dir='wkdir', log_environ=True, timeout=1200) .exit(0), ExpectStat(file='source/_MTN', log_environ=True) .exit(0), ExpectShell(workdir='source', command=['mtn', 'update', '--revision', 'h:master', '--branch', 'master']) .exit(0), ExpectCpdir(fromdir='source', todir='build', log_environ=True, timeout=1200) .exit(0), ExpectShell(workdir='build', command=['mtn', 'automate', 'select', 'w:']) .stdout(self.REVID) .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', self.REVID, 'Monotone') return self.run_step()
def test_mode_incremental_retry(self): self.setup_step( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='incremental', branchType='dirname', retry=(0, 1)), ) self.expect_commands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']).exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(1), ExpectStat(file='wkdir/.hg', log_environ=True).exit(1), # does not exist ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'clone', '--noupdate', 'http://hg.mozilla.org', '.' ]).exit(1), ExpectRmdir(dir='wkdir', log_environ=True).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'clone', '--noupdate', 'http://hg.mozilla.org', '.' ]).exit(0), ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'locate', 'set:added()']).exit(1), ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean']).exit(0), ExpectShell( workdir='wkdir', command=[ 'hg', '--verbose', 'parents', '--template', '{node}\\n' ]).stdout('\n').stdout( 'f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_mode_incremental_branch_change(self): self.setup_step( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='incremental', branchType='inrepo'), dict(branch='stable', )) self.expect_commands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']).exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(1), ExpectStat(file='wkdir/.hg', log_environ=True).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'pull', 'http://hg.mozilla.org', '--rev', 'stable' ]).exit(0), ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--branch']).stdout('default').exit(0), ExpectRmdir(dir='wkdir', log_environ=True).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'clone', '--noupdate', 'http://hg.mozilla.org', '.' ]).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'update', '--clean', '--rev', 'stable' ]).exit(0), ExpectShell( workdir='wkdir', command=[ 'hg', '--verbose', 'parents', '--template', '{node}\\n' ]).stdout('\n').stdout( 'f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_bad_revparse(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='incremental')) self.expect_commands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/.bzr', log_environ=True) .exit(1), ExpectShell(workdir='wkdir', command=['bzr', 'checkout', 'http://bzr.squid-cache.org/bzr/squid3/trunk', '.']) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'version-info', '--custom', "--template='{revno}"]) .stdout('oiasdfj010laksjfd') .exit(0) ) self.expect_outcome(result=FAILURE) return self.run_step()
def test_mode_incremental(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='incremental')) self.expect_commands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/.bzr', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'update']) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'version-info', '--custom', "--template='{revno}"]) .stdout('100') .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', '100', 'Bzr') return self.run_step()
def test_not_existing_path(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["srcdir"], masterdest=self.destdir)) self.expect_commands( ExpectStat(file='srcdir', workdir='wkdir').exit(1)) self.expect_outcome(result=FAILURE, state_string="uploading 1 file (failure)") self.expect_log_file('stderr', "File wkdir/srcdir not available at worker") yield self.run_step()
def test_special_path(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["srcdir"], masterdest=self.destdir)) self.expect_commands( ExpectStat(file='srcdir', workdir='wkdir').stat(mode=0).exit(0)) self.expect_outcome(result=FAILURE, state_string="uploading 1 file (failure)") self.expect_log_file( 'stderr', 'srcdir is neither a regular file, nor a directory') yield self.run_step()
def test_buildonly(self): self.setup_step(pbuilder.DebCowbuilder()) self.expect_commands( ExpectStat(file='/var/cache/pbuilder/stable-local-buildbot.cow/'). stat_dir(mtime=int(time.time())).exit(0), ExpectShell(workdir='wkdir', command=[ 'pdebuild', '--buildresult', '.', '--pbuilder', '/usr/sbin/cowbuilder', '--', '--buildresult', '.', '--basepath', '/var/cache/pbuilder/stable-local-buildbot.cow/' ]).exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_update_reg(self): self.setup_step( pbuilder.DebCowbuilder( basetgz='/var/cache/pbuilder/stable-local-buildbot.cow')) self.expect_commands( ExpectStat(file='/var/cache/pbuilder/stable-local-buildbot.cow'). stat_file().exit(0), ExpectShell(workdir='wkdir', command=[ 'sudo', '/usr/sbin/cowbuilder', '--update', '--basepath', '/var/cache/pbuilder/stable-local-buildbot.cow' ]).exit(1)) self.expect_outcome(result=FAILURE, state_string='built (failure)') return self.run_step()
def testMultipleString(self): self.setup_step( transfer.MultipleFileUpload(workersrcs="srcfile", masterdest=self.destdir)) self.expect_commands( ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 1 file") d = self.run_step() return d
def test_buildonly_and_property(self): self.setup_step(pbuilder.DebPbuilder()) self.expect_commands( ExpectStat(file='/var/cache/pbuilder/stable-local-buildbot.tgz' ).stat_file(mtime=int(time.time())).exit(0), ExpectShell( workdir='wkdir', command=[ 'pdebuild', '--buildresult', '.', '--pbuilder', '/usr/sbin/pbuilder', '--', '--buildresult', '.', '--basetgz', '/var/cache/pbuilder/stable-local-buildbot.tgz' ]).stdout( 'blah\ndpkg-genchanges >../somefilename.changes\foo\n'). exit(0)) self.expect_outcome(result=SUCCESS) self.expect_property('deb-changes', 'somefilename.changes', 'DebPbuilder') return self.run_step()
def test_database_invalid(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='incremental', branch='master')) self.expect_commands( ExpectShell(workdir='wkdir', command=['mtn', '--version']) .stdout(self.MTN_VER) .exit(0), ExpectStat(file='db.mtn', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'info', '--db', 'db.mtn']) .stdout('not a monotone database') .exit(0) ) self.expect_outcome(result=FAILURE) return self.run_step()
def testFailure(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["srcfile", "srcdir"], masterdest=self.destdir)) self.expect_commands( ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).exit(1)) self.expect_outcome(result=FAILURE, state_string="uploading 2 files (failure)") d = self.run_step() return d
def test_basetgz(self): self.setup_step( pbuilder.DebPbuilder(basetgz='/buildbot/stable-local.tgz')) self.expect_commands( ExpectStat(file='/buildbot/stable-local.tgz').exit(1), ExpectShell(workdir='wkdir', command=[ 'sudo', '/usr/sbin/pbuilder', '--create', '--basetgz', '/buildbot/stable-local.tgz', '--distribution', 'stable', '--mirror', 'http://cdn.debian.net/debian/' ]).exit(0), ExpectShell(workdir='wkdir', command=[ 'pdebuild', '--buildresult', '.', '--pbuilder', '/usr/sbin/pbuilder', '--', '--buildresult', '.', '--basetgz', '/buildbot/stable-local.tgz' ]).exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def testGlob(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["src*"], masterdest=self.destdir, glob=True)) self.expect_commands( ExpectGlob(path=os.path.join('wkdir', 'src*'), log_environ=False).files(["srcfile"]).exit(0), ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 1 file") d = self.run_step() return d
def test_mode_full_clean_force_same_project(self): self.setup_step( gerrit.Gerrit(repourl='http://github.com/buildbot/buildbot.git', mode='full', method='clean', codebase='buildbot')) self.build.setProperty("event.change.project", "buildbot") self.sourcestamp.project = 'buildbot' self.build.setProperty("gerrit_change", "1234/567") self.expect_commands( ExpectShell(workdir='wkdir', command=['git', '--version' ]).stdout('git version 1.7.5').exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(1), ExpectListdir(dir='wkdir').files(['.git']).exit(0), ExpectShell(workdir='wkdir', command=['git', 'clean', '-f', '-f', '-d']).exit(0), ExpectShell(workdir='wkdir', command=[ 'git', 'fetch', '-f', '-t', 'http://github.com/buildbot/buildbot.git', 'refs/changes/34/1234/567', '--progress' ]).exit(0), ExpectShell(workdir='wkdir', command=['git', 'checkout', '-f', 'FETCH_HEAD']).exit(0), ExpectShell( workdir='wkdir', command=['git', 'checkout', '-B', 'refs/changes/34/1234/567']).exit(0), ExpectShell(workdir='wkdir', command=[ 'git', 'rev-parse', 'HEAD' ]).stdout('f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0)) self.expect_outcome(result=SUCCESS) self.expect_property( 'got_revision', {'buildbot': 'f6ad368298bd941e934a41f3babc827b2aa95a1d'}, 'Gerrit') return self.run_step()
def testDirectoryWorker2_16(self): self.setup_step(transfer.MultipleFileUpload(workersrcs=["srcdir"], masterdest=self.destdir), worker_version={'*': '2.16'}) self.expect_commands( ExpectStat(file="srcdir", workdir='wkdir').stat_dir().exit(0), ExpectUploadDirectory( slavesrc="srcdir", workdir='wkdir', blocksize=16384, compress=None, maxsize=None, writer=ExpectRemoteRef( remotetransfer.DirectoryWriter)).upload_tar_file( 'fake.tar', { "test": "Hello world!" }).exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 1 file") d = self.run_step() return d
def test_mirror(self): self.setup_step(pbuilder.DebPbuilder(mirror='http://apt:9999/debian')) self.expect_commands( ExpectStat( file='/var/cache/pbuilder/stable-local-buildbot.tgz').exit(1), ExpectShell(workdir='wkdir', command=[ 'sudo', '/usr/sbin/pbuilder', '--create', '--basetgz', '/var/cache/pbuilder/stable-local-buildbot.tgz', '--distribution', 'stable', '--mirror', 'http://apt:9999/debian' ]).exit(0), ExpectShell(workdir='wkdir', command=[ 'pdebuild', '--buildresult', '.', '--pbuilder', '/usr/sbin/pbuilder', '--', '--buildresult', '.', '--basetgz', '/var/cache/pbuilder/stable-local-buildbot.tgz' ]).exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_update(self): self.setup_step(pbuilder.DebPbuilder()) self.expect_commands( ExpectStat(file='/var/cache/pbuilder/stable-local-buildbot.tgz'). stat_file().exit(0), ExpectShell(workdir='wkdir', command=[ 'sudo', '/usr/sbin/pbuilder', '--update', '--basetgz', '/var/cache/pbuilder/stable-local-buildbot.tgz', ]).exit(0), ExpectShell(workdir='wkdir', command=[ 'pdebuild', '--buildresult', '.', '--pbuilder', '/usr/sbin/pbuilder', '--', '--buildresult', '.', '--basetgz', '/var/cache/pbuilder/stable-local-buildbot.tgz' ]).exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_new(self): self.setup_step(pbuilder.DebCowbuilder()) self.expect_commands( ExpectStat( file='/var/cache/pbuilder/stable-local-buildbot.cow/').exit(1), ExpectShell(workdir='wkdir', command=[ 'sudo', '/usr/sbin/cowbuilder', '--create', '--basepath', '/var/cache/pbuilder/stable-local-buildbot.cow/', '--distribution', 'stable', '--mirror', 'http://cdn.debian.net/debian/' ]).exit(0), ExpectShell(workdir='wkdir', command=[ 'pdebuild', '--buildresult', '.', '--pbuilder', '/usr/sbin/cowbuilder', '--', '--buildresult', '.', '--basepath', '/var/cache/pbuilder/stable-local-buildbot.cow/' ]).exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_with_merge_branch(self): self.setup_step( self.stepClass(repourl='http://github.com/buildbot/buildbot.git', mode='full', method='clean'), dict(branch='refs/pull/1234/merge', revision='12345678')) self.expect_commands( ExpectShell(workdir='wkdir', command=['git', '--version' ]).stdout('git version 1.7.5').exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(1), ExpectListdir(dir='wkdir').files(['.git']).exit(0), ExpectShell(workdir='wkdir', command=['git', 'clean', '-f', '-f', '-d']).exit(0), # here we always ignore revision, and fetch the merge branch ExpectShell(workdir='wkdir', command=[ 'git', 'fetch', '-f', '-t', 'http://github.com/buildbot/buildbot.git', 'refs/pull/1234/merge', '--progress' ]).exit(0), ExpectShell(workdir='wkdir', command=['git', 'checkout', '-f', 'FETCH_HEAD']).exit(0), ExpectShell( workdir='wkdir', command=['git', 'checkout', '-B', 'refs/pull/1234/merge']).exit(0), ExpectShell(workdir='wkdir', command=[ 'git', 'rev-parse', 'HEAD' ]).stdout('f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0)) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', 'f6ad368298bd941e934a41f3babc827b2aa95a1d', 'GitHub') return self.run_step()
def test_mode_full_clobber_retry(self): self.setup_step( darcs.Darcs(repourl='http://localhost/darcs', mode='full', method='clobber', retry=(0, 2))) self.expect_commands( ExpectShell(workdir='wkdir', command=['darcs', '--version']).exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(1), ExpectRmdir(dir='wkdir', log_environ=True).exit(0), ExpectShell(workdir='.', command=[ 'darcs', 'get', '--verbose', '--lazy', '--repo-name', 'wkdir', 'http://localhost/darcs' ]).exit(1), ExpectRmdir(dir='wkdir', log_environ=True).exit(0), ExpectShell(workdir='.', command=[ 'darcs', 'get', '--verbose', '--lazy', '--repo-name', 'wkdir', 'http://localhost/darcs' ]).exit(1), ExpectRmdir(dir='wkdir', log_environ=True).exit(0), ExpectShell(workdir='.', command=[ 'darcs', 'get', '--verbose', '--lazy', '--repo-name', 'wkdir', 'http://localhost/darcs' ]).exit(0), ExpectShell( workdir='wkdir', command=['darcs', 'changes', '--max-count=1']).stdout( 'Tue Aug 20 09:18:41 IST 2013 [email protected]').exit(0)) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs') return self.run_step()
def test_manifest_override_local(self): """repo sync with manifest_override_url property set copied from local FS """ self.mySetupStep(manifestOverrideUrl="test.manifest", syncAllBranches=True) self.expectClobber() override_commands = [ ExpectStat(file='wkdir/test.manifest', log_environ=False), self.ExpectShell( log_environ=False, command=['cp', '-f', 'test.manifest', 'manifest_override.xml']), self.ExpectShell(log_environ=False, workdir='wkdir/.repo', command=[ 'ln', '-sf', '../manifest_override.xml', 'manifest.xml' ]) ] self.expectRepoSync(syncoptions=[], override_commands=override_commands) return self.myRunStep()
def test_new(self): self.setup_step(pbuilder.UbuCowbuilder(distribution='oneiric')) self.expect_commands( ExpectStat(file='/var/cache/pbuilder/oneiric-local-buildbot.cow/'). exit(1), ExpectShell(workdir='wkdir', command=[ 'sudo', '/usr/sbin/cowbuilder', '--create', '--basepath', '/var/cache/pbuilder/oneiric-local-buildbot.cow/', '--distribution', 'oneiric', '--mirror', 'http://archive.ubuntu.com/ubuntu/', '--components', 'main universe' ]).exit(0), ExpectShell(workdir='wkdir', command=[ 'pdebuild', '--buildresult', '.', '--pbuilder', '/usr/sbin/cowbuilder', '--', '--buildresult', '.', '--basepath', '/var/cache/pbuilder/oneiric-local-buildbot.cow/' ]).exit(0)) self.expect_outcome(result=SUCCESS, state_string='built') return self.run_step()