예제 #1
0
 def test_mode_full_fresh_no_existing_repo(self):
     self.setup_step(
         mercurial.Mercurial(repourl='http://hg.mozilla.org',
                             mode='full',
                             method='fresh',
                             branchType='inrepo'))
     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),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'clone', '--noupdate',
                         'http://hg.mozilla.org', '.'
                     ]).exit(0),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'update', '--clean', '--rev',
                         'default'
                     ],
                     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()
예제 #2
0
    def test_mode_incremental(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('').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()
예제 #3
0
 def test_mode_incremental_no_existing_repo(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(1),
         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()
예제 #4
0
 def test_mode_incremental_no_existing_repo_dirname(self):
     self.setup_step(
         mercurial.Mercurial(repourl='http://hg.mozilla.org',
                             mode='incremental',
                             branchType='dirname'), )
     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(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()
예제 #5
0
 def test_mode_full_timeout(self):
     self.setup_step(
         bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk',
                 mode='full',
                 method='fresh',
                 timeout=1))
     self.expect_commands(
         ExpectShell(workdir='wkdir',
                     timeout=1,
                     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',
                     timeout=1,
                     command=['bzr', 'clean-tree', '--force']).exit(0),
         ExpectShell(workdir='wkdir', timeout=1,
                     command=['bzr', 'update']).exit(0),
         ExpectShell(workdir='wkdir',
                     timeout=1,
                     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()
예제 #6
0
    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()
예제 #7
0
 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()
예제 #8
0
 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()
예제 #9
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()
예제 #10
0
    def testMultipleWorker2_16(self):
        self.setup_step(transfer.MultipleFileUpload(
            workersrcs=["srcfile", "srcdir"], masterdest=self.destdir),
                        worker_version={'*': '2.16'})

        self.expect_commands(
            ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0),
            ExpectUploadFile(slavesrc="srcfile",
                             workdir='wkdir',
                             blocksize=16384,
                             maxsize=None,
                             keepstamp=False,
                             writer=ExpectRemoteRef(
                                 remotetransfer.FileWriter)).upload_string(
                                     "Hello world!\n").exit(0),
            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 2 files")
        d = self.run_step()
        return d
예제 #11
0
 def test_mode_full_clean_patch_fail(self):
     self.setup_step(mercurial.Mercurial(repourl='http://hg.mozilla.org',
                                         mode='full',
                                         method='clean',
                                         branchType='inrepo'),
                     patch=(1, 'patch'))
     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),
                            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=[
                         'hg', '--verbose', 'import', '--no-commit', '-p',
                         '1', '-'
                     ],
                     initial_stdin='patch').exit(1))
     self.expect_outcome(result=FAILURE, state_string="update (failure)")
     return self.run_step()
예제 #12
0
 def test_mode_full_clean_timeout(self):
     self.setup_step(
         mercurial.Mercurial(repourl='http://hg.mozilla.org',
                             timeout=1,
                             mode='full',
                             method='clean',
                             branchType='inrepo'))
     self.expect_commands(
         ExpectShell(workdir='wkdir',
                     timeout=1,
                     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',
                     timeout=1,
                     command=[
                         'hg', '--verbose', '--config', 'extensions.purge=',
                         'purge'
                     ]).exit(0),
         ExpectShell(workdir='wkdir',
                     timeout=1,
                     command=[
                         'hg', '--verbose', 'pull', 'http://hg.mozilla.org',
                         '--rev', 'default'
                     ]).exit(0),
         ExpectShell(workdir='wkdir',
                     timeout=1,
                     command=['hg', '--verbose', 'identify',
                              '--branch']).stdout('default').exit(0),
         ExpectShell(workdir='wkdir',
                     timeout=1,
                     command=['hg', '--verbose', 'locate',
                              'set:added()']).exit(1),
         ExpectShell(workdir='wkdir',
                     timeout=1,
                     command=[
                         'hg', '--verbose', 'update', '--clean', '--rev',
                         'default'
                     ]).exit(0),
         ExpectShell(
             workdir='wkdir',
             timeout=1,
             command=[
                 'hg', '--verbose', 'parents', '--template', '{node}\\n'
             ]).stdout('\n').stdout(
                 'f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0))
     self.expect_outcome(result=SUCCESS)
     return self.run_step()
예제 #13
0
    def testSubclass(self):
        class CustomStep(transfer.MultipleFileUpload):
            uploadDone = Mock(return_value=None)
            allUploadsDone = Mock(return_value=None)

        step = CustomStep(workersrcs=["srcfile", "srcdir"],
                          masterdest=self.destdir)
        self.setup_step(step)

        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),
            ExpectStat(file="srcdir", workdir='wkdir').stat_dir().exit(0),
            ExpectUploadDirectory(
                workersrc="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 2 files")

        yield self.run_step()

        def checkCalls(res):
            self.assertEqual(step.uploadDone.call_count, 2)
            self.assertEqual(step.uploadDone.call_args_list[0],
                             ((SUCCESS, 'srcfile',
                               os.path.join(self.destdir, 'srcfile')), {}))
            self.assertEqual(step.uploadDone.call_args_list[1],
                             ((SUCCESS, 'srcdir',
                               os.path.join(self.destdir, 'srcdir')), {}))
            self.assertEqual(step.allUploadsDone.call_count, 1)
            self.assertEqual(
                step.allUploadsDone.call_args_list[0],
                ((SUCCESS, ['srcfile', 'srcdir'], self.destdir), {}))
예제 #14
0
 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))
