def test_mode_full_clean_patch_worker_2_16(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='full', method='clean', branch='master'), patch=(1, 'patch'), worker_version={'*': '2.16'}) 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', 'ls', 'unknown']) .stdout('file1\nfile2') .exit(0), ExpectRmdir(dir=['wkdir/file1', 'wkdir/file2'], log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'update', '--revision', 'h:master', '--branch', 'master']) .exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef(remotetransfer.StringFileReader), slavedest='.buildbot-diff', workdir='wkdir', mode=None) .exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef(remotetransfer.StringFileReader), slavedest='.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=['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_full_clobber_no_existing_db(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='full', method='clobber', 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(1), ExpectShell(workdir='.', command=['mtn', 'db', 'init', '--db', 'db.mtn']) .exit(0), ExpectShell(workdir='.', command=['mtn', 'pull', 'mtn://localhost/monotone?master', '--db', 'db.mtn', '--ticker=dot']) .exit(0), 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 expectClobber(self): # stat return 1 so we clobber self.expect_commands( ExpectStat(file='wkdir/.repo', log_environ=self.logEnviron).exit(1), ExpectRmdir(dir='wkdir', log_environ=self.logEnviron).exit(0), ExpectMkdir(dir='wkdir', log_environ=self.logEnviron).exit(0))
def test_mode_incremental_branch_change_dirname(self): self.setup_step( mercurial.Mercurial(repourl='http://hg.mozilla.org/', mode='incremental', branchType='dirname', defaultBranch='devel'), 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/stable' ]).exit(0), ExpectRmdir(dir='wkdir', log_environ=True).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'clone', '--noupdate', 'http://hg.mozilla.org/stable', '.' ]).exit(0), 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_full_clobber_revision_worker_2_16(self): self.setup_step(darcs.Darcs(repourl='http://localhost/darcs', mode='full', method='clobber'), dict(revision='abcdef01'), worker_version={'*': '2.16'}) 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), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader), slavedest='.darcs-context', workdir='wkdir', mode=None).exit(0), ExpectShell(workdir='.', command=[ 'darcs', 'get', '--verbose', '--lazy', '--repo-name', 'wkdir', '--context', '.darcs-context', '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_mode_full_clobber(self): self.setup_step( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='full', method='clobber', branchType='inrepo')) self.expect_commands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']).exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).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', 'update', '--clean', '--rev', 'default' ]).exit(0), ExpectShell( workdir='wkdir', command=[ 'hg', '--verbose', 'parents', '--template', '{node}\\n' ]).stdout('f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_mode_full_copy(self): self.setup_step( darcs.Darcs(repourl='http://localhost/darcs', mode='full', method='copy')) 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, timeout=1200).exit(0), ExpectStat(file='source/_darcs', log_environ=True).exit(0), ExpectShell(workdir='source', command=['darcs', 'pull', '--all', '--verbose']).exit(0), ExpectCpdir(fromdir='source', todir='build', log_environ=True, timeout=1200).exit(0), ExpectShell( workdir='build', 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_incremental_retry(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='incremental', retry=(0, 1))) 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(1), ExpectRmdir(dir='wkdir', log_environ=True) .exit(0), 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('100\n') .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', '100\n', 'Bzr') return self.run_step()
def test_mode_full_copy(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='copy')) self.expect_commands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectRmdir(dir='build', log_environ=True) .exit(0), ExpectStat(file='source/.bzr', log_environ=True) .exit(0), ExpectShell(workdir='source', command=['bzr', 'update']) .exit(0), ExpectCpdir(fromdir='source', log_environ=True, todir='build') .exit(0), ExpectShell(workdir='source', 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_mode_full_clobber_baseurl_nodefault(self): self.setup_step( bzr.Bzr(baseURL='http://bzr.squid-cache.org/bzr/squid3', defaultBranch='trunk', mode='full', method='clobber'), args=dict(branch='branches/SQUID_3_0')) self.expect_commands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectRmdir(dir='wkdir', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'checkout', os.path.join('http://bzr.squid-cache.org/bzr/squid3', 'branches/SQUID_3_0'), '.']) .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_mode_full_clobber_revision(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='clobber'), args=dict(revision='3730')) self.expect_commands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectRmdir(dir='wkdir', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'checkout', 'http://bzr.squid-cache.org/bzr/squid3/trunk', '.', '-r', '3730']) .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_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 testBasic(self): self.setup_step(RemoveWorkerFileSecret( [(os.path.join(self.temp_path, "pathA"), "something"), (os.path.join(self.temp_path, "pathB"), "somethingmore")]), worker_version={'*': '3.0'}) self.expect_commands( ExpectRmdir(path=os.path.join(self.temp_path, "pathA"), dir=os.path.abspath(os.path.join(self.temp_path, "pathA")), log_environ=False) .exit(0), ExpectRmdir(path=os.path.join(self.temp_path, "pathB"), dir=os.path.abspath(os.path.join(self.temp_path, "pathB")), log_environ=False) .exit(0), ) self.expect_outcome( result=SUCCESS, state_string="finished") d = self.run_step() return d
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_success(self): self.setup_step(mock.Mock(root='TESTROOT')) self.expect_commands( ExpectRmdir(dir=['build/build.log', 'build/root.log', 'build/state.log'], log_environ=False) .exit(0), ExpectShell(workdir='wkdir', command=['mock', '--root', 'TESTROOT'], logfiles={'build.log': 'build.log', 'root.log': 'root.log', 'state.log': 'state.log'}) .exit(0)) self.expect_outcome(result=SUCCESS, state_string="'mock --root ...'") return self.run_step()
def test_success(self): self.setup_step(mock.MockRebuild(root='TESTROOT', srpm="foo.src.rpm")) self.expect_commands( ExpectRmdir(dir=['build/build.log', 'build/root.log', 'build/state.log'], log_environ=False) .exit(0), ExpectShell(workdir='wkdir', command=['mock', '--root', 'TESTROOT', '--rebuild', 'foo.src.rpm'], logfiles={'build.log': 'build.log', 'root.log': 'root.log', 'state.log': 'state.log'},) .exit(0)) self.expect_outcome(result=SUCCESS, state_string='mock rebuild srpm') return self.run_step()
def test_mode_full_fresh(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='full', method='fresh', 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(0), ExpectShell(workdir='wkdir', command=['mtn', 'ls', 'unknown']) .stdout('file1\nfile2') .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'ls', 'ignored']) .stdout('file3\nfile4') .exit(0), ExpectRmdir(dir=['wkdir/file1', 'wkdir/file2', 'wkdir/file3', 'wkdir/file4'], 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_create_tarball(self): """repo sync create the tarball if its not here """ self.mySetupStep(tarball="/tarball.tgz") self.expectClobber() self.expect_commands( self.ExpectShell( command=['tar', '-z', '-xvf', '/tarball.tgz']).exit(1), self.ExpectShell(command=['rm', '-f', '/tarball.tgz']).exit(1), ExpectRmdir(dir='wkdir/.repo', log_environ=False).exit(1)) self.expectRepoSync() self.expect_commands( self.ExpectShell(command=['stat', '-c%Y', '/tarball.tgz']).stderr( "file not found!").exit(1), self.ExpectShell( command=['tar', '-z', '-cvf', '/tarball.tgz', '.repo']).exit( 0)) return self.myRunStep()
def test_resultdir_renderable(self): resultdir_text = "RESULT" self.setup_step(mock.Mock(root='TESTROOT', resultdir=Interpolate( '%(kw:resultdir)s', resultdir=resultdir_text))) self.expect_commands( ExpectRmdir(dir=['build/RESULT/build.log', 'build/RESULT/root.log', 'build/RESULT/state.log'], log_environ=False) .exit(0), ExpectShell(workdir='wkdir', command=['mock', '--root', 'TESTROOT', '--resultdir', 'RESULT'], logfiles={'build.log': 'RESULT/build.log', 'root.log': 'RESULT/root.log', 'state.log': 'RESULT/state.log'}) .exit(0)) self.expect_outcome(result=SUCCESS, state_string="'mock --root ...'") return self.run_step()
def test_database_too_new(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('too new, cannot use') .exit(0), ExpectRmdir(dir='db.mtn', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'init', '--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_patch(self): self.setup_step(darcs.Darcs(repourl='http://localhost/darcs', mode='incremental'), patch=(1, 'patch')) 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), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader), workerdest='.buildbot-diff', workdir='wkdir', mode=None).exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader), 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=['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_worker_2_16(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='clean'), patch=(1, 'patch'), worker_version={'*': '2.16'}) 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), slavedest='.buildbot-diff', workdir='wkdir', mode=None) .exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef(remotetransfer.FileReader), slavedest='.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_update_tarball_fail1(self, suffix="tar", option=None): """tarball extract fail -> remove the tarball + remove .repo dir """ if option is None: option = [] self.mySetupStep(tarball="/tarball." + suffix) self.expectClobber() self.expect_commands( self.ExpectShell(command=['tar'] + option + ['-xvf', '/tarball.' + suffix]).exit(1), self.ExpectShell(command=['rm', '-f', '/tarball.tar']).exit(0), ExpectRmdir(dir='wkdir/.repo', log_environ=False).exit(0)) self.expectRepoSync() self.expect_commands( self.ExpectShell(command=['stat', '-c%Y', '/tarball.' + suffix]).stdout(str(10000)).exit(0), self.ExpectShell(command=['stat', '-c%Y', '.']).stdout( str(10001 + 7 * 24 * 3600)).exit(0), self.ExpectShell(command=['tar'] + option + ['-cvf', '/tarball.' + suffix, '.repo']).exit(0)) return self.myRunStep()
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_full_clean_patch_worker_2_16(self): self.setup_step(mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='full', method='clean', branchType='inrepo'), patch=(1, 'patch'), worker_version={'*': '2.16'}) self.expect_commands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']).exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True).exit(0), ExpectStat(file='wkdir/.hg', log_environ=True).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', '--config', 'extensions.purge=', 'purge' ]).exit(0), 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()']).exit(1), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'update', '--clean', '--rev', 'default' ]).exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader), slavedest='.buildbot-diff', workdir='wkdir', mode=None).exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader), slavedest='.buildbot-patched', workdir='wkdir', mode=None).exit(0), ExpectShell(workdir='wkdir', command=[ 'hg', '--verbose', 'import', '--no-commit', '-p', '1', '-' ], initial_stdin='patch').exit(0), ExpectRmdir(dir='wkdir/.buildbot-diff', log_environ=True).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_success(self): self.setup_step(worker.RemoveDirectory(dir="d")) self.expect_commands(ExpectRmdir(dir='d').exit(0)) self.expect_outcome(result=SUCCESS, state_string="Deleted") return self.run_step()
def test_rmdir(self): self.setup_step(CompositeUser(lambda x: x.runRmdir("d"))) self.expect_commands(ExpectRmdir(dir='d', log_environ=False).exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_render(self): self.setup_step(worker.RemoveDirectory(dir=properties.Property("x"))) self.properties.setProperty('x', 'XXX', 'here') self.expect_commands(ExpectRmdir(dir='XXX').exit(0)) self.expect_outcome(result=SUCCESS, state_string="Deleted") return self.run_step()
def test_failure(self): self.setup_step(worker.RemoveDirectory(dir="d")) self.expect_commands(ExpectRmdir(dir='d').exit(1)) self.expect_outcome(result=FAILURE, state_string="Delete failed. (failure)") return self.run_step()