def test_mode_incremental_given_revision(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='incremental'), dict( revision='100', )) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', dict(file='wkdir/.svn', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache']) + ExpectShell.log('stdio', stdout="URL: http://svn.local/app/trunk") + 0, ExpectShell(workdir='wkdir', command=['svn', 'update', '--revision', '100', '--non-interactive', '--no-auth-cache']) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental_no_existing_repo_dirname(self): self.setupStep( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='incremental', branchType='dirname'), ) self.expectCommands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']) + 0, Expect('stat', dict(file='wkdir/.buildbot-patched', logEnviron=True)) + 1, Expect('stat', dict(file='wkdir/.hg', logEnviron=True)) + 1, # does not exist ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'clone', '--noupdate', 'http://hg.mozilla.org', '.']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'locate', 'set:added()']) + 1, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'parents', '--template', '{node}\\n']) + ExpectShell.log('stdio', stdout='\n') + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS) return self.runStep()
def test_mode_incremental_repourl_not_updatable_svninfo_mismatch(self): self.setupStep( svn.SVN(repourl=ConstantRenderable('http://svn.local/trunk/app'), mode='incremental')) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', dict(file='wkdir/.svn', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache']) + ExpectShell.log('stdio', # expecting ../trunk/app stdout="URL: http://svn.local/branch/foo/app") + 0, Expect('rmdir', {'dir': 'wkdir', 'logEnviron': True}) + 0, ExpectShell(workdir='wkdir', command=['svn', 'checkout', 'http://svn.local/trunk/app', '.', '--non-interactive', '--no-auth-cache']) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info']) + ExpectShell.log('stdio', stdout=self.svn_info_stdout) + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) self.expectProperty('got_revision', '100', 'SVN') return self.runStep()
def test_mode_incremental(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='incremental',username='******', password='******', extra_args=['--random'])) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', dict(file='wkdir/.svn', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache', '--username', 'user', '--password', 'pass', '--random']) + ExpectShell.log('stdio', stdout="URL: http://svn.local/app/trunk") + 0, ExpectShell(workdir='wkdir', command=['svn', 'update', '--non-interactive', '--no-auth-cache', '--username', 'user', '--password', 'pass', '--random']) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info']) + ExpectShell.log('stdio', stdout=self.svn_info_stdout) + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) self.expectProperty('got_revision', '100', 'SVN') return self.runStep()
def test_mode_incremental_repourl_renderable(self): self.setupStep( svn.SVN(repourl=ConstantRenderable('http://svn.local/trunk'), mode='incremental')) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', dict(file='wkdir/.svn', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache']) + ExpectShell.log('stdio', stdout="URL: http://svn.local/trunk") + 0, ExpectShell(workdir='wkdir', command=['svn', 'update', '--non-interactive', '--no-auth-cache']) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info']) + ExpectShell.log('stdio', stdout=self.svn_info_stdout) + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) self.expectProperty('got_revision', '100', 'SVN') return self.runStep()
def test_mode_full_copy(self): self.setupStep(mtn.Monotone(repourl="mtn://localhost/monotone", mode="full", method="copy", branch="master")) self.expectCommands( ExpectShell(workdir="wkdir", command=["mtn", "--version"]) + ExpectShell.log("stdio", stdout="monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)") + 0, ExpectShell(workdir="wkdir", command=["mtn", "db", "info", "--db", "../db.mtn"]) + ExpectShell.log("stdio", stdout="") + 0, Expect("stat", dict(file="wkdir/.buildbot-patched", logEnviron=True)) + 1, Expect("rmdir", dict(dir="wkdir", logEnviron=True, timeout=1200)) + 0, Expect("stat", dict(file="source/_MTN", logEnviron=True)) + 0, Expect("stat", dict(file="db.mtn", logEnviron=True)) + 0, ExpectShell( workdir="source", command=["mtn", "pull", "mtn://localhost/monotone?master", "--db=../db.mtn", "--ticker=dot"], ) + 0, ExpectShell(workdir="source", command=["mtn", "update", "--db=../db.mtn", "-r", "h:master", "-b", "master"]) + 0, Expect("cpdir", {"fromdir": "source", "todir": "build", "logEnviron": True, "timeout": 1200}) + 0, ExpectShell(workdir="build", command=["mtn", "automate", "select", "w:"]) + ExpectShell.log("stdio", stdout="95215e2a9a9f8b6f5c9664e3807cd34617ea928c") + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty("got_revision", "95215e2a9a9f8b6f5c9664e3807cd34617ea928c", "Monotone") return self.runStep()
def test_mode_full_clean_new_rmdir(self): self.setupStep(svn.SVN(repourl="http://svn.local/app/trunk", mode="full", method="clean")) self.patch_slaveVersionIsOlderThan(False) self.expectCommands( ExpectShell(workdir="wkdir", command=["svn", "--version"]) + 0, Expect("stat", {"file": "wkdir/.svn", "logEnviron": True}) + 0, ExpectShell(workdir="wkdir", command=["svn", "info", "--non-interactive", "--no-auth-cache"]) + ExpectShell.log("stdio", stdout="URL: http://svn.local/app/trunk") + 0, ExpectShell(workdir="wkdir", command=["svn", "status", "--xml", "--non-interactive", "--no-auth-cache"]) + ExpectShell.log("stdio", stdout=self.svn_st_xml) + 0, Expect( "rmdir", { "dir": ["wkdir/svn_external_path/unversioned_file1", "wkdir/svn_external_path/unversioned_file2"], "logEnviron": True, }, ) + 0, ExpectShell(workdir="wkdir", command=["svn", "update", "--non-interactive", "--no-auth-cache"]) + 0, ExpectShell(workdir="wkdir", command=["svn", "info"]) + ExpectShell.log("stdio", stdout=self.svn_info_stdout) + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_full_clean(self): self.setupStep( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='full', method='clean', branchType='inrepo')) self.expectCommands( ExpectLogged('stat', dict(file='wkdir/.hg')) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--config', 'extensions.purge=', 'purge']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'pull', 'http://hg.mozilla.org']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--branch']) + ExpectShell.log('stdio', stdout='default') + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--id', '--debug']) + ExpectShell.log('stdio', stdout='\n') + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental_branch_change_dirname(self): self.setupStep( mercurial.Mercurial(baseURL='http://hg.mozilla.org/', mode='incremental', branchType='dirname', defaultBranch='devel'), dict(branch='stable') ) self.expectCommands( ExpectLogged('stat', dict(file='wkdir/.hg')) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'pull', 'http://hg.mozilla.org/stable', '--update']) + 0, ExpectLogged('rmdir', dict(dir='wkdir')) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'clone', '--noupdate', 'http://hg.mozilla.org/stable', '.']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--id', '--debug']) + ExpectShell.log('stdio', stdout='\n') + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental_branch_change_no_clobberOnBranchChange(self): self.setupStep( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='incremental', branchType='inrepo', clobberOnBranchChange=False), dict( branch='stable', )) self.expectCommands( ExpectLogged('stat', dict(file='wkdir/.hg')) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'pull', 'http://hg.mozilla.org', '--update']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--branch']) + ExpectShell.log('stdio', stdout='default') + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--id', '--debug']) + ExpectShell.log('stdio', stdout='\n') + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental_baseURL_not_updatable_svninfo_mismatch(self): self.setupStep( svn.SVN(baseURL='http://svn.local/%%BRANCH%%/app', mode='incremental', defaultBranch='trunk')) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', dict(file='wkdir/.svn', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache']) + ExpectShell.log('stdio', # expecting ../trunk/app stdout="URL: http://svn.local/branch/foo/app") + 0, Expect('rmdir', {'dir': 'wkdir', 'logEnviron': True}) + 0, ExpectShell(workdir='wkdir', command=['svn', 'checkout', 'http://svn.local/trunk/app', '.', '--non-interactive', '--no-auth-cache']) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_full_fresh_no_existing_repo(self): self.setupStep( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='full', method='fresh', branchType='inrepo')) self.expectCommands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']) + 0, Expect('stat', dict(file='wkdir/.buildbot-patched', logEnviron=True)) + 1, Expect('stat', dict(file='wkdir/.hg', logEnviron=True)) + 1, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'clone', '--noupdate', 'http://hg.mozilla.org', '.']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean', '--rev', 'default'], logEnviron=True) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'parents', '--template', '{node}\\n']) + ExpectShell.log('stdio', stdout='\n') + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS) return self.runStep()
def test_mode_full_clean_logEnviron(self): self.setupStep( mercurial.Mercurial( repourl="http://hg.mozilla.org", mode="full", method="clean", branchType="inrepo", logEnviron=False ) ) self.expectCommands( ExpectShell(workdir="wkdir", command=["hg", "--verbose", "--version"], logEnviron=False) + 0, Expect("stat", dict(file="wkdir/.buildbot-patched", logEnviron=False)) + 1, Expect("stat", dict(file="wkdir/.hg", logEnviron=False)) + 0, ExpectShell( workdir="wkdir", command=["hg", "--verbose", "--config", "extensions.purge=", "purge"], logEnviron=False ) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "pull", "http://hg.mozilla.org"], logEnviron=False) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "identify", "--branch"], logEnviron=False) + ExpectShell.log("stdio", stdout="default") + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "locate", "set:added()"], logEnviron=False) + 1, ExpectShell( workdir="wkdir", command=["hg", "--verbose", "update", "--clean", "--rev", "default"], logEnviron=False ) + 0, ExpectShell( workdir="wkdir", command=["hg", "--verbose", "parents", "--template", "{node}\\n"], logEnviron=False ) + ExpectShell.log("stdio", stdout="\n") + ExpectShell.log("stdio", stdout="f6ad368298bd941e934a41f3babc827b2aa95a1d") + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental_retry(self): self.setupStep( mercurial.Mercurial(repourl="http://hg.mozilla.org", mode="incremental", branchType="dirname", retry=(0, 1)) ) self.expectCommands( ExpectShell(workdir="wkdir", command=["hg", "--verbose", "--version"]) + 0, Expect("stat", dict(file="wkdir/.buildbot-patched", logEnviron=True)) + 1, Expect("stat", dict(file="wkdir/.hg", logEnviron=True)) + 1, # does not exist ExpectShell( workdir="wkdir", command=["hg", "--verbose", "clone", "--noupdate", "http://hg.mozilla.org", "."] ) + 1, Expect("rmdir", dict(dir="wkdir", logEnviron=True)) + 0, ExpectShell( workdir="wkdir", command=["hg", "--verbose", "clone", "--noupdate", "http://hg.mozilla.org", "."] ) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "locate", "set:added()"]) + 1, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "update", "--clean"]) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "parents", "--template", "{node}\\n"]) + ExpectShell.log("stdio", stdout="\n") + ExpectShell.log("stdio", stdout="f6ad368298bd941e934a41f3babc827b2aa95a1d") + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_full_clean_patch_fail(self): self.setupStep( mtn.Monotone(repourl="mtn://localhost/monotone", mode="full", method="clean", branch="master"), patch=(1, "patch"), ) self.expectCommands( ExpectShell(workdir="wkdir", command=["mtn", "--version"]) + ExpectShell.log("stdio", stdout="monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)") + 0, ExpectShell(workdir="wkdir", command=["mtn", "db", "info", "--db", "../db.mtn"]) + ExpectShell.log("stdio", stdout="") + 0, Expect("stat", dict(file="wkdir/.buildbot-patched", logEnviron=True)) + 1, Expect("stat", dict(file="wkdir/_MTN", logEnviron=True)) + 0, Expect("stat", dict(file="db.mtn", logEnviron=True)) + 0, ExpectShell(workdir="wkdir", command=["mtn", "ls", "unknown"]) + ExpectShell.log("stdio", stdout="file1\nfile2") + 0, Expect("rmdir", dict(dir=["wkdir/file1", "wkdir/file2"], logEnviron=True)) + 0, ExpectShell( workdir="wkdir", command=["mtn", "pull", "mtn://localhost/monotone?master", "--db=../db.mtn", "--ticker=dot"], ) + 0, ExpectShell(workdir="wkdir", command=["mtn", "update", "--db=../db.mtn", "-r", "h:master", "-b", "master"]) + 0, Expect( "downloadFile", dict( blocksize=16384, maxsize=None, reader=ExpectRemoteRef(_FileReader), slavedest=".buildbot-diff", workdir="wkdir", mode=None, ), ) + 0, Expect( "downloadFile", dict( blocksize=16384, maxsize=None, reader=ExpectRemoteRef(_FileReader), slavedest=".buildbot-patched", workdir="wkdir", mode=None, ), ) + 0, ExpectShell( workdir="wkdir", command=["patch", "-p1", "--remove-empty-files", "--force", "--forward", "-i", ".buildbot-diff"], ) + 0, Expect("rmdir", dict(dir="wkdir/.buildbot-diff", logEnviron=True)) + 1, ) self.expectOutcome(result=FAILURE, state_string="update (failure)") return self.runStep()
def test_mode_full_clean_no_existing_repo(self): self.setupStep(mtn.Monotone(repourl="mtn://localhost/monotone", mode="full", method="clean", branch="master")) self.expectCommands( ExpectShell(workdir="wkdir", command=["mtn", "--version"]) + ExpectShell.log("stdio", stdout="monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)") + 0, ExpectShell(workdir="wkdir", command=["mtn", "db", "info", "--db", "../db.mtn"]) + ExpectShell.log("stdio", stdout="") + 0, Expect("stat", dict(file="wkdir/.buildbot-patched", logEnviron=True)) + 1, Expect("stat", dict(file="wkdir/_MTN", logEnviron=True)) + 1, ExpectShell(workdir="wkdir", command=["mtn", "db", "init", "--db", "../db.mtn"]) + 0, ExpectShell( workdir="wkdir", command=["mtn", "pull", "mtn://localhost/monotone?master", "--db=../db.mtn", "--ticker=dot"], ) + 0, ExpectShell(workdir="wkdir", command=["mtn", "checkout", ".", "--db=../db.mtn", "--branch", "master"]) + 0, ExpectShell(workdir="wkdir", command=["mtn", "automate", "select", "w:"]) + ExpectShell.log("stdio", stdout="95215e2a9a9f8b6f5c9664e3807cd34617ea928c") + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty("got_revision", "95215e2a9a9f8b6f5c9664e3807cd34617ea928c", "Monotone") return self.runStep()
def test_new_version_failed(self): self.setupStep(shell.PerlModuleTest(command="cmd")) self.expectCommands( ExpectShell(workdir='wkdir', usePTY='worker-config', command="cmd") + ExpectShell.log('stdio', stdout=textwrap.dedent("""\ foo.pl .. 1/4""")) + ExpectShell.log('stdio', stderr=textwrap.dedent("""\ # Failed test 2 in foo.pl at line 6 # foo.pl line 6 is: ok(0);""")) + ExpectShell.log('stdio', stdout=textwrap.dedent("""\ foo.pl .. Failed 1/4 subtests Test Summary Report ------------------- foo.pl (Wstat: 0 Tests: 4 Failed: 1) Failed test: 0 Files=1, Tests=4, 0 wallclock secs ( 0.06 usr 0.01 sys + 0.03 cusr 0.01 csys = 0.11 CPU) Result: FAIL""")) + ExpectShell.log('stdio', stderr=textwrap.dedent("""\ Failed 1/1 test programs. 1/4 subtests failed.""")) + 1 ) self.expectOutcome(result=FAILURE, state_string='4 tests 3 passed 1 failed (failure)') return self.runStep()
def test_mode_full_clean(self): self.setupStep( svn.SVN(svnurl='http://svn.local/app/trunk@HEAD', mode='full', method='clean')) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, ExpectLogged('stat', {'file': 'wkdir/.svn', 'logEnviron': True}) + 0, ExpectShell(workdir='wkdir', command=['svn', 'status', '--xml', '--non-interactive', '--no-auth-cache']) + ExpectShell.log('stdio', stdout=self.svn_st_xml_empty) + 0, ExpectShell(workdir='wkdir', command=['svn', 'update', '--non-interactive', '--no-auth-cache']) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='100\n') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_maintenance_branch(self): self.buildStep('release-maintenance/flocker-1.2.3/destroy-the-sun-500') self.expectCommands( ExpectShell(workdir='wkdir', command=['git', 'fetch', 'git://twisted', 'release/flocker-1.2.3'], env=self.env) + 0, ExpectShell(workdir='wkdir', command=['git', 'log', '--format=%ci', '-n1'], env=self.env) + ExpectShell.log('stdio', stdout=COMMIT_DATE_NL) + 0, ExpectShell(workdir='wkdir', command=['git', 'merge', '--no-ff', '--no-stat', 'FETCH_HEAD'], env=self.date_env) + 0, ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'FETCH_HEAD'], env=self.date_env) + ExpectShell.log('stdio', stdout=COMMIT_HASH_NL) + 0, ) self.expectOutcome(result=SUCCESS, status_text=['merge', 'forward']) self.expectProperty('lint_revision', COMMIT_HASH) return self.runStep()
def test_getDescription_failed(self): # clone of: test_mode_incremental # only difference is to set the getDescription property # this tests when 'git describe' fails; for example, there are no # tags in the repository self.setupStep( git.Git(repourl="http://github.com/buildbot/buildbot.git", mode="incremental", getDescription=True) ) self.expectCommands( ## copied from test_mode_incremental: ExpectShell(workdir="wkdir", command=["git", "--version"]) + 0, Expect("stat", dict(file="wkdir/.git", logEnviron=True)) + 0, ExpectShell( workdir="wkdir", command=["git", "fetch", "-t", "http://github.com/buildbot/buildbot.git", "HEAD"] ) + 0, ExpectShell(workdir="wkdir", command=["git", "reset", "--hard", "FETCH_HEAD", "--"]) + 0, ExpectShell(workdir="wkdir", command=["git", "rev-parse", "HEAD"]) + ExpectShell.log("stdio", stdout="f6ad368298bd941e934a41f3babc827b2aa95a1d") + 0, ## plus this to test describe: ExpectShell(workdir="wkdir", command=["git", "describe", "HEAD"]) + ExpectShell.log("stdio", stdout="") + 128, # error, but it's suppressed ) self.expectOutcome(result=SUCCESS, status_text=["update"]) self.expectProperty("got_revision", "f6ad368298bd941e934a41f3babc827b2aa95a1d", "Git") self.expectNoProperty("commit-description") return self.runStep()
def test_branch_with_merge_target(self): self.buildStep('destroy-the-sun-5000') self.properties.setProperty( 'merge_target', 'merge-hash', source='test') self.expectCommands( ExpectShell(workdir='wkdir', command=['git', 'fetch', 'git://twisted', 'master'], env=self.env) + 0, ExpectShell(workdir='wkdir', command=['git', 'log', '--format=%ci', '-n1'], env=self.env) + ExpectShell.log('stdio', stdout=COMMIT_DATE_NL) + 0, ExpectShell(workdir='wkdir', command=['git', 'merge', '--no-ff', '--no-stat', 'merge-hash'], env=self.date_env) + 0, ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'merge-hash'], env=self.date_env) + ExpectShell.log('stdio', stdout=COMMIT_HASH_NL) + 0, ) self.expectOutcome(result=SUCCESS, status_text=['merge', 'forward']) self.expectProperty('lint_revision', COMMIT_HASH) return self.runStep()
def test_mode_full_clean_no_existing_repo(self): self.setupStep( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='full', method='clean', branchType='inrepo')) self.expectCommands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']) + 0, Expect('stat', dict(file='wkdir/.hg', logEnviron=True)) + 1, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'clone', 'http://hg.mozilla.org', '.']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--id', '--debug']) + ExpectShell.log('stdio', stdout='\n') + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_bogus_svnversion(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='incremental',username='******', password='******', extra_args=['--random'])) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', dict(file='wkdir/.svn', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache', '--username', 'user', '--password', 'pass', '--random']) + ExpectShell.log('stdio', stdout=textwrap.dedent("""\ Path: /a/b/c URL: http://svn.local/app/trunk""")) + 0, ExpectShell(workdir='wkdir', command=['svn', 'update', '--non-interactive', '--no-auth-cache', '--username', 'user', '--password', 'pass', '--random']) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='1x0y0') + 0, ) self.expectOutcome(result=FAILURE, status_text=["updating"]) return self.runStep()
def test_mode_incremental_no_existing_repo_dirname(self): self.setupStep( mercurial.Mercurial(baseURL='http://hg.mozilla.org', mode='incremental', branchType='dirname'), ) self.expectCommands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']) + 0, Expect('stat', dict(file='wkdir/.hg', logEnviron=True)) + 1, # does not exist ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'clone', 'http://hg.mozilla.org', '.', '--noupdate']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--id', '--debug']) + ExpectShell.log('stdio', stdout='\n') + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental_patched(self): self.setupStep(mtn.Monotone(repourl="mtn://localhost/monotone", mode="incremental", branch="master")) self.expectCommands( ExpectShell(workdir="wkdir", command=["mtn", "--version"]) + ExpectShell.log("stdio", stdout="monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)") + 0, ExpectShell(workdir="wkdir", command=["mtn", "db", "info", "--db", "../db.mtn"]) + ExpectShell.log("stdio", stdout="") + 0, Expect("stat", dict(file="wkdir/.buildbot-patched", logEnviron=True)) + 0, ExpectShell(workdir="wkdir", command=["mtn", "ls", "unknown"]) + ExpectShell.log("stdio", stdout="file1\nfile2") + 0, Expect("rmdir", dict(dir=["wkdir/file1", "wkdir/file2"], logEnviron=True)) + 0, Expect("stat", dict(file="wkdir/_MTN", logEnviron=True)) + 0, Expect("stat", dict(file="db.mtn", logEnviron=True)) + 0, ExpectShell( workdir="wkdir", command=["mtn", "pull", "mtn://localhost/monotone?master", "--db=../db.mtn", "--ticker=dot"], ) + 0, ExpectShell(workdir="wkdir", command=["mtn", "update", "--db=../db.mtn", "-r", "h:master", "-b", "master"]) + 0, ExpectShell(workdir="wkdir", command=["mtn", "automate", "select", "w:"]) + ExpectShell.log("stdio", stdout="95215e2a9a9f8b6f5c9664e3807cd34617ea928c") + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty("got_revision", "95215e2a9a9f8b6f5c9664e3807cd34617ea928c", "Monotone") return self.runStep()
def test_mode_incremental_branch_change(self): self.setupStep( mercurial.Mercurial(repourl="http://hg.mozilla.org", mode="incremental", branchType="inrepo"), dict(branch="stable"), ) self.expectCommands( ExpectShell(workdir="wkdir", command=["hg", "--verbose", "--version"]) + 0, Expect("stat", dict(file="wkdir/.buildbot-patched", logEnviron=True)) + 1, Expect("stat", dict(file="wkdir/.hg", logEnviron=True)) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "pull", "http://hg.mozilla.org"]) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "identify", "--branch"]) + ExpectShell.log("stdio", stdout="default") + 0, Expect("rmdir", dict(dir="wkdir", logEnviron=True)) + 0, ExpectShell( workdir="wkdir", command=["hg", "--verbose", "clone", "--noupdate", "http://hg.mozilla.org", "."] ) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "update", "--clean", "--rev", "stable"]) + 0, ExpectShell(workdir="wkdir", command=["hg", "--verbose", "parents", "--template", "{node}\\n"]) + ExpectShell.log("stdio", stdout="\n") + ExpectShell.log("stdio", stdout="f6ad368298bd941e934a41f3babc827b2aa95a1d") + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_full_fresh_keep_on_purge(self): self.setupStep( svn.SVN(svnurl='http://svn.local/app/trunk@HEAD', mode='full', keep_on_purge=['svn_external_path/unversioned_file1'])) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, ExpectLogged('stat', {'file': 'wkdir/.svn', 'logEnviron': True}) + 0, ExpectShell(workdir='wkdir', command=['svn', 'status', '--xml', '--no-ignore', '--non-interactive', '--no-auth-cache']) + ExpectShell.log('stdio', stdout=self.svn_st_xml) + 0, ExpectLogged('rmdir', {'dir': 'wkdir/svn_external_path/unversioned_file2', 'logEnviron': True}) + 0, ExpectShell(workdir='wkdir', command=['svn', 'update', '--non-interactive', '--no-auth-cache']) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='100\n') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_rmdir_fails_purge(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='full', keep_on_purge=['svn_external_path/unversioned_file1'])) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', {'file': 'wkdir/.svn', 'logEnviron': True}) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache' ]) + ExpectShell.log('stdio', stdout="URL: http://svn.local/app/trunk") + 0, ExpectShell(workdir='wkdir', command=['svn', 'status', '--xml', '--no-ignore', '--non-interactive', '--no-auth-cache']) + ExpectShell.log('stdio', stdout=self.svn_st_xml) + 0, Expect('rmdir', {'dir': 'wkdir/svn_external_path/unversioned_file2', 'logEnviron': True}) + 1, ) self.expectOutcome(result=FAILURE, status_text=["updating"]) return self.runStep()
def test_mode_full_clobber_no_existing_db(self): self.setupStep( mtn.Monotone(repourl='mtn://localhost/monotone', mode='full', method='clobber', branch='master')) self.expectCommands( ExpectShell(workdir='wkdir', command=['mtn', '--version']) + ExpectShell.log('stdio', stdout=self.MTN_VER) + 0, Expect('stat', dict(file='db.mtn', logEnviron=True)) + 1, ExpectShell(workdir='.', command=['mtn', 'db', 'init', '--db', 'db.mtn']) + 0, ExpectShell(workdir='.', command=['mtn', 'pull', 'mtn://localhost/monotone?master', '--db', 'db.mtn', '--ticker=dot']) + 0, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='.', command=['mtn', 'checkout', 'wkdir', '--db', 'db.mtn', '--branch', 'master']) + 0, ExpectShell(workdir='wkdir', command=['mtn', 'automate', 'select', 'w:']) + ExpectShell.log('stdio', stdout=self.REVID) + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty('got_revision', self.REVID, 'Monotone') return self.runStep()
def test_mode_full_export(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='full', method='export')) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, Expect('stat', dict(file='source/.svn', logEnviron=True)) + 0, ExpectShell(workdir='source', command=['svn', 'info', '--non-interactive', '--no-auth-cache' ]) + ExpectShell.log('stdio', stdout="URL: http://svn.local/app/trunk") + 0, ExpectShell(workdir='source', command=['svn', 'update', '--non-interactive', '--no-auth-cache']) + 0, ExpectShell(workdir='', command=['svn', 'export', 'source', 'wkdir']) + 0, ExpectShell(workdir='source', command=['svnversion']) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_full_clobber_retry(self): self.setupStep( darcs.Darcs(repourl='http://localhost/darcs', mode='full', method='clobber', retry=(0, 2))) self.expectCommands( ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0, Expect('stat', dict(file='wkdir/.buildbot-patched', logEnviron=True)) + 1, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='.', command=['darcs', 'get', '--verbose', '--lazy', '--repo-name', 'wkdir', 'http://localhost/darcs']) + 1, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='.', command=['darcs', 'get', '--verbose', '--lazy', '--repo-name', 'wkdir', 'http://localhost/darcs']) + 1, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='.', command=['darcs', 'get', '--verbose', '--lazy', '--repo-name', 'wkdir', 'http://localhost/darcs']) + 0, ExpectShell(workdir='wkdir', command=['darcs', 'changes', '--max-count=1']) + ExpectShell.log('stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty('got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs') return self.runStep()
def test_mode_incremental_patched(self): self.setupStep( darcs.Darcs(repourl='http://localhost/darcs', mode='incremental')) self.expectCommands( ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0, Expect('stat', dict(file='wkdir/.buildbot-patched', logEnviron=True)) + 0, Expect('rmdir', dict(dir='wkdir', logEnviron=True, timeout=1200)) + 0, Expect('stat', dict(file='source/_darcs', logEnviron=True)) + 0, ExpectShell(workdir='source', command=['darcs', 'pull', '--all', '--verbose']) + 0, Expect('cpdir', {'fromdir': 'source', 'todir': 'build', 'logEnviron': True, 'timeout': 1200}) + 0, Expect('stat', dict(file='build/_darcs', logEnviron=True)) + 0, ExpectShell(workdir='build', command=['darcs', 'pull', '--all', '--verbose']) + 0, ExpectShell(workdir='build', command=['darcs', 'changes', '--max-count=1']) + ExpectShell.log('stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty( 'got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs') return self.runStep()
def do_test_suppressions(self, step, supps_file='', stdout='', exp_warning_count=0, exp_warning_log='', exp_exception=False): self.setupStep(step) # Invoke the expected callbacks for the suppression file upload. Note # that this assumes all of the remote_* are synchronous, but can be # easily adapted to suit if that changes (using inlineCallbacks) def upload_behavior(command): writer = command.args['writer'] writer.remote_write(supps_file) writer.remote_close() command.rc = 0 self.expectCommands( # step will first get the remote suppressions file Expect('uploadFile', dict(blocksize=32768, maxsize=None, slavesrc='supps', workdir='wkdir', writer=ExpectRemoteRef(slave.StringFileWriter))) + Expect.behavior(upload_behavior), # and then run the command ExpectShell(workdir='wkdir', usePTY='slave-config', command=["make"]) + ExpectShell.log('stdio', stdout=stdout) + 0 ) if exp_exception: self.expectOutcome(result=EXCEPTION, state_string="'make' (exception)") else: if exp_warning_count != 0: self.expectOutcome(result=WARNINGS, state_string="'make' (warnings)") self.expectLogfile("warnings (%d)" % exp_warning_count, exp_warning_log) else: self.expectOutcome(result=SUCCESS, state_string="'make'") self.expectProperty("warnings-count", exp_warning_count) return self.runStep()
def test_mode_full_clobber_retry(self): self.setupStep( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='clobber', retry=(0, 2))) self.expectCommands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) + 0, Expect('stat', dict(file='wkdir/.buildbot-patched', logEnviron=True)) + 1, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'checkout', 'http://bzr.squid-cache.org/bzr/squid3/trunk', '.']) + 1, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'checkout', 'http://bzr.squid-cache.org/bzr/squid3/trunk', '.']) + 1, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'checkout', 'http://bzr.squid-cache.org/bzr/squid3/trunk', '.']) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'version-info', '--custom', "--template='{revno}"]) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty('got_revision', '100', 'Bzr') return self.runStep()
def _incremental(self, client_stdin='', extra_args=None, workdir='wkdir', timeout=20 * 60): if extra_args is None: extra_args = [] self.expectCommands( ExpectShell(workdir=workdir, command=['p4', '-V' ]) # expected remote command + 0, # expected exit status ExpectShell( workdir=workdir, timeout=timeout, command=[ 'p4', '-p', 'localhost:12000', '-u', 'user', '-P', 'pass', '-c', 'p4_client1', 'client', '-i' ], initialStdin=client_stdin, ) + 0, ExpectShell(workdir=workdir, timeout=timeout, command=([ 'p4', '-p', 'localhost:12000', '-u', 'user', '-P', 'pass', '-c', 'p4_client1' ] + extra_args + ['sync'])) + 0, ExpectShell( workdir=workdir, timeout=timeout, command=[ 'p4', '-p', 'localhost:12000', '-u', 'user', '-P', 'pass', '-c', 'p4_client1', 'changes', '-m1', '#have' ]) + ExpectShell.log( 'stdio', stdout="Change 100 on 2013/03/21 by user@machine \'duh\'") + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty('got_revision', '100', 'P4') return self.runStep()
def _full(self, client_stdin='', p4client='p4_client1', p4user='******', workdir='wkdir', extra_args=None): if extra_args is None: extra_args = [] self.expectCommands( ExpectShell(workdir=workdir, command=['p4', '-V']) # expected remote command + 0, # expected exit status ExpectShell(workdir=workdir, command=['p4', '-p', 'localhost:12000', '-u', p4user, '-P', 'pass', '-c', p4client, 'client', '-i'], initialStdin=client_stdin) + 0, ExpectShell(workdir=workdir, command=['p4', '-p', 'localhost:12000', '-u', p4user, '-P', 'pass', '-c', p4client] + extra_args + ['sync', '#none']) + 0, Expect('rmdir', {'dir': workdir, 'logEnviron': True}) + 0, ExpectShell(workdir=workdir, command=['p4', '-p', 'localhost:12000', '-u', p4user, '-P', 'pass', '-c', p4client] + extra_args + ['sync']) + 0, ExpectShell(workdir=workdir, command=['p4', '-p', 'localhost:12000', '-u', p4user, '-P', 'pass', '-c', p4client, 'changes', '-m1', '#have']) + ExpectShell.log('stdio', stdout="Change 100 on 2013/03/21 by user@machine \'duh\'") + 0, ) self.expectOutcome(result=SUCCESS) self.expectProperty('got_revision', '100', 'P4') return self.runStep()
def test_warnings(self): self.setupStep( cppcheck.Cppcheck(source=['file1.c'], enable=['warning', 'performance'])) self.expectCommands( ExpectShell(workdir='wkdir', command=[ 'cppcheck', 'file1.c', '--enable=warning,performance' ]) + ExpectShell.log( 'stdio', stdout= ('Checking file1.c...\n' '[file1.c:3]: (warning) Logical disjunction always evaluates to true: t >= 0 || t < 65.\n' '(information) Cppcheck cannot find all the include files (use --check-config for details)' )) + 0) self.expectOutcome( result=WARNINGS, state_string="cppcheck warning=1 information=1 (warnings)") return self.runStep()
def test_mode_incremental(self): self.setupStep( darcs.Darcs(repourl='http://localhost/darcs', mode='incremental')) self.expectCommands( ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0, Expect('stat', dict(file='wkdir/.buildbot-patched', logEnviron=True)) + 1, Expect('stat', dict(file='wkdir/_darcs', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['darcs', 'pull', '--all', '--verbose']) + 0, ExpectShell(workdir='wkdir', command=['darcs', 'changes', '--max-count=1']) + ExpectShell.log( 'stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) self.expectProperty('got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs') return self.runStep()
def test_mode_incremental_revision(self): self.setupStep(bzr.Bzr( repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='incremental'), args=dict(revision='9384')) self.expectCommands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) + 0, Expect('stat', dict(file='wkdir/.buildbot-patched', logEnviron=True)) + 1, Expect('stat', dict(file='wkdir/.bzr', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'update', '-r', '9384']) + 0, ExpectShell(workdir='wkdir', command=[ 'bzr', 'version-info', '--custom', "--template='{revno}" ]) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) self.expectProperty('got_revision', '100', 'Bzr') return self.runStep()
def test_upload_artifact_Win(self): self.setupStep(artifact.UploadArtifact( artifact="myartifact.py", artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerURL="http://srv.com/dir"), winslave=True) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command='powershell.exe -C for ($i=1; $i -le 5; $i++) ' + '{ rsync -var --progress --partial ' + self.local + ' ' + self.remote + '; if ($?) { exit 0 } else { sleep 5} } exit -1') + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Artifact(s) uploaded.']) return self.runStep()
def test_upload_artifact_Win_DOS(self): self.setupStep(artifact.UploadArtifact( artifact="myartifact.py", artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerURL="http://srv.com/dir", usePowerShell=False), winslave=True) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command= 'for /L %%i in (1,1,5) do (sleep 5 & rsync -var --progress --partial ' + self.local + ' ' + self.remote + ' && exit 0)') + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Artifact(s) uploaded.']) return self.runStep()
def test_mode_full_clean_no_existing_repo_branch(self): self.setupStep( git.Git(repourl='http://github.com/buildbot/buildbot.git', mode='full', method='clean', branch='test-branch')) self.expectCommands( ExpectShell(workdir='wkdir', command=['git', '--version']) + 0, Expect('stat', dict(file='wkdir/.git', logEnviron=True)) + 1, ExpectShell(workdir='wkdir', command=[ 'git', 'clone', '--branch', 'test-branch', 'http://github.com/buildbot/buildbot.git', '.' ]) + 0, ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'HEAD']) + ExpectShell.log( 'stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_run_failure(self): self.setupStep( python_twisted.Trial(workdir='build', tests='testname', testpath=None)) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={'test.log': '_trial_temp/test.log'}) + ExpectShell.log('stdio', stdout=failureLog) + 1) self.expectOutcome(result=FAILURE, state_string='tests 8 failures (failure)') self.expectLogfile('problems', failureLog.split('\n\n', 1)[1][:-1]) self.expectLogfile('warnings', textwrap.dedent('''\ buildbot.test.unit.test_steps_python_twisted.Trial.test_run_env_nodupe ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_env_supplement ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_jobs ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_jobsProperties ... [FAILURE] ''')) # noqa: max-line-length return self.runStep()
def test_mode_incremental(self): self.setupStep( svn.SVN(svnurl='http://svn.local/app/trunk@HEAD', mode='incremental', username='******', password='******', extra_args=['--random'])) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, ExpectLogged('stat', dict(file='wkdir/.svn', logEnviron=True)) + 0, ExpectShell( workdir='wkdir', command=[ 'svn', 'update', '--non-interactive', '--no-auth-cache', '--username', 'user', '--password', 'pass', '--random' ]) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_constr_args(self): self.setupStep( python.Sphinx(sphinx_sourcedir='src', sphinx_builddir="bld", sphinx_builder='css', sphinx="/path/to/sphinx-build", tags=['a', 'b'], defines=dict(empty=None, t=True, f=False, s="str"), mode='full')) self.expectCommands( ExpectShell(workdir='wkdir', usePTY='slave-config', command=[ '/path/to/sphinx-build', '-b', 'css', '-t', 'a', '-t', 'b', '-D', 'empty', '-D', 'f=0', '-D', 's=str', '-D', 't=1', '-E', 'src', 'bld' ]) + ExpectShell.log('stdio', stdout=log_output_success) + 0) self.expectOutcome(result=SUCCESS, status_text=["sphinx", "0 warnings"]) return self.runStep()
def test_mode_full_revision(self): self.setupStep(bzr.Bzr( repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='fresh'), args=dict(revision='3730')) self.expectCommands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) + 0, Expect('stat', dict(file='wkdir/.bzr', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'clean-tree', '--force']) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'update', '-r', '3730']) + 0, ExpectShell(workdir='wkdir', command=[ 'bzr', 'version-info', '--custom', "--template='{revno}" ]) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_cvsdiscard_fails(self): self.setupStep( cvs.CVS(cvsroot=":pserver:[email protected]:/cvsroot", cvsmodule="mozilla/browser/", mode='full', method='fresh', login=True)) self.expectCommands( ExpectShell(workdir='wkdir', command=['cvs', '--version']) + 0, ExpectLogged('stat', dict(file='wkdir/CVS', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['cvsdiscard', '--ignore']) + ExpectShell.log('stdio', stderr='FAIL!\n') + 1, ) self.expectOutcome(result=FAILURE, status_text=["updating"]) return self.runStep()
def test_mode_full_clobber(self): self.setupStep( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='clobber')) self.expectCommands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) + 0, Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=[ 'bzr', 'checkout', 'http://bzr.squid-cache.org/bzr/squid3/trunk', '.' ]) + 0, ExpectShell(workdir='wkdir', command=[ 'bzr', 'version-info', '--custom', "--template='{revno}" ]) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental(self): self.setupStep( git.Git(repourl='http://github.com/buildbot/buildbot.git', mode='incremental')) self.expectCommands( ExpectShell(workdir='wkdir', command=['git', '--version']) + 0, ExpectLogged('stat', dict(file='wkdir/.git')) + 0, ExpectShell(workdir='wkdir', command=[ 'git', 'fetch', '-t', 'http://github.com/buildbot/buildbot.git', 'master' ]) + 0, ExpectShell(workdir='wkdir', command=['git', 'reset', '--hard', 'FETCH_HEAD']) + 0, ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'HEAD']) + ExpectShell.log( 'stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_full_clobber(self): self.setupStep( git.Git(repourl='http://github.com/buildbot/buildbot.git', mode='full', method='clobber', progress=True)) self.expectCommands( ExpectLogged('rmdir', dict(dir='wkdir')) + 0, ExpectShell(workdir='wkdir', command=['git', 'clone', 'http://github.com/buildbot/buildbot.git', '.', '--progress']) + 0, ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'HEAD']) + ExpectShell.log('stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_full_clobber(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='full', method='clobber')) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('rmdir', { 'dir': 'wkdir', 'logEnviron': True }) + 0, ExpectShell(workdir='wkdir', command=[ 'svn', 'checkout', 'http://svn.local/app/trunk', '.', '--non-interactive', '--no-auth-cache' ]) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_failures_with_style_issues(self): self.setupStep(CheckStyle()) self.setProperty('try-codebase', 'internal') self.setProperty('platform', 'mac') self.setProperty('configuration', 'debug') self.expectRemoteCommands( ExpectShell(workdir='wkdir', command=['Tools/Scripts/check-webkit-style'], ) + ExpectShell.log('stdio', stdout='''ERROR: Source/WebCore/layout/FloatingContext.cpp:36: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/WebCore/layout/FormattingContext.h:94: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/layout/LayoutContext.cpp:52: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/layout/LayoutContext.cpp:55: Extra space before last semicolon. If this should be an empty statement, use { } instead. [whitespace/semicolon] [5] ERROR: Source/WebCore/layout/LayoutContext.cpp:60: Tab found; better to use spaces [whitespace/tab] [1] ERROR: Source/WebCore/layout/Verification.cpp:88: Missing space before ( in while( [whitespace/parens] [5] Total errors found: 8 in 48 files''') + 2, ) self.expectOutcome(result=FAILURE, state_string='8 style errors (failure)') return self.runStep()
def test_one_failure(self): self.setupStep(RunAPITests()) self.setProperty('fullPlatform', 'mac-mojave') self.setProperty('platform', 'mac') self.setProperty('configuration', 'debug') self.expectRemoteCommands( ExpectShell(workdir='wkdir', command=['python', 'Tools/Scripts/run-api-tests', '--no-build', '--debug', '--verbose', '--json-output={0}'.format(self.jsonFileName)], logfiles={'json': self.jsonFileName}, ) + ExpectShell.log('stdio', stdout=''' worker/0 TestWTF.WTF_Variant.OperatorAmpersand Passed worker/0 TestWTF.WTF_Variant.Ref Passed worker/0 TestWTF.WTF_Variant.RefPtr Passed worker/0 TestWTF.WTF_Variant.RetainPtr Passed worker/0 TestWTF.WTF_Variant.VisitorUsingMakeVisitor Passed worker/0 TestWTF.WTF_Variant.VisitorUsingSwitchOn Passed worker/0 exiting Ran 1888 tests of 1888 with 1887 successful ------------------------------ Test suite failed Crashed TestWTF.WTF.StringConcatenate_Unsigned **FAIL** WTF.StringConcatenate_Unsigned Tools\\TestWebKitAPI\\Tests\\WTF\\StringConcatenate.cpp:84 Value of: makeString('hello ', static_cast<unsigned short>(42) , ' world') Actual: hello 42 world Expected: 'hello * world' Which is: 74B00C9C Testing completed, Exit status: 3 ''') + 1, ) self.expectOutcome(result=FAILURE, state_string='1 api test failed or timed out (failure)') return self.runStep()
def test_mode_full_clean_patch_fail(self): self.setupStep( mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='full', method='clean', branchType='inrepo'), patch=(1, 'patch')) self.expectCommands( ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--version']) + 0, Expect('stat', dict(file='wkdir/.hg', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', '--config', 'extensions.purge=', 'purge']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'pull', 'http://hg.mozilla.org']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'identify', '--branch']) + ExpectShell.log('stdio', stdout='default') + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'locate', 'set:added()']) + 1, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'update', '--clean', '--rev', 'default']) + 0, ExpectShell(workdir='wkdir', command=['hg', '--verbose', 'import', '--no-commit', '-p', '1', '-'], initialStdin='patch') + 1, ) self.expectOutcome(result=FAILURE, status_text=["updating"]) return self.runStep()
def test_mode_incremental(self): self.setupStep( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='incremental')) self.expectCommands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) + 0, ExpectLogged('stat', dict(file='wkdir/.bzr', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'update']) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'version-info', '--custom', "--template='{revno}"]) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_create_artifact_directory_with_customArtifactPath_as_Interpolate( self): customArtifactPath = Interpolate("Art-%(src:fmod:revision)s") sourcestamp = StubSourceStamp() self.setupStep(artifact.CreateArtifactDirectory( artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerPort=222, customArtifactPath=customArtifactPath), sources={'fmod': sourcestamp}) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command=[ 'ssh', '*****@*****.**', '-p 222', 'cd /home/srv/web/dir;', 'mkdir -p ', 'Art-abcde/mydir' ]) + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Remote artifact directory created.']) return self.runStep()
def test_upload_artifact_with_customArtifactPath(self): self.setupStep( artifact.UploadArtifact(artifact="myartifact.py", artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerURL="http://srv.com/dir", customArtifactPath="foobar")) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command= 'for i in 1 2 3 4 5; do rsync -var --progress --partial ' + self.local + ' ' + self.remote_custom + '; if [ $? -eq 0 ]; then exit 0; else sleep 5; fi; done; exit -1' ) + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Artifact(s) uploaded.']) self.expectProperty('artifactServerPath', 'http://srv.com/dir/foobar', 'UploadArtifact') return self.runStep()
def test_mode_full_win32path(self): self.setupStep( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='fresh')) self.build.path_module = namedModule('ntpath') self.expectCommands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) + 0, Expect('stat', dict(file=r'wkdir\.buildbot-patched', logEnviron=True)) + 1, Expect('stat', dict(file=r'wkdir\.bzr', logEnviron=True)) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'clean-tree', '--force']) + 0, ExpectShell(workdir='wkdir', command=['bzr', 'update']) + 0, ExpectShell(workdir='wkdir', command=[ 'bzr', 'version-info', '--custom', "--template='{revno}" ]) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_new_version_warnings(self): self.setupStep(shell.PerlModuleTest(command="cmd", warningPattern='^OHNOES')) self.expectCommands( ExpectShell(workdir='wkdir', usePTY='slave-config', command="cmd") + ExpectShell.log('stdio', stdout=textwrap.dedent("""\ This junk ignored Test Summary Report ------------------- foo.pl (Wstat: 0 Tests: 10 Failed: 0) Failed test: 0 OHNOES 1 OHNOES 2 Files=93, Tests=20, 0 wallclock secs ... Result: PASS""")) + 0 ) self.expectOutcome( result=WARNINGS, state_string='20 tests 20 passed 2 warnings (warnings)') return self.runStep()
def test_regex_parseable_1_3_1(self): """ In pylint 1.3.1, output parseable is deprecated, but looks like that, this is also the new recommended format string: --msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} """ self.setupStep(python.PyLint(command=['pylint'], store_results=False)) self.expectCommands( ExpectShell(workdir='wkdir', command=['pylint']) + ExpectShell.log( 'stdio', stdout= ('test.py:9: [W0311(bad-indentation), ] Bad indentation. Found 6 ' 'spaces, expected 4\n' 'test.py:3: [C0111(missing-docstring), myFunc] Missing ' 'function docstring\n')) + (python.PyLint.RC_WARNING | python.PyLint.RC_CONVENTION)) self.expectOutcome( result=WARNINGS, state_string='pylint convention=1 warning=1 (warnings)') self.expectProperty('pylint-warning', 1) self.expectProperty('pylint-convention', 1) self.expectProperty('pylint-total', 2) return self.runStep()