Skip to content

Commit 4029787

Browse files
[BOLT] Mark build skipped when tests did not run (#468)
If in-tree tests do not run, mark the whole build as skipped. Note that when this happens, out-of-tree tests also do not run. This helps when navigating Buildbot's build requests: - Skipped builds indicate the change was unrelated to BOLT. - Any other errors are still reported. - For breaking changes that need reversal, builds will show as SKIPPED or FAILURE depending on whether llvm-bolt was affected, instead of SUCCESS or FAILURE, which can be confusing.
1 parent 5ea6708 commit 4029787

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

zorg/buildbot/builders/BOLTBuilder.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from buildbot.plugins import steps
2-
from buildbot.process.results import SUCCESS, FAILURE, WARNINGS
2+
from buildbot.process.build import Build
3+
from buildbot.process.results import SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY, CANCELLED
34
from buildbot.steps.shell import ShellCommand
5+
from twisted.internet import defer
46
from zorg.buildbot.builders.UnifiedTreeBuilder import getLLVMBuildFactoryAndSourcecodeSteps, addCmakeSteps, addNinjaSteps
57
from zorg.buildbot.commands.LitTestCommand import LitTestCommand
68
from zorg.buildbot.commands.CmakeCommand import CmakeCommand
@@ -36,6 +38,7 @@ def getBOLTCmakeBuildFactory(
3638
depends_on_projects=depends_on_projects,
3739
**kwargs) # Pass through all the extra arguments.
3840

41+
f.buildClass = SkipAwareBuild
3942
if bolttests:
4043
checks += ['check-large-bolt']
4144
extra_configure_args += [
@@ -168,3 +171,21 @@ def getBOLTCmakeBuildFactory(
168171
])
169172

170173
return f
174+
class SkipAwareBuild(Build):
175+
"""
176+
Custom Build class that marks the overall build status as skipped when no
177+
BOLT tests have run and no other important statuses are logged.
178+
179+
This is done by overriding stepDone, which merges the results of each step
180+
to the overall build.
181+
"""
182+
@defer.inlineCallbacks
183+
def stepDone(self, results, step):
184+
# Run the default logic.
185+
terminate = yield Build.stepDone(self, results, step)
186+
187+
# Specialize by setting the overall build result to skipped when no
188+
# tests have ran and no other errors occurred.
189+
if step.name == "nfc-check-bolt" and results == SKIPPED and self.results not in (FAILURE, WARNINGS, EXCEPTION, RETRY, CANCELLED):
190+
self.results = SKIPPED
191+
return terminate

0 commit comments

Comments
 (0)