Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions buildbot/osuosl/master/config/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from zorg.buildbot.builders import TestSuiteBuilder
from zorg.buildbot.builders import BOLTBuilder
from zorg.buildbot.builders import DebugifyBuilder
from zorg.buildbot.builders import ScriptedBuilder

from zorg.buildbot.builders import HtmlDocsBuilder
from zorg.buildbot.builders import DoxygenDocsBuilder
Expand Down Expand Up @@ -1310,28 +1311,9 @@ def collapseRequestsDoxygen(master, builder, req1, req2):
'tags' : ["polly"],
'workernames' : ["polly-x86_64-fdcserver", "minipc-1050ti-linux"],
'builddir': "polly-x86_64-linux-test-suite",
'factory' : PollyBuilder.getPollyBuildFactory(
clean=False,
install=False,
make='ninja',
extraCmakeArgs=[
"-G", "Ninja",
"-DCMAKE_C_COMPILER_LAUNCHER=ccache",
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
"-DLLVM_ENABLE_ASSERTIONS=True",
"-DLLVM_TARGETS_TO_BUILD='X86;NVPTX'",
"-DCLANG_ENABLE_ARCMT=OFF",
"-DCLANG_ENABLE_STATIC_ANALYZER=OFF",
"-DCLANG_ENABLE_OBJC_REWRITER=OFF"
],
testsuite=True,
extraTestsuiteCmakeArgs=[
"-G", "Ninja",
"-DTEST_SUITE_COLLECT_COMPILE_TIME=OFF",
"-DTEST_SUITE_COLLECT_STATS=OFF",
"-DTEST_SUITE_COLLECT_CODE_SIZE=OFF",
util.Interpolate("-DTEST_SUITE_EXTERNALS_DIR=%(prop:builddir)s/../../test-suite-externals"),
]
'factory' : ScriptedBuilder.getScriptedBuildFactory(
"polly/ci/polly-x86_64-linux-test-suite.py",
depends_on_projects=["llvm", "clang", "polly"],
)},

# AOSP builders.
Expand Down
79 changes: 79 additions & 0 deletions zorg/buildbot/builders/ScriptedBuilder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import os

from buildbot.plugins import steps, util

from zorg.buildbot.commands.AnnotatedCommand import AnnotatedCommand
from zorg.buildbot.process.factory import LLVMBuildFactory


def getScriptedBuildFactory(
scriptpath,
*scriptargs,
depends_on_projects,
env=None,
timeout=1200,
script_interpreter="python",
warnOnWarnings=False,
**kwargs,
):
assert scriptpath, "Must specify a script the worker is going to execute"
assert (
depends_on_projects
), "Must specify a set of projects; any change one of those projects will trigger a worker run"

llvm_srcdir = "llvm.src"

# If true, clean everything, including source dirs
def cleanBuildRequested(step):
return step.build.getProperty("clean")

f = LLVMBuildFactory(
depends_on_projects=depends_on_projects, llvm_srcdir=llvm_srcdir
)

# When cleaning, delete the source directory; everything should be deleted
# by the build script itself.
f.addStep(
steps.RemoveDirectory(
name="clean-srcdir",
dir=f.monorepo_dir,
warnOnFailure=True,
doStepIf=cleanBuildRequested,
)
)

# Checkout the llvm-project repository
f.addGetSourcecodeSteps(**kwargs)

# Prepare running the build script
command = [
script_interpreter,
os.path.join(
"..", f.monorepo_dir, scriptpath
), # Location of the build script is relative to the llvm-project checkout
f"--workdir=.", # AnnotatedCommand executes the script with build/ as cwd
]

# Add any user-defined command line switches
command += [util.Interpolate(arg) for arg in scriptargs]

merged_env = {
"TERM": "dumb" # Be cautious and disable color output from all tools.
}
for k, v in env or {}:
# Overwrite pre-set items with the given ones, so user can set anything.
merged_env[k] = util.Interpolate(v)

f.addStep(
AnnotatedCommand(
name="annotate",
description="Run build script",
timeout=timeout,
haltOnFailure=True,
warnOnWarnings=warnOnWarnings,
command=command,
env=merged_env,
)
)

return f
2 changes: 2 additions & 0 deletions zorg/buildbot/commands/AnnotatedCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ def __init__(self, **kwargs):
'BUILDBOT_BRANCH': util.Interpolate('%(prop:branch:-None)s'),
'BUILDBOT_BUILDERNAME': util.Interpolate('%(prop:buildername:-None)s'),
'BUILDBOT_BUILDNUMBER': util.Interpolate('%(prop:buildnumber:-None)s'),
'BUILDBOT_CLEAN': util.Interpolate('%(prop:clean:-)s'),
'BUILDBOT_CLEAN_OBJ': util.Interpolate('%(prop:clean_obj:-)s'),
'BUILDBOT_CLOBBER': util.Interpolate('%(prop:clobber:+1)s'),
'BUILDBOT_GOT_REVISION': util.Interpolate('%(prop:got_revision:-None)s'),
'BUILDBOT_REVISION': util.Interpolate('%(prop:revision:-None)s'),
Expand Down