diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2020-02-16 10:45:05 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2020-02-16 11:11:54 +0000 |
commit | 1b068c50dd1522990cc33e1aca444741c7e5a747 (patch) | |
tree | bfaf7398aabb27eaa8ff28dc32c0a6f12d06e3ac /test/fuzz | |
parent | 2a2631fb0dc781504df0f3fe8b42f21cbdb6f20d (diff) |
tests: Add --valgrind option to test/fuzz/test_runner.py for running fuzzing test cases under valgrind
Diffstat (limited to 'test/fuzz')
-rwxr-xr-x | test/fuzz/test_runner.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/fuzz/test_runner.py b/test/fuzz/test_runner.py index 50e86cf9dc..61c3e700c5 100755 --- a/test/fuzz/test_runner.py +++ b/test/fuzz/test_runner.py @@ -62,6 +62,11 @@ def main(): help='If true, export coverage information to files in the seed corpus', ) parser.add_argument( + '--valgrind', + action='store_true', + help='If true, run fuzzing binaries under the valgrind memory error detector. Valgrind 3.14 or later required.', + ) + parser.add_argument( 'seed_dir', help='The seed corpus to run on (must contain subfolders for each fuzz target).', ) @@ -129,10 +134,11 @@ def main(): test_list=test_list_selection, build_dir=config["environment"]["BUILDDIR"], export_coverage=args.export_coverage, + use_valgrind=args.valgrind, ) -def run_once(*, corpus, test_list, build_dir, export_coverage): +def run_once(*, corpus, test_list, build_dir, export_coverage, use_valgrind): for t in test_list: corpus_path = os.path.join(corpus, t) if t in FUZZERS_MISSING_CORPORA: @@ -143,6 +149,8 @@ def run_once(*, corpus, test_list, build_dir, export_coverage): '-detect_leaks=0', corpus_path, ] + if use_valgrind: + args = ['valgrind', '--quiet', '--error-exitcode=1', '--exit-on-first-error=yes'] + args logging.debug('Run {} with args {}'.format(t, args)) result = subprocess.run(args, stderr=subprocess.PIPE, universal_newlines=True) output = result.stderr |