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 @@ -2420,6 +2420,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-clang-bolt", '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,77 @@ +#!/usr/bin/python3 + +import argparse +import os +import subprocess +import sys +import traceback +import util +from contextlib import contextmanager +from enum import Enum + +class FailAction(Enum): + HALT = 1 + WARN = 2 + +def main(): + source_dir = os.path.join('..', 'llvm-project') + + with step('cmake', on_fail=FailAction.HALT): + # 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_C_COMPILER=clang', + '-DCMAKE_CXX_COMPILER=clang++'] + + cmake_args.append('-DCMAKE_BUILD_TYPE=Release') + cmake_args.append('-DLLVM_ENABLE_ASSERTIONS=ON') + cmake_args.append('-DLLVM_ENABLE_PROJECTS="bolt;clang;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'): + run_command([os.path.join('bin', 'llvm-lit'), '-sv', '-j2', + 'tools/bolt/test'], warn_on_fail=True) + + +@contextmanager +def step(step_name, warn_on_fail=False): + util.report('@@@BUILD_STEP {}@@@'.format(step_name)) + if warn_on_fail: + util.report('@@@STEP_WARNINGS@@@') + else: + util.report('@@@HALT_ON_FAILURE@@@') + 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() + + 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())