Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stage1_config],
workdir = "llvm.obj",
env = merged_env,
timeout = timeout * 60))
# Run LLVM tests (stage 1).
f.addStep(LitTestCommand(name = 'test.llvm.stage1',
command = [make, "check-lit", "VERBOSE=1"],
description = ["testing", "llvm"],
descriptionDone = ["test", "llvm"],
workdir = 'llvm.obj',
env = merged_env))
# Clean up llvm-gcc.
if clean:
f.addStep(ShellCommand(name="rm-llvm-gcc.obj.stage1",
command=["rm", "-rf", "llvm-gcc.obj"],
haltOnFailure = True,
description = ["rm build dir",
"llvm-gcc"],
workdir = ".",
env = merged_env))
# Configure llvm-gcc.
base_llvmgcc_configure_args = ["../llvm-gcc.src/configure"]
llvmgcc_languages = "--enable-languages=c,c++"
if extra_languages:
llvmgcc_languages = llvmgcc_languages + "," + extra_languages
base_llvmgcc_configure_args.append(llvmgcc_languages)
if gxxincludedir:
base_llvmgcc_configure_args.append('--with-gxx-include-dir=' + gxxincludedir)
base_llvmgcc_configure_args.extend(extra_configure_args)
def start(self):
# Always do normal clean for try slaves, since nuking confuses the Chromium
# scripts' GClient sync step.
if self.is_try_slave or self.build_status_oracle.LastBuildSucceeded():
self.description = ['Clean']
cmd = 'python %s ' % self.clean_script
else:
self.build_status_oracle.ForgetLastBuild()
self.description = ['Nuke Repository', '(Previous Failed)']
cmd = 'python %s --nuke' % self.clean_script
self.setCommand(cmd)
ShellCommand.start(self)
class GenerateCodeCoverage(ShellCommand):
"""This custom shell command generates coverage HTML using genhtml.
The command will dump the HTML output into coverage_dir, in a directory
whose name is generated from the build number and slave name. We will
expect that the coverage directory is somewhere under the web server root
(i.e. public html root) that corresponds to the web server URL. That is, if
we write Foo to the coverage directory we expect that directory to be
reachable from url/Foo.
"""
def __init__(self, build_status_oracle, coverage_url, coverage_dir,
coverage_file, **kwargs):
"""Prepares the coverage command.
Args:
build_status_oracle: class that knows if the current build has failed.
def __init__(self, *args, **kwargs):
""" Initialize, with args being the command items
the ShellCommand class will render properties in *args for us
"""
StepOE.__init__(self, keeper_conf=kwargs.pop('keeper_conf', None), **kwargs)
kw2 = kwargs.copy()
if args:
kw2['command'] = [a or '' for a in args]
kw2.pop('workdir', None)
kw2.setdefault('logEnviron', False)
bs.ShellCommand.__init__(self, workdir=self.workdir, **kw2)
class MonitoredShellCommand(ShellCommand):
"""Wraps a shell command and notifies the oracle if the command fails."""
def __init__(self, build_status_oracle, **kwargs):
ShellCommand.__init__(self, **kwargs)
self.addFactoryArguments(build_status_oracle=build_status_oracle)
self.build_status_oracle = build_status_oracle
def finished(self, results):
if (results == builder.FAILURE or results == builder.EXCEPTION):
self.build_status_oracle.SetLastBuildAsFailed()
ShellCommand.finished(self, results)
class SmartClean(ShellCommand):
"""Cleans the repository fully or partially depending on the build state."""
def __init__(self, build_status_oracle, is_try_slave, path_joiner, **kwargs):
"""Args:
build_status_oracle: class that knows if the previous build failed.
is_try_slave: if the current factory is a try slave.
path_joiner: function to create paths for the current platform, given
a number of path elements in string form.
"""
ShellCommand.__init__(self, **kwargs)
self.addFactoryArguments(build_status_oracle=build_status_oracle,
is_try_slave=is_try_slave, path_joiner=path_joiner)
self.name = "Clean"
self.haltOnFailure = True
self.build_status_oracle = build_status_oracle
def __init__(self, build_status_oracle, **kwargs):
ShellCommand.__init__(self, **kwargs)
self.addFactoryArguments(build_status_oracle=build_status_oracle)
self.build_status_oracle = build_status_oracle
# Add our venv to sys path
'PATH=$VE/bin:$PATH',
# Adjust $PYTHON
'PYTHON=$VE/bin/python',
# We need the django settings module setup to import
'DJANGO_SETTINGS_MODULE=disqus.conf.settings.test',
# Tell mule to start its queue server
'mule start --host=%(mulehost)s --pid=%(mulepid)s $PWD/build/disqus || exit 1',
]
self.command = WithProperties("\n".join(command))
ShellCommand.start(self)
name = 'test.libcxxabi',
command = ['make', jobs_flag, 'check-libcxxabi'],
description = ['testing', 'libcxxabi'],
descriptionDone = ['test', 'libcxxabi'],
workdir = build_path))
# Test libc++
f.addStep(LitTestCommand(
name = 'test.libcxx',
command = ['make', jobs_flag, 'check-libcxx'],
description = ['testing', 'libcxx'],
descriptionDone = ['test', 'libcxx'],
workdir = build_path))
if check_libcxx_abilist:
f.addStep(buildbot.steps.shell.ShellCommand(
name = 'test.libcxx.abilist',
command = ['make', 'check-cxx-abilist'],
description = ['testing', 'libcxx', 'abi'],
descriptionDone = ['test', 'libcxx', 'abi'],
workdir = build_path))
if check_libcxx_benchmarks:
# Build the libc++ benchmarks
f.addStep(buildbot.steps.shell.ShellCommand(
name='build.libcxx.benchmarks',
command=['make', jobs_flag, 'cxx-benchmarks'],
haltOnFailure=True, workdir=build_path))
# Run the benchmarks
f.addStep(LitTestCommand(
name = 'test.libcxx.benchmarks',
package_dst + "/%(buildername)s")],
workdir=".",
warnOnFailure=True,
flunkOnFailure=False,
haltOnFailure=False,
env=merged_env))
return f
# Clean up llvm (stage 2).
#
# We always cleanly build the stage 2. If the compiler has been
# changed on the stage 1, we cannot trust any of the intermediate file
# from the old compiler. And if the stage 1 compiler is the same, we should
# not build in the first place.
f.addStep(ShellCommand(name="rm-llvm.obj.stage2",
command=["rm", "-rf", llvm_2_objdir],
haltOnFailure=True,
description=["rm build dir", "llvm", "(stage 2)"],
workdir=".",
env=merged_env))
# Configure llvm (stage 2).
f.addStep(ShellCommand(name='cmake',
command=['cmake'] + stage2_extra_configure_args + [
'-DLLVM_BUILD_TESTS=ON',
WithProperties('-DCMAKE_C_COMPILER=%%(builddir)s/%s/bin/clang' % llvm_1_objdir), # FIXME use installdir
WithProperties('-DCMAKE_CXX_COMPILER=%%(builddir)s/%s/bin/clang++' % llvm_1_objdir),
'-DCMAKE_BUILD_TYPE=%s' % stage2_config,
"../" + llvm_srcdir],
description='cmake stage2',
workdir=llvm_2_objdir,
cmake_opts = [properties.WithProperties('-DLLVM_LIT_ARGS='+litTestArgs)]
for key in cmake_extra_opts:
cmake_opts.append('-D' + key + '=' + cmake_extra_opts[key])
# FIXME: The libc++ abilist's are generated in release mode with debug
# symbols Other configurations may contain additional non-inlined symbols.
if check_libcxx_abilist and not 'CMAKE_BUILD_TYPE' in cmake_extra_opts:
cmake_opts.append('-DCMAKE_BUILD_TYPE=RELWITHDEBINFO')
# Force libc++ to use the in-tree libc++abi unless otherwise specified.
if 'LIBCXX_CXX_ABI' not in cmake_extra_opts:
cmake_opts.append('-DLIBCXX_CXX_ABI=libcxxabi')
# Nuke/remake build directory and run CMake
f.addStep(buildbot.steps.shell.ShellCommand(
name='rm.builddir', command=['rm', '-rf', build_path],
workdir=".",
haltOnFailure=False))
if not f.is_legacy_mode:
CmakeCommand.applyRequiredOptions(cmake_opts, [
('-DLLVM_ENABLE_PROJECTS=', ";".join(f.depends_on_projects)),
])
f.addStep(buildbot.steps.shell.ShellCommand(
name='cmake', command=['cmake', rel_src_dir] + cmake_opts,
haltOnFailure=True, workdir=build_path, env=env))
# Build libcxxabi
jobs_flag = properties.WithProperties('-j%(jobs)s')
f.addStep(buildbot.steps.shell.ShellCommand(
"""
self.description = ["checking out"]
self.descriptionDone = ["check out"]
self.cvsroot = cvsroot
self.branch = branch
self.date = date
if type(cvsmodule) == str:
cvsmodule = [cvsmodule]
self.targets = cvsmodule
self.command = None # filled in on start()
mykwargs = kwargs
if 'env' not in mykwargs:
mykwargs['env'] = {}
mykwargs['env']['CVSROOT'] = self.cvsroot
mykwargs['env']['CVS_RSH'] = 'ssh'
ShellCommand.__init__(self, workdir, **mykwargs)