def test_mode_incremental_repourl_not_updatable(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)) + 1, 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"]) return self.runStep()
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_full_clobber_given_revision(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='full', method='clobber'), dict(revision='100', )) 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', '.', '--revision', '100', '--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_fresh(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='full', method='fresh', depth='infinite')) 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', '--depth', 'infinite' ]) + 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', '--depth', 'infinite' ]) + ExpectShell.log('stdio', stdout=self.svn_st_xml_empty) + 0, ExpectShell(workdir='wkdir', command=[ 'svn', 'update', '--non-interactive', '--no-auth-cache', '--depth', 'infinite' ]) + 0, ExpectShell(workdir='wkdir', command=['svnversion']) + ExpectShell.log('stdio', stdout='100') + ExpectShell.log('stdio', stdout='\n') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_mode_incremental_logEnviron(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='incremental',username='******', password='******', extra_args=['--random'], logEnviron=False)) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version'], logEnviron=False) + 0, Expect('stat', dict(file='wkdir/.svn', logEnviron=False)) + 0, ExpectShell(workdir='wkdir', command=['svn', 'info', '--non-interactive', '--no-auth-cache', '--username', 'user', '--password', 'pass', '--random'], logEnviron=False) + 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'], logEnviron=False) + 0, ExpectShell(workdir='wkdir', command=['svnversion'], logEnviron=False) + ExpectShell.log('stdio', stdout='100') + 0, ) self.expectOutcome(result=SUCCESS, status_text=["update"]) return self.runStep()
def test_command_fails(self): self.setupStep( svn.SVN(svnurl='http://svn.local/app/trunk@HEAD', mode='incremental', username='******', password='******', extra_args=['--random'], logEnviron=False)) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version'], logEnviron=False) + 0, ExpectLogged('stat', dict(file='wkdir/.svn', logEnviron=False)) + 0, ExpectShell( workdir='wkdir', command=[ 'svn', 'update', '--non-interactive', '--no-auth-cache', '--username', 'user', '--password', 'pass', '--random' ], logEnviron=False) + 1, ) self.expectOutcome(result=FAILURE, status_text=["updating"]) return self.runStep()
def test_mode_full_copy(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='full', method='copy')) 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, Expect('cpdir', {'fromdir': 'source', 'todir': 'wkdir', 'logEnviron': True}) + 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_not_updatable(self): self.setupStep( svn.SVN(repourl='http://svn.local/app/trunk', mode='full', method='clean')) self.expectCommands( ExpectShell(workdir='wkdir', command=['svn', '--version']) + 0, Expect('stat', {'file': 'wkdir/.svn', 'logEnviron': True}) + 1, 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_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_incorrect_method(self): self.assertRaises( config.ConfigErrors, lambda: svn.SVN(repourl='http://svn.local/app/trunk', method='invalid'))
def test_no_repourl(self): self.assertRaises(config.ConfigErrors, lambda: svn.SVN())
def getLibCXXBuilder(f=None, source_path=None, lit_dir=None): if f is None: f = buildbot.process.factory.BuildFactory() # Find the build directory. We assume if f is passed in that the build # directory has already been found. f = phased_builder_utils.getBuildDir(f) # Grab the sources if we are not passed in any. if source_path is None: source_path = 'sources' src_url = 'http://llvm.org/svn/llvm-project/libcxx/trunk' f = phased_builder_utils.SVNCleanupStep(f, source_path) f.addStep( svn.SVN(name='pull.src', mode='full', repourl=src_url, workdir=source_path, method='fresh', alwaysUseLatest=False, retry=(60, 5), description='pull.src')) # Grab the artifacts for our build. f = artifacts.GetCompilerArtifacts(f) host_compiler_dir = properties.WithProperties('%(builddir)s/host-compiler') f = artifacts.GetCCFromCompilerArtifacts(f, host_compiler_dir) f = artifacts.GetCXXFromCompilerArtifacts(f, host_compiler_dir) # Build libcxx. CC = properties.WithProperties('%(cc_path)s') CXX = properties.WithProperties('%(cxx_path)s') HEADER_INCLUDE = \ properties.WithProperties('-I %s' % os.path.join('%(builddir)s', source_path, 'include')) SOURCE_LIB = \ properties.WithProperties(os.path.join('%(builddir)s', source_path, 'lib', 'libc++.1.dylib')) f.addStep( buildbot.steps.shell.ShellCommand(name='build.libcxx', command=['./buildit'], haltOnFailure=True, workdir=os.path.join( source_path, 'lib'), env={ 'CC': CC, 'CXX': CXX, 'TRIPLE': '-apple-' })) # Get the 'lit' sources if we need to. if lit_dir is None: lit_dir = 'lit.src' f.addStep( svn.SVN( name='pull.lit', mode='incremental', method='fresh', repourl='http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit', workdir=lit_dir, alwaysUseLatest=False)) # Install a copy of 'lit' in a virtualenv. f.addStep( buildbot.steps.shell.ShellCommand(name='venv.lit.clean', command=['rm', '-rf', 'lit.venv'], workdir='.', haltOnFailure=True)) f.addStep( buildbot.steps.shell.ShellCommand( name='venv.lit.make', command=['/usr/local/bin/virtualenv', 'lit.venv'], workdir='.', haltOnFailure=True)) f.addStep( buildbot.steps.shell.ShellCommand( name='venv.lit.install', command=[ properties.WithProperties('%(builddir)s/lit.venv/bin/python'), 'setup.py', 'install' ], workdir=lit_dir, haltOnFailure=True)) # Run the tests with the system's dylib f.addStep( lit_test_command.LitTestCommand( name='test.libcxx.system', command=[ properties.WithProperties('%(builddir)s/lit.venv/bin/lit'), '-v', '--show-xfail', '--show-unsupported', properties.WithProperties( '--param=cxx_under_test=%(cxx_path)s'), '--param=use_system_lib=true', 'sources/test' ], workdir='.')) # Run the tests with the newly built dylib f.addStep( lit_test_command.LitTestCommand( name='test.libcxx.new', command=[ properties.WithProperties('%(builddir)s/lit.venv/bin/lit'), '-v', '--show-xfail', '--show-unsupported', properties.WithProperties( '--param=cxx_under_test=%(cxx_path)s'), '--param=use_system_lib=false', 'sources/test' ], workdir='.')) return f
def test_no_repourl_and_baseURL(self): self.assertRaises(ValueError, lambda: svn.SVN())
def test_repourl_and_baseURL(self): self.assertRaises( ValueError, lambda: svn.SVN(svnurl='http://svn.local/app/trunk@HEAD', baseURL='http://svn.local/app/trunk@HEAD'))
def test_repourl_and_baseURL(self): self.assertRaises( config.ConfigErrors, lambda: svn.SVN(repourl='http://svn.local/app/trunk', baseURL='http://svn.local/app/trunk'))