diff options
author | Jack Lloyd <[email protected]> | 2018-12-04 09:15:47 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-12-04 09:15:47 -0500 |
commit | 84a88c764dfffe1b635837e5160c5f808debc6fe (patch) | |
tree | 4c5f8054f2b6f3a99717498e350bbfbc4db9c2f6 /src/scripts | |
parent | a91e85f83b1dd64460ef785625cdcdb73ccb3c9b (diff) |
Reporting for fuzz test timing
Also use 2x core count as this spends a lot of time on IO
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/test_fuzzers.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/scripts/test_fuzzers.py b/src/scripts/test_fuzzers.py index c4c2ef589..167f6dc41 100755 --- a/src/scripts/test_fuzzers.py +++ b/src/scripts/test_fuzzers.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# (C) 2017 Jack Lloyd +# (C) 2017,2018 Jack Lloyd import sys import os @@ -8,6 +8,7 @@ import subprocess import optparse import stat import multiprocessing +import time def run_fuzzer_gdb(args): (fuzzer_bin, corpus_file) = args @@ -97,7 +98,7 @@ def main(args=None): gdb_commands = None - pool = multiprocessing.Pool(None) + pool = multiprocessing.Pool(multiprocessing.cpu_count() * 2) chunk_size = 32 # arbitrary run_fuzzer_func = run_fuzzer_gdb if options.gdb else run_fuzzer @@ -111,6 +112,8 @@ def main(args=None): # passing any initial arguments, just the single iteratable map_args = [(fuzzer_bin, f) for f in corpus_files] + start = time.time() + for result in pool.map(run_fuzzer_func, map_args, chunk_size): (corpus_file, retcode, stdout, stderr) = result @@ -126,11 +129,13 @@ def main(args=None): print("Fuzzer %s produced stderr on input %s:\n%s" % (fuzzer, corpus_file, stderr)) stderr_count += 1 - print("Tested fuzzer %s with %d test cases, %d crashes" % (fuzzer, len(corpus_files), crash_count)) + duration = time.time() - start + print("Tested fuzzer %s with %d test cases, %d crashes in %.02f seconds" % (fuzzer, len(corpus_files), crash_count, duration)) sys.stdout.flush() + if crash_count > 0 or stderr_count > 0 or stdout_count > 0: - print("Ran fuzzer tests, %d crashes %d stdout %d stderr" % (crash_count, stdout_count, stderr_count)) + print("Ran fuzzer tests, %d crashes %d stdout %d stderr" % (crash_count, stdout_count, stderr_count, duration)) return 2 return 0 |