예제 #15
0
    def testException(self):
        self.setup_step(
            transfer.MultipleFileUpload(workersrcs=["srcfile", "srcdir"],
                                        masterdest=self.destdir))

        writers = []

        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",
                                     out_writers=writers,
                                     error=RuntimeError('uh oh')))

        self.expect_outcome(result=EXCEPTION,
                            state_string="uploading 2 files (exception)")
        yield self.run_step()

        self.assertEqual(len(writers), 1)
        self.assertEqual(writers[0].cancel.called, True)

        self.assertEqual(len(self.flushLoggedErrors(RuntimeError)), 1)
예제 #16
0
    def test_url_text(self):
        self.setup_step(
            transfer.MultipleFileUpload(workersrcs=["srcfile"],
                                        masterdest=self.destdir,
                                        url="http://server/dir",
                                        urlText='url text'))

        self.step.addURL = Mock()

        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")

        yield self.run_step()

        self.step.addURL.assert_called_once_with("url text",
                                                 "http://server/dir")
예제 #17
0
 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()
예제 #18
0
 def test_bad_checkout(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', '.'
                     ]).stderr('failed\n').exit(128))
     self.expect_outcome(result=FAILURE)
     return self.run_step()
예제 #19
0
 def test_manifest_override(self):
     """repo sync with manifest_override_url property set
     download via wget
     """
     self.mySetupStep(manifestOverrideUrl="http://u.rl/test.manifest",
                      syncAllBranches=True)
     self.expectClobber()
     override_commands = [
         ExpectStat(file='wkdir/http://u.rl/test.manifest',
                    log_environ=False),
         self.ExpectShell(log_environ=False,
                          command=[
                              'wget', 'http://u.rl/test.manifest', '-O',
                              'manifest_override.xml'
                          ]),
         self.ExpectShell(log_environ=False,
                          workdir='wkdir/.repo',
                          command=[
                              'ln', '-sf', '../manifest_override.xml',
                              'manifest.xml'
                          ])
     ]
     self.expectRepoSync(which_fail=2,
                         syncoptions=[],
                         override_commands=override_commands)
     return self.myRunStep()
예제 #20
0
 def test_render(self):
     self.setup_step(worker.FileExists(file=properties.Property("x")))
     self.properties.setProperty('x', 'XXX', 'here')
     self.expect_commands(ExpectStat(file='XXX').exit(1))
     self.expect_outcome(result=FAILURE,
                         state_string="File not found. (failure)")
     return self.run_step()
예제 #21
0
    def test_mode_full_clean_different_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 = 'not_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', 'HEAD',
                            '--progress'
                        ]).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['git', 'checkout', '-f',
                                 'FETCH_HEAD']).exit(0),
            ExpectShell(workdir='wkdir', command=[
                'git', 'rev-parse', 'HEAD'
            ]).stdout('f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0))
        self.expect_outcome(result=SUCCESS)
        return self.run_step()
예제 #22
0
    def test_with_head_branch(self):
        self.setup_step(
            self.stepClass(repourl='http://github.com/buildbot/buildbot.git',
                           mode='full',
                           method='clean'),
            dict(branch='refs/pull/1234/head', 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),
            # in the case of the head, we try to find if the head is already present
            # and reset to that without fetching
            ExpectShell(workdir='wkdir',
                        command=['git', 'cat-file', '-e', '12345678']).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['git', 'checkout', '-f', '12345678']).exit(0),
            ExpectShell(
                workdir='wkdir',
                command=['git', 'checkout', '-B',
                         'refs/pull/1234/head']).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()
예제 #23
0
    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()
예제 #24
0
 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()
예제 #25
0
 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()
예제 #26
0
 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()
예제 #27
0
 def test_mode_full_win32path(self):
     self.setup_step(
         bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk',
                 mode='full',
                 method='fresh'))
     self.build.path_module = namedModule('ntpath')
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['bzr', '--version']).exit(0),
         ExpectStat(file=r'wkdir\.buildbot-patched',
                    log_environ=True).exit(1),
         ExpectStat(file=r'wkdir\.bzr', log_environ=True).exit(0),
         ExpectShell(workdir='wkdir',
                     command=['bzr', 'clean-tree', '--force']).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)
     return self.run_step()
예제 #28
0
 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()
예제 #29
0
 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()
예제 #30
0
 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()