aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-10-17 09:51:21 +0100
committerfanquake <fanquake@gmail.com>2023-10-17 09:51:51 +0100
commite6c30834b40097f0f7ddb187cd142cd4da63929b (patch)
tree8e3ed2efe7dacf1d28847849aece88aefe7a9bde /test
parent4caa10b580e5a84c888d2c6465728492d3e30dad (diff)
parentfaa5e061c2f63b868367015561fd376b6ef6052c (diff)
downloadbitcoin-e6c30834b40097f0f7ddb187cd142cd4da63929b.tar.xz
Merge bitcoin/bitcoin#28656: fuzz: Allow multiple --m_dir args
faa5e061c2f63b868367015561fd376b6ef6052c fuzz: Allow multiple --m_dir args (MarcoFalke) Pull request description: This allows to merge the result from several servers (or just several folders) at the same time, instead of having to iterate over them. This should also allow the fuzz engine (libFuzzer) to optimize the final merge result more, because all fuzz inputs from all folders are available at the same time. ACKs for top commit: dergoegge: tACK faa5e061c2f63b868367015561fd376b6ef6052c Tree-SHA512: bf0da418b1f7b8a8af16bb7cc1e148b1ccd0f17062ce70758d1ca5b35c3eee77c0c30377d376befdd55480adfd1f1a1073cfc47118e7a710e6760e020abe24bb
Diffstat (limited to 'test')
-rwxr-xr-xtest/fuzz/test_runner.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/fuzz/test_runner.py b/test/fuzz/test_runner.py
index 446a4551da..9d64591111 100755
--- a/test/fuzz/test_runner.py
+++ b/test/fuzz/test_runner.py
@@ -69,7 +69,8 @@ def main():
)
parser.add_argument(
'--m_dir',
- help='Merge inputs from this directory into the corpus_dir.',
+ action="append",
+ help="Merge inputs from these directories into the corpus_dir.",
)
parser.add_argument(
'-g',
@@ -176,7 +177,7 @@ def main():
test_list=test_list_selection,
src_dir=config['environment']['SRCDIR'],
build_dir=config["environment"]["BUILDDIR"],
- merge_dir=args.m_dir,
+ merge_dirs=[Path(m_dir) for m_dir in args.m_dir],
)
return
@@ -270,8 +271,8 @@ def generate_corpus(*, fuzz_pool, src_dir, build_dir, corpus_dir, targets):
future.result()
-def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir):
- logging.info("Merge the inputs from the passed dir into the corpus_dir. Passed dir {}".format(merge_dir))
+def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dirs):
+ logging.info(f"Merge the inputs from the passed dir into the corpus_dir. Passed dirs {merge_dirs}")
jobs = []
for t in test_list:
args = [
@@ -289,10 +290,10 @@ def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir)
# [0] https://github.com/google/oss-fuzz/issues/1406#issuecomment-387790487
# [1] https://github.com/bitcoin-core/qa-assets/issues/130#issuecomment-1749075891
os.path.join(corpus, t),
- os.path.join(merge_dir, t),
- ]
+ ] + [str(m_dir / t) for m_dir in merge_dirs]
os.makedirs(os.path.join(corpus, t), exist_ok=True)
- os.makedirs(os.path.join(merge_dir, t), exist_ok=True)
+ for m_dir in merge_dirs:
+ (m_dir / t).mkdir(exist_ok=True)
def job(t, args):
output = 'Run {} with args {}\n'.format(t, " ".join(args))