Skip to content
Open
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
12 changes: 11 additions & 1 deletion buildbot/osuosl/master/config/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ def collapseRequestsDoxygen(master, builder, req1, req2):
clean=True,
checks=[
"check-llvm-unit",
"check-clang-unit"
"check-clang-unit",
{
'target': 'check-llvm-unit',
'env_override': {'LLVM_WINDOWS_PREFER_FORWARD_SLASH': '1'},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why exactly does this need to be passed as an env variable?

It seems like this should just be a CMake option. https://github.com/llvm/llvm-project/blob/56ccbc25315030088b04435e4828efbc22f0e926/llvm/CMakeLists.txt#L638

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows us to build only once and run tests twice: the first ones with default, and the second ones with LLVM_WINDOWS_PREFER_FORWARD_SLASH feature, rather than building twice or duplicating the bot.

'name_suffix': '-forward-slashes'
},
{
'target': 'check-clang-unit',
'env_override': {'LLVM_WINDOWS_PREFER_FORWARD_SLASH': '1'},
'name_suffix': '-forward-slashes'
}
],
extra_configure_args=[
"-DLLVM_CCACHE_BUILD=ON",
Expand Down
24 changes: 20 additions & 4 deletions zorg/buildbot/builders/UnifiedTreeBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from zorg.buildbot.process.factory import LLVMBuildFactory

import zorg.buildbot.builders.Util as builders_util
from zorg.buildbot.process.properties import MergedEnv

def getLLVMBuildFactoryAndPrepareForSourcecodeSteps(
depends_on_projects = None,
Expand Down Expand Up @@ -235,13 +236,28 @@ def trunc50(name):

if checks:
for check in checks:
f.addStep(LitTestCommand(name=trunc50("test-%s-%s" % (step_name, check)),
command=['ninja', check],
check_target = check
check_env_override = None
check_suffix = ""

if isinstance(check, dict):
check_target = check.get('target')
check_env_override = check.get('env_override')
check_suffix = check.get('name_suffix', "")

check_name = check_target + check_suffix

step_env = check_env
if check_env_override:
step_env = MergedEnv(check_env, check_env_override)

f.addStep(LitTestCommand(name=trunc50("test-%s-%s" % (step_name, check_name)),
command=['ninja', check_target],
description=[
"Test", "just", "built", "components", "for",
check,
check_name,
],
env=check_env,
env=step_env,
workdir=obj_dir,
**kwargs # Pass through all the extra arguments.
))
Expand Down
23 changes: 23 additions & 0 deletions zorg/buildbot/process/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,26 @@ def getRenderingFor(self, build):
pass

return p


@implementer(IRenderable)
class MergedEnv(object):
def __init__(self, base_env, overrides):
self.base_env = base_env
self.overrides = overrides

@defer.inlineCallbacks
def getRenderingFor(self, build):
if hasattr(build, 'render'):
base_env_rendered = yield build.render(self.base_env)
elif hasattr(build, 'properties') and hasattr(build.properties, 'render'):
base_env_rendered = yield build.properties.render(self.base_env)
else:
base_env_rendered = {}

if not isinstance(base_env_rendered, dict):
base_env_rendered = {}

merged = base_env_rendered.copy()
merged.update(self.overrides)
return merged