Skip to content

Commit fab97d8

Browse files
author
MarcoFalke
committed
fuzz: Print coverage summary after run_once
1 parent e3b68b3 commit fab97d8

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
@@ -347,13 +347,18 @@ def job(t, args):
347347
text=True,
348348
)
349349
output += result.stderr
350-
return output, result
350+
return output, result, t
351351

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

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

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

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

0 commit comments

Comments
 (0)