Skip to content

[BOLT] Mark build skipped when tests did not run #468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
23 changes: 22 additions & 1 deletion zorg/buildbot/builders/BOLTBuilder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from buildbot.plugins import steps
from buildbot.process.results import SUCCESS, FAILURE, WARNINGS
from buildbot.process.build import Build
from buildbot.process.results import SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY, CANCELLED
from buildbot.steps.shell import ShellCommand
from twisted.internet import defer
from zorg.buildbot.builders.UnifiedTreeBuilder import getLLVMBuildFactoryAndSourcecodeSteps, addCmakeSteps, addNinjaSteps
from zorg.buildbot.commands.LitTestCommand import LitTestCommand
from zorg.buildbot.commands.CmakeCommand import CmakeCommand
Expand Down Expand Up @@ -36,6 +38,7 @@ def getBOLTCmakeBuildFactory(
depends_on_projects=depends_on_projects,
**kwargs) # Pass through all the extra arguments.

f.buildClass = SkipAwareBuild
if bolttests:
checks += ['check-large-bolt']
extra_configure_args += [
Expand Down Expand Up @@ -168,3 +171,21 @@ def getBOLTCmakeBuildFactory(
])

return f
class SkipAwareBuild(Build):
"""
Custom Build class that marks the overall build status as skipped when no
BOLT tests have run and no other important statuses are logged.

This is done by overriding stepDone, which merges the results of each step
to the overall build.
"""
@defer.inlineCallbacks
def stepDone(self, results, step):
# Run the default logic.
terminate = yield Build.stepDone(self, results, step)

# Specialize by setting the overall build result to skipped when no
# tests have ran and no other errors occurred.
if step.name == "nfc-check-bolt" and results == SKIPPED and self.results not in (FAILURE, WARNINGS, EXCEPTION, RETRY, CANCELLED):
self.results = SKIPPED
return terminate