diff --git a/buildbot/osuosl/master/config/builders.py b/buildbot/osuosl/master/config/builders.py --- a/buildbot/osuosl/master/config/builders.py +++ b/buildbot/osuosl/master/config/builders.py @@ -2458,6 +2458,16 @@ ], )}, + {'name' : 'bolt-x86_64-ubuntu-nfc', + 'tags' : ["bolt"], + 'collapseRequests': False, + 'workernames' : ['bolt-worker'], + 'builddir': "bolt-x86_64-ubuntu-nfc", + 'factory' : AnnotatedBuilder.getAnnotatedBuildFactory( + script="bolt-nfc.py", + depends_on_projects=['llvm', 'bolt'], + )}, + {'name': "bolt-x86_64-ubuntu-dylib", 'tags': ["bolt"], 'collapseRequests': False, diff --git a/zorg/buildbot/builders/annotated/bolt-nfc.py b/zorg/buildbot/builders/annotated/bolt-nfc.py new file mode 100644 --- /dev/null +++ b/zorg/buildbot/builders/annotated/bolt-nfc.py @@ -0,0 +1,78 @@ +#!/usr/bin/python3 + +import os +import subprocess +import sys +import traceback +import util +from contextlib import contextmanager + +def main(): + source_dir = os.path.join('..', 'llvm-project') + + with step('cmake'): + # On most systems the default generator is make and the default + # compilers are gcc and g++. We make it explicit here that we want + # clang and ninja which reduces one step of setting environment + # variables when setting up workers. + cmake_args = ['-GNinja', + '-DCMAKE_BUILD_TYPE=Release', + '-DCMAKE_C_COMPILER=clang', + '-DCMAKE_CXX_COMPILER=clang++', + '-DLLVM_APPEND_VC_REV=OFF', + '-DLLVM_CCACHE_BUILD=ON', + '-DLLVM_ENABLE_ASSERTIONS=ON', + '-DLLVM_ENABLE_LLD=ON', + '-DLLVM_ENABLE_PROJECTS=bolt', + '-DLLVM_TARGETS_TO_BUILD=X86;AArch64', + '-DBOLT_CLANG_EXE=/usr/bin/clang', + '-DBOLT_LLD_EXE=/usr/bin/ld.lld', + ] + + run_command(['cmake', os.path.join(source_dir, 'llvm')] + cmake_args) + + with step('build bolt'): + run_command(['ninja', 'bolt']) + + with step('check-bolt'): + run_command(['ninja', 'check-bolt']) + + with step('nfc-check-setup'): + run_command([os.path.join(source_dir, 'bolt', 'utils', + 'nfc-check-setup.py')]) + + with step('nfc-check-bolt', warn_on_fail=True): + run_command([os.path.join('bin', 'llvm-lit'), '-sv', '-j2', + # bolt-info will always mismatch in NFC mode + '--xfail=bolt-info.test', + 'tools/bolt/test']) + + +@contextmanager +def step(step_name, warn_on_fail=False): + util.report('@@@BUILD_STEP {}@@@'.format(step_name)) + try: + yield + except Exception as e: + if isinstance(e, subprocess.CalledProcessError): + util.report( + '{} exited with return code {}.'.format(e.cmd, e.returncode) + ) + util.report('The build step threw an exception...') + traceback.print_exc() + + if warn_on_fail: + util.report('@@@STEP_WARNINGS@@@') + else: + util.report('@@@STEP_FAILURE@@@') + finally: + sys.stdout.flush() + + +def run_command(cmd, directory='.'): + util.report_run_cmd(cmd, cwd=directory) + + +if __name__ == '__main__': + sys.path.append(os.path.dirname(__file__)) + sys.exit(main())