Skip to content

Commit 5ea6708

Browse files
[BOLT] Increase nfc-test coverage (#467)
Use `--check-bolt-sources` from nfc-check-setup.py to run tests when source files change between the current and previous revisions. Skip markers are used to indicate which tests should run: when not present the tests run. Examples: - If NFC check setup fails to execute for any reason, the tests run unconditionally. - If the current and previous llvm-bolt binaries are identical, we create two skip markers for in-tree and out-of-tree tests. - If there are other BOLT source changes, we delete the in-tree skip marker so those test can proceed.
1 parent f2ee31f commit 5ea6708

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

zorg/buildbot/builders/BOLTBuilder.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from zorg.buildbot.builders.UnifiedTreeBuilder import getLLVMBuildFactoryAndSourcecodeSteps, addCmakeSteps, addNinjaSteps
55
from zorg.buildbot.commands.LitTestCommand import LitTestCommand
66
from zorg.buildbot.commands.CmakeCommand import CmakeCommand
7-
from zorg.buildbot.conditions.FileConditions import FileExists
7+
from zorg.buildbot.conditions.FileConditions import FileDoesNotExist
88
from zorg.buildbot.process.factory import LLVMBuildFactory
99

1010
def getBOLTCmakeBuildFactory(
@@ -90,14 +90,23 @@ def getBOLTCmakeBuildFactory(
9090
logic.
9191
"""
9292
if is_nfc:
93+
# Marker for relevant source code changes, e.g., when updating tests.
94+
# Generated by nfc-check-setup.py and used to trigger the in-tree tests.
95+
hasSrcChanges = ".llvm-bolt.changes"
96+
# Individual markers to skip either in-tree or out-of-tree tests.
97+
skipInTree = ".llvm-bolt.skip.in-tree"
98+
skipOutOfTree = ".llvm-bolt.skip.out-of-tree"
99+
93100
f.addSteps([
94101
ShellCommand(
95102
name='nfc-check-setup',
96103
command=[
97-
f"../{f.monorepo_dir}/bolt/utils/nfc-check-setup.py",
98-
"--switch-back"
104+
f"../{f.monorepo_dir}/bolt/utils/nfc-check-setup.py",
105+
"--switch-back",
106+
"--check-bolt-sources"
99107
],
100108
description=('Setup NFC testing'),
109+
descriptionDone=["NFC-Mode setup"],
101110
warnOnFailure=True,
102111
haltOnFailure=False,
103112
flunkOnFailure=False,
@@ -124,9 +133,13 @@ def getBOLTCmakeBuildFactory(
124133
env=env),
125134
ShellCommand(
126135
name='nfc-check-bolt-different',
127-
command=('rm -f .llvm-bolt.diff; '
128-
'cmp -s bin/llvm-bolt.old bin/llvm-bolt.new || '
129-
'touch .llvm-bolt.diff'),
136+
command=(
137+
f'rm -f {skipInTree} {skipOutOfTree}; '
138+
f'cmp -s bin/llvm-bolt.old bin/llvm-bolt.new && ('
139+
f'touch {skipInTree}; touch {skipOutOfTree}); '
140+
f'[ -f {hasSrcChanges} ] && rm -f {skipInTree};'
141+
f'rm -f {hasSrcChanges}; '
142+
),
130143
description=('Check if llvm-bolt binaries are different and '
131144
'skip the following nfc-check steps'),
132145
haltOnFailure=False,
@@ -139,7 +152,7 @@ def getBOLTCmakeBuildFactory(
139152
warnOnFailure=True,
140153
haltOnFailure=False,
141154
flunkOnFailure=True,
142-
doStepIf=FileExists('build/.llvm-bolt.diff'),
155+
doStepIf=FileDoesNotExist(f"build/{skipInTree}"),
143156
env=env),
144157
LitTestCommand(
145158
name='nfc-check-large-bolt',
@@ -150,7 +163,7 @@ def getBOLTCmakeBuildFactory(
150163
warnOnFailure=True,
151164
haltOnFailure=False,
152165
flunkOnFailure=True,
153-
doStepIf=FileExists('build/.llvm-bolt.diff'),
166+
doStepIf=FileDoesNotExist(f"build/{skipOutOfTree}"),
154167
env=env),
155168
])
156169

0 commit comments

Comments
 (0)