Skip to content

Commit 7591950

Browse files
committed
Merge bitcoin#29329: fuzz: Print coverage summary after run_once
fab97d8 fuzz: Print coverage summary after run_once (MarcoFalke) Pull request description: This can be used to quickly check the coverage effects of a code change or qa-assets change. ACKs for top commit: dergoegge: ACK fab97d8 Tree-SHA512: 0ac913c14698f39e76e0e7bf124f182220031796d6443edb34c6e4615e128157cf746da661b216c4640a41964e977249712445ca9c005b1b4a3737adabdb4a7d
2 parents 478ac18 + fab97d8 commit 7591950

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/fuzz/test_runner.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,18 @@ def job(t, args):
348348
text=True,
349349
)
350350
output += result.stderr
351-
return output, result
351+
return output, result, t
352352

353353
jobs.append(fuzz_pool.submit(job, t, args))
354354

355+
stats = []
355356
for future in as_completed(jobs):
356-
output, result = future.result()
357+
output, result, target = future.result()
357358
logging.debug(output)
359+
if using_libfuzzer:
360+
done_stat = [l for l in output.splitlines() if "DONE" in l]
361+
assert len(done_stat) == 1
362+
stats.append((target, done_stat[0]))
358363
try:
359364
result.check_returncode()
360365
except subprocess.CalledProcessError as e:
@@ -365,6 +370,13 @@ def job(t, args):
365370
logging.info(f"Target {result.args} failed with exit code {e.returncode}")
366371
sys.exit(1)
367372

373+
if using_libfuzzer:
374+
print("Summary:")
375+
max_len = max(len(t[0]) for t in stats)
376+
for t, s in sorted(stats):
377+
t = t.ljust(max_len + 1)
378+
print(f"{t}{s}")
379+
368380

369381
def parse_test_list(*, fuzz_bin):
370382
test_list_all = subprocess.run(

0 commit comments

Comments
 (0)