diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2020-02-19 14:10:22 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2020-02-19 14:10:22 +0000 |
commit | 5ea81449f30a6fe6db3b6df5e8009f21a782ff44 (patch) | |
tree | fefef960b7e73830c7bd8f63ebc06d7c51267385 /test/fuzz | |
parent | 555236f769c13518db70f5df36e5688d63486bd5 (diff) |
tests: Add support for excluding fuzz targets using -x/--exclude
Diffstat (limited to 'test/fuzz')
-rwxr-xr-x | test/fuzz/test_runner.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/fuzz/test_runner.py b/test/fuzz/test_runner.py index 5174e21e2a..0f7a349e45 100755 --- a/test/fuzz/test_runner.py +++ b/test/fuzz/test_runner.py @@ -47,6 +47,7 @@ FUZZERS_MISSING_CORPORA = [ "tx_out", ] + def main(): parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( @@ -67,6 +68,11 @@ def main(): help='If true, run fuzzing binaries under the valgrind memory error detector', ) parser.add_argument( + '-x', + '--exclude', + help="A comma-separated list of targets to exclude", + ) + parser.add_argument( 'seed_dir', help='The seed corpus to run on (must contain subfolders for each fuzz target).', ) @@ -100,7 +106,7 @@ def main(): logging.error("No fuzz targets found") sys.exit(1) - logging.info("Fuzz targets found: {}".format(test_list_all)) + logging.debug("{} fuzz target(s) found: {}".format(len(test_list_all), " ".join(sorted(test_list_all)))) args.target = args.target or test_list_all # By default run all test_list_error = list(set(args.target).difference(set(test_list_all))) @@ -109,7 +115,15 @@ def main(): test_list_selection = list(set(test_list_all).intersection(set(args.target))) if not test_list_selection: logging.error("No fuzz targets selected") - logging.info("Fuzz targets selected: {}".format(test_list_selection)) + if args.exclude: + for excluded_target in args.exclude.split(","): + if excluded_target not in test_list_selection: + logging.error("Target \"{}\" not found in current target list.".format(excluded_target)) + continue + test_list_selection.remove(excluded_target) + test_list_selection.sort() + + logging.info("{} of {} detected fuzz target(s) selected: {}".format(len(test_list_selection), len(test_list_all), " ".join(test_list_selection))) try: help_output = subprocess.run( |