Skip to content

Commit b03cc23

Browse files
[BOLT] Set nfc-tests once
When setting up the nfc-mode tests, avoid adding an extra pair of in-tree and out-of-tree tests that were unconditional. This was previously done with addNinjaSteps. Instead, add those later and make them conditional on llvm-bolt being modified. Since tests are now only added by BOLTBuilder: - `ninja` runs the in-tree tests to correctly build dependencies. - flunkOnFailure is set to update the build status on failures. Some nits: - the '--switch-back' flag is used (from nfc-check-setup.py). - a 'nfc-' prefix is appended to 'check-bolt-different' step - remove timing.log cleanup
1 parent cdd7fc9 commit b03cc23

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

zorg/buildbot/builders/BOLTBuilder.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,24 @@ def getBOLTCmakeBuildFactory(
7979
addNinjaSteps(
8080
f,
8181
targets=targets,
82-
checks=checks,
82+
checks = None if is_nfc else checks,
8383
env=env,
8484
**kwargs)
8585

86+
"""
87+
In NFC mode we conditionally run tests only when the llvm-bolt binary has
88+
changed between the previous and current revision. We skipped passing checks
89+
to addNinjaSteps, so we add those checks below, along with the conditional
90+
logic.
91+
"""
8692
if is_nfc:
8793
f.addSteps([
8894
ShellCommand(
8995
name='nfc-check-setup',
90-
command=[f"../{f.monorepo_dir}/bolt/utils/nfc-check-setup.py"],
96+
command=[
97+
f"../{f.monorepo_dir}/bolt/utils/nfc-check-setup.py",
98+
"--switch-back"
99+
],
91100
description=('Setup NFC testing'),
92101
warnOnFailure=True,
93102
haltOnFailure=False,
@@ -113,9 +122,8 @@ def getBOLTCmakeBuildFactory(
113122
descriptionDone=["NFC-Mode unique IDs in binaries"],
114123
env=env),
115124
ShellCommand(
116-
name='check-bolt-different',
117-
command=('find -name timing.log -delete; '
118-
'rm -f .llvm-bolt.diff; '
125+
name='nfc-check-bolt-different',
126+
command=('rm -f .llvm-bolt.diff; '
119127
'cmp -s bin/llvm-bolt.old bin/llvm-bolt.new || '
120128
'touch .llvm-bolt.diff'),
121129
description=('Check if llvm-bolt binaries are different and '
@@ -124,15 +132,12 @@ def getBOLTCmakeBuildFactory(
124132
env=env),
125133
LitTestCommand(
126134
name='nfc-check-bolt',
127-
command=['bin/llvm-lit', '-sv', '-j4',
128-
# bolt-info will always mismatch in NFC mode
129-
'--xfail=bolt-info.test',
130-
'tools/bolt/test'],
135+
command=["ninja", "check-bolt"],
131136
description=["running", "NFC", "check-bolt"],
132137
descriptionDone=["NFC", "check-bolt", "completed"],
133138
warnOnFailure=True,
134139
haltOnFailure=False,
135-
flunkOnFailure=False,
140+
flunkOnFailure=True,
136141
doStepIf=FileExists('build/.llvm-bolt.diff'),
137142
env=env),
138143
LitTestCommand(
@@ -143,7 +148,7 @@ def getBOLTCmakeBuildFactory(
143148
descriptionDone=["NFC", "check-large-bolt", "completed"],
144149
warnOnFailure=True,
145150
haltOnFailure=False,
146-
flunkOnFailure=False,
151+
flunkOnFailure=True,
147152
doStepIf=FileExists('build/.llvm-bolt.diff'),
148153
env=env),
149154
])

zorg/buildbot/builders/UnifiedTreeBuilder.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,18 @@ def trunc50(name):
233233
else:
234234
check_env = env or {}
235235

236-
for check in checks:
237-
f.addStep(LitTestCommand(name=trunc50("test-%s-%s" % (step_name, check)),
238-
command=['ninja', check],
239-
description=[
240-
"Test", "just", "built", "components", "for",
241-
check,
242-
],
243-
env=check_env,
244-
workdir=obj_dir,
245-
**kwargs # Pass through all the extra arguments.
246-
))
236+
if checks:
237+
for check in checks:
238+
f.addStep(LitTestCommand(name=trunc50("test-%s-%s" % (step_name, check)),
239+
command=['ninja', check],
240+
description=[
241+
"Test", "just", "built", "components", "for",
242+
check,
243+
],
244+
env=check_env,
245+
workdir=obj_dir,
246+
**kwargs # Pass through all the extra arguments.
247+
))
247248

248249
# Install just built components
249250
if install_dir:

0 commit comments

Comments
 (0)