Skip to content

Commit 41624c2

Browse files
[BOLT] Add sanity check for frozen llvm-bolt (#487)
Some patches can cause the llvm-bolt binary to hang, which stalls or fails the test pipeline. Add a simple sanity check that runs: ``` llvm-bolt --version ``` with a 30-second timeout. If the command does not complete in time, flunk the build. Also, sets maxTime for nfc-check-validation and reduce the number of lit workers for in-tree tests.
1 parent 9b44a4c commit 41624c2

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

zorg/buildbot/builders/BOLTBuilder.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def getBOLTCmakeBuildFactory(
103103
boltOld = "bin/llvm-bolt.old"
104104

105105
f.addSteps([
106-
# Cleanup binaries and markers from previous NFC-mode runs.
106+
# Cleanup old/new binaries and markers from previous NFC-mode runs.
107107
ShellCommand(
108108
name='clean-nfc-check',
109109
command=(
@@ -114,7 +114,9 @@ def getBOLTCmakeBuildFactory(
114114
haltOnFailure=False,
115115
flunkOnFailure=False,
116116
env=env),
117-
# Build the current and previous revision of llvm-bolt.
117+
# Build the current and previous revision of llvm-bolt as
118+
# llvm-bolt.new and llvm-bolt.old. Also, creates a marker to force
119+
# in-tree tests in case additional source code changes are detected.
118120
ShellCommand(
119121
name='nfc-check-setup',
120122
command=[
@@ -130,6 +132,18 @@ def getBOLTCmakeBuildFactory(
130132
haltOnFailure=False,
131133
flunkOnFailure=False,
132134
env=env),
135+
# Verify that the llvm-bolt binary can report its version within a
136+
# reasonable amount of time.
137+
ShellCommand(
138+
name='llvm-bolt-version-check',
139+
command=(f"{boltNew} --version"),
140+
description=('Check that llvm-bolt binary passes a simple test'
141+
'before proceeding with testing.'),
142+
descriptionDone=["llvm-bolt --version"],
143+
haltOnFailure=True,
144+
flunkOnFailure=True,
145+
maxTime=30,
146+
env=env),
133147
# Validate that NFC-mode comparison is meaningful by checking:
134148
# - the old and new binaries exist
135149
# - no unique IDs are embedded in the binaries
@@ -154,6 +168,7 @@ def getBOLTCmakeBuildFactory(
154168
haltOnFailure=False,
155169
warnOnFailure=True,
156170
warnOnWarnings=True,
171+
maxTime=30,
157172
decodeRC={0: SUCCESS, 1: FAILURE, 2: WARNINGS},
158173
descriptionDone=["NFC-Mode Validation"],
159174
env=env),
@@ -174,10 +189,12 @@ def getBOLTCmakeBuildFactory(
174189
haltOnFailure=False,
175190
env=env),
176191
# Run in-tree tests if the llvm-bolt binary has changed, or if
177-
# relevant source code changes are detected.
192+
# relevant source code changes are detected. Lower scheduling
193+
# priority with nice to reduce CPU contention in virtualized
194+
# environments. This step relinks the llvm-bolt binary if needed.
178195
LitTestCommand(
179196
name='nfc-check-bolt',
180-
command=["ninja", "check-bolt"],
197+
command=("nice -n 5 ninja check-bolt"),
181198
description=["running", "NFC", "check-bolt"],
182199
descriptionDone=["NFC", "check-bolt", "completed"],
183200
warnOnFailure=True,
@@ -186,10 +203,10 @@ def getBOLTCmakeBuildFactory(
186203
doStepIf=FileDoesNotExist(f"build/{skipInTree}"),
187204
env=env),
188205
# Run out-of-tree large tests if the llvm-bolt binary has changed.
206+
# Lower scheduling priority, as above.
189207
LitTestCommand(
190208
name='nfc-check-large-bolt',
191-
command=['bin/llvm-lit', '-sv', '-j2',
192-
'tools/bolttests'],
209+
command=('nice -n 5 bin/llvm-lit -v -j2 tools/bolttests'),
193210
description=["running", "NFC", "check-large-bolt"],
194211
descriptionDone=["NFC", "check-large-bolt", "completed"],
195212
warnOnFailure=True,

0 commit comments

Comments
 (0)