From 891bcbb8555e53cd678795cfc91f869e2c9f1c52 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Mon, 28 Nov 2022 23:48:56 +0300 Subject: [PATCH] runner: make download-corpus work (#639) Fixes ``` python3 ../runner.py download-corpus avahi Traceback (most recent call last): File "/home/vagrant/fuzz-introspector/oss_fuzz_integration/oss-fuzz/../runner.py", line 652, in download_full_public_corpus(args.project) TypeError: download_full_public_corpus() missing 1 required positional argument: 'target_corpus_dir' ``` It also makes it possible to download corpora to specific directories by passing --corpus-dir=... Signed-off-by: Evgeny Vereshchagin Signed-off-by: Evgeny Vereshchagin --- oss_fuzz_integration/runner.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/oss_fuzz_integration/runner.py b/oss_fuzz_integration/runner.py index c3b1edcec..0863c297e 100755 --- a/oss_fuzz_integration/runner.py +++ b/oss_fuzz_integration/runner.py @@ -60,7 +60,7 @@ def download_full_public_corpus(project_name, target_corpus_dir: None): download_public_corpus(project_name, fuzzer, f"corpus-{project_name}-{fuzzer}.zip") if not target_corpus_dir: - target_corpus_dir = "mycorpus" + target_corpus_dir = f"{project_name}-corpus" if not os.path.isdir(target_corpus_dir): os.mkdir(target_corpus_dir) @@ -617,6 +617,12 @@ def get_cmdline_parser() -> argparse.ArgumentParser: "project", help="name of project" ) + download_corpus_parser.add_argument( + "--corpus-dir", + type=str, + help="directory with corpus for the project", + default=None + ) return parser if __name__ == "__main__": @@ -649,4 +655,4 @@ def get_cmdline_parser() -> argparse.ArgumentParser: not args.no_coverage ) elif args.command == "download-corpus": - download_full_public_corpus(args.project) + download_full_public_corpus(args.project, args.corpus_dir)