Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testBasic(self):
# test basic substitution with WithProperties
self.props.setProperty("revision", "47", "test")
command = WithProperties("build-%s.tar.gz", "revision")
self.failUnlessEqual(self.props.render(command),
"build-47.tar.gz")
command=['echo', use_cc],
property='use_cc',
description='set cc',
workdir=lldb_srcdir))
DOTEST_OPTS = ' '.join(['--executable',
'%(lldb_bindir)s/lldb',
'--filecheck',
'%(lldb_bindir)s/FileCheck',
'--framework', '%(lldb_bindir)s/LLDB.framework',
'-A', 'x86_64',
'-C', 'clang',
'-s', '../../build/lldb-test-traces'])
f.addStep(LitTestCommand(name='lldb-test',
command=['./dosep.py',
'--options',
WithProperties(DOTEST_OPTS)],
haltOnFailure=False,
workdir='%s/test' % lldb_srcdir,
env={'DYLD_FRAMEWORK_PATH' : WithProperties('%(lldb_bindir)s')}))
# Remote test steps
if remote_configs is not None:
# Source structure to use cmake command
f.addStep(SetProperty(name='get tblgen bindir',
command=['echo',
WithProperties('%(builddir)s/' + lldb_srcdir + '/llvm-build/Release+Asserts/x86_64/Release+Asserts/bin')],
property='tblgen_bindir',
description='set tblgen binaries dir',
workdir='.'))
f = getSymbLinkSteps(f, lldb_srcdir)
for config in remote_configs:
f = getLLDBRemoteTestSteps(f,
'%(lldb_bindir)s',
'stage 1')
install_prefix - The directory the build has been installed to.
gcs_directory - The subdirectory of the bucket root to upload to. This
should match the builder name.
env - The environment to use. Set BOTO_CONFIG to use a configuration file
in a non-standard location, and BUCKET to use a different GCS bucket.
gcs_url_property - Property to assign the GCS url to.
"""
gcs_url_fmt = ('gs://%(gcs_bucket)s/%(gcs_directory)s/'
'clang-r%(got_revision)s-t%(now)s-b%(buildnumber)s.tar.xz')
time_fmt = '%Y-%m-%d_%H-%M-%S'
output_file_name = '../install.tar.xz'
gcs_url = \
WithProperties(
gcs_url_fmt,
gcs_bucket=lambda _: env.get('BUCKET', 'llvm-build-artifacts'),
gcs_directory=lambda _: gcs_directory,
now=lambda _: datetime.utcnow().strftime(time_fmt))
if gcs_url_property:
f.addStep(SetProperty(
name="record GCS url for " + package_name,
command=['echo', gcs_url],
property=gcs_url_property))
if use_pixz_compression:
# tweak the xz compression level to generate packages faster
tar_command = ['tar', '-Ipixz', '-cvf', output_file_name, '.']
else:
xz_command = 'xz -{0}'.format(xz_compression_factor)
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
f.addStep(buildbot.steps.shell.SetProperty(name='gcc.search.paths.%s' % stage,
command=[WithProperties(prev_gcc),
'-print-search-dirs'],
extract_fn=extractSearchPaths,
haltOnFailure=True,
description=['gcc', 'search paths',
stage], env=cur_env))
cur_env = cur_env.copy();
if 'LIBRARY_PATH' in env:
cur_env['LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s'+':'+env['LIBRARY_PATH'])
else:
cur_env['LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s')
if 'LD_LIBRARY_PATH' in env:
cur_env['LD_LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s'+':'+env['LD_LIBRARY_PATH'])
else:
cur_env['LD_LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s')
# Build everything using the DragonEgg plugin from the previous stage.
if prev_plugin is not None:
prev_gcc += ' -fplugin=' + prev_plugin
prev_gxx += ' -fplugin=' + prev_plugin
# Build LLVM with the just built GCC and install it.
llvm_obj_dir = 'llvm.obj.%s' % stage
if clean:
f.addStep(ShellCommand(name='rm-%s' % llvm_obj_dir,
command=['rm', '-rf', llvm_obj_dir],
haltOnFailure=True,
description=['rm build dir', 'llvm', stage],
workdir='.', env=cur_env))
f.addStep(Configure(name='configure.llvm.%s' % stage,
command=(['../' + llvm_src_dir + '/configure',
def AddRunCommandList(self, command_list, description='Run', timeout=None,
halt_on_failure=False, is_upload_step=False,
is_rebaseline_step=False):
"""Runs a list of arbitrary commands."""
# TODO(epoger): Change this so that build-step output shows each command
# in the list separately--that will be a lot easier to follow.
#
# TODO(epoger): For now, this wraps the total command with WithProperties()
# because *some* callers need it, and we can't use the string.join() command
# to concatenate strings that have already been wrapped with
# WithProperties(). Once I figure out how to make the build-step output
# show each command separately, maybe I can remove this wrapper.
self.AddRunCommand(command=WithProperties(' && '.join(command_list)),
description=description, timeout=timeout,
halt_on_failure=halt_on_failure,
is_upload_step=is_upload_step,
is_rebaseline_step=is_rebaseline_step)
upload_tarball,
trigger_deb_build
])
rm_rf = ShellCommand(command=["find", ".", "-delete"], workdir=Property('workdir'))
debian_checkout = ShellCommand(command=["git", "clone",
Property("debian-repo"), "-b" "unreleased", "."])
fetch_upstream_branch = ShellCommand(
command=["git", "branch", "upstream", "origin/upstream"],
warnOnFailure=True)
download_tarball = FileDownload(
mastersrc=WithProperties("public_html/%(component)s/%(tarball)s"),
slavedest=WithProperties("%(workdir)s/%(tarball)s"))
import_orig = ShellCommand(
command=["git-import-orig",
WithProperties("--upstream-version=%(tarball_version)s"),
WithProperties("%(workdir)s/%(tarball)s")])
update_changelog = ShellCommand(
command=["git-dch", "--auto", "--snapshot"],
env={"EDITOR":"/bin/true"})
build_deb_package = ShellCommand(command=["git-buildpackage", "--git-ignore-new", "-us", "-uc"])
deb_factory = BuildFactory([
rm_rf,
debian_checkout,
fetch_upstream_branch,
download_tarball,
import_orig,
update_changelog,
build_deb_package
])
bindir,
target_arch,
env):
if env is None:
env = {}
llvm_srcdir = 'llvm'
llvm_builddir = 'build/android-' + target_arch
abiMap={
'i386':'x86',
'arm':'armeabi',
'aarch64':'aarch64'
}
# Construct cmake
cmake_args = ["cmake", "-GNinja"]
cmake_args.append(WithProperties("-DCMAKE_BUILD_TYPE=%s" % build_type))
cmake_args.append(WithProperties('%(builddir)s/' + llvm_srcdir))
cmake_args.append(WithProperties('-DCMAKE_TOOLCHAIN_FILE=' + '%(builddir)s/' + llvm_srcdir + '/tools/lldb/cmake/platforms/Android.cmake'))
cmake_args.append(WithProperties('-DANDROID_TOOLCHAIN_DIR=' + '%(toolchain_build)s'))
cmake_args.append('-DANDROID_ABI=' + abiMap[target_arch])
cmake_args.append('-DCMAKE_CXX_COMPILER_VERSION=4.9')
cmake_args.append('-DLLVM_TARGET_ARCH=' + target_arch)
cmake_args.append('-DLLVM_HOST_TRIPLE=' + target_arch + '-unknown-linux-android')
cmake_args.append(WithProperties('-DLLVM_TABLEGEN=%(tblgen_bindir)s/llvm-tblgen'))
cmake_args.append(WithProperties('-DCLANG_TABLEGEN=%(tblgen_bindir)s/clang-tblgen'))
f.addStep(Configure(name='cmake-android-%s' % target_arch,
command=cmake_args,
env=env,
haltOnFailure=True,
workdir=llvm_builddir))
return f
# Set symbolic links, so the folder structure will be llvm, llvm/tools/clang, llvm/tools/lldb
terminatecmd = shellcmd + ['pkill', 'lldb-server']
cleandircmd = WithProperties('ssh %(remote_host)s rm -r %(remote_dir)s/*')
f.addStep(ShellCommand(name="rsync lldb-server",
command=['rsync',
'-havL',
'bin/lldb-server',
WithProperties('%(remote_host)s:%(remote_dir)s')],
description="rsync lldb-server " + stepDesc,
haltOnFailure=True,
env=env,
workdir='%s' % llvm_builddir))
f.addStep(ShellCommand(name="rsync python2.7",
command=['rsync',
'-havL',
'lib/python2.7',
WithProperties('%(remote_host)s:%(remote_dir)s')],
description="rsync python2.7 " + stepDesc,
haltOnFailure=True,
env=env,
workdir='%s' % llvm_builddir))
elif remote_config.platform is 'android':
shellcmd = ['adb',
'-s',
WithProperties('%(deviceid)s'),
'shell']
hostname = '127.0.0.1'
launchcmd = ['screen', '-d', '-m'] + shellcmd + [WithProperties("TMPDIR=%(remote_dir)s/tmp")]
terminatecmd = 'ps | grep lldb-server | awk \'{print $2}\' | xargs'
terminatecmd = WithProperties('adb -s %(deviceid)s shell ' + terminatecmd + ' adb -s %(deviceid)s shell kill')
cleandircmd = WithProperties('adb -s %(deviceid)s shell rm -rf %(remote_dir)s/*')
# compile lldb-server for target platform
f = getLLDBCmakeAndCompileSteps(f,
# Build dragonegg with the just built LLVM.
dragonegg_obj_dir = 'dragonegg.obj'
if clean:
f.addStep(ShellCommand(name='rm-%s' % dragonegg_obj_dir,
command=['rm', '-rf', dragonegg_obj_dir],
description='rm build dir dragonegg',
haltOnFailure=True, workdir='.', env=env))
f.addStep(WarningCountingShellCommand(
name='compile.dragonegg',
command=['nice', '-n', '10',
'make', '-f', '../' + dragonegg_src_dir + '/Makefile',
WithProperties('-j%s' % jobs),
WithProperties('GCC=' + gcc),
WithProperties('LLVM_CONFIG=%(builddir)s/' +
llvm_install_dir + '/bin/llvm-config'),
WithProperties('TOP_DIR=%(builddir)s/' + dragonegg_src_dir)
],
haltOnFailure=True,
description='compiling dragonegg',
descriptionDone='compile dragonegg',
workdir=dragonegg_obj_dir, env=env, timeout=timeout*60))
# Run the dragonegg testsuite.
testsuite_output_dir = dragonegg_obj_dir + '/test/Output'
if clean:
f.addStep(ShellCommand(name='rm-%s' % testsuite_output_dir,
command=['rm', '-rf', testsuite_output_dir],
description='rm test-suite output directory',
haltOnFailure=True, workdir='.', env=env))
f.addStep(LitTestCommand(name='make.check',
command=['nice', '-n', '10',