Skip to content

Commit 6d5edfc

Browse files
committed
Merge bitcoin/bitcoin#32388: fuzz: Remove unused TimeoutExpired catch in fuzz runner
fa48040 fuzz: Remove unused TimeoutExpired catch in fuzz runner (MarcoFalke) Pull request description: Currently, the way to check for libFuzzer is to search the stderr of the fuzz executable when passed `-help=1` for the string `libFuzzer`. See also https://github.com/bitcoin/bitcoin/blob/14b8dfb2bd5e2ca2b7c0c9a7f7d50e1e60adf75c/contrib/devtools/deterministic-fuzz-coverage/src/main.rs#L90-L101 The python test runner additionally includes a timeout catch, which was needed before the plain `read_file` fallback was implemented, see https://github.com/bitcoin/bitcoin/blob/14b8dfb2bd5e2ca2b7c0c9a7f7d50e1e60adf75c/src/test/fuzz/fuzz.cpp#L251. However, it is no longer needed and the printed error message would be wrong, so remove it. (side-note: On Windows the fuzz executable seems to time out when an assert is hit in a debug build, see bitcoin/bitcoin#32341 (comment). However, no one is running fuzz debug on Windows. Also, the newly added debug logging is a preferable replacement in this case anyway.) ACKs for top commit: kevkevinpal: crACK [fa48040](bitcoin/bitcoin@fa48040) Crypt-iQ: crACK fa48040 marcofleon: crACK fa48040 brunoerg: code review ACK fa48040 Tree-SHA512: 64f5e3862fece9ab2b6592615b72b81e9c087dcd394b1d062a96df0d88d8b5999674f0faa1165a5998c05289c1874e29311d7b24d84fee9bc6c46d1662d29e4d
2 parents 59d3e4e + fa48040 commit 6d5edfc

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

test/fuzz/test_runner.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,24 +151,21 @@ def main():
151151
)
152152
logging.info("Please consider adding a fuzz corpus at https://github.com/bitcoin-core/qa-assets")
153153

154-
try:
155-
help_output = subprocess.run(
156-
args=[
157-
fuzz_bin,
158-
'-help=1',
159-
],
160-
env=get_fuzz_env(target=test_list_selection[0], source_dir=config['environment']['SRCDIR']),
161-
timeout=20,
162-
check=False,
163-
stderr=subprocess.PIPE,
164-
text=True,
165-
).stderr
166-
using_libfuzzer = "libFuzzer" in help_output
167-
if (args.generate or args.m_dir) and not using_libfuzzer:
168-
logging.error("Must be built with libFuzzer")
169-
sys.exit(1)
170-
except subprocess.TimeoutExpired:
171-
logging.error("subprocess timed out: Currently only libFuzzer is supported")
154+
print("Check if using libFuzzer ... ", end='')
155+
help_output = subprocess.run(
156+
args=[
157+
fuzz_bin,
158+
'-help=1',
159+
],
160+
env=get_fuzz_env(target=test_list_selection[0], source_dir=config['environment']['SRCDIR']),
161+
check=False,
162+
stderr=subprocess.PIPE,
163+
text=True,
164+
).stderr
165+
using_libfuzzer = "libFuzzer" in help_output
166+
print(using_libfuzzer)
167+
if (args.generate or args.m_dir) and not using_libfuzzer:
168+
logging.error("Must be built with libFuzzer")
172169
sys.exit(1)
173170

174171
with ThreadPoolExecutor(max_workers=args.par) as fuzz_pool:

0 commit comments

Comments
 (0)