Skip to content

Commit faa5e06

Browse files
author
MarcoFalke
committed
fuzz: Allow multiple --m_dir args
1 parent 22fa1f4 commit faa5e06

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/fuzz/test_runner.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def main():
6969
)
7070
parser.add_argument(
7171
'--m_dir',
72-
help='Merge inputs from this directory into the corpus_dir.',
72+
action="append",
73+
help="Merge inputs from these directories into the corpus_dir.",
7374
)
7475
parser.add_argument(
7576
'-g',
@@ -176,7 +177,7 @@ def main():
176177
test_list=test_list_selection,
177178
src_dir=config['environment']['SRCDIR'],
178179
build_dir=config["environment"]["BUILDDIR"],
179-
merge_dir=args.m_dir,
180+
merge_dirs=[Path(m_dir) for m_dir in args.m_dir],
180181
)
181182
return
182183

@@ -270,8 +271,8 @@ def job(command, t, t_env):
270271
future.result()
271272

272273

273-
def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir):
274-
logging.info("Merge the inputs from the passed dir into the corpus_dir. Passed dir {}".format(merge_dir))
274+
def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dirs):
275+
logging.info(f"Merge the inputs from the passed dir into the corpus_dir. Passed dirs {merge_dirs}")
275276
jobs = []
276277
for t in test_list:
277278
args = [
@@ -289,10 +290,10 @@ def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir)
289290
# [0] https://github.com/google/oss-fuzz/issues/1406#issuecomment-387790487
290291
# [1] https://github.com/bitcoin-core/qa-assets/issues/130#issuecomment-1749075891
291292
os.path.join(corpus, t),
292-
os.path.join(merge_dir, t),
293-
]
293+
] + [str(m_dir / t) for m_dir in merge_dirs]
294294
os.makedirs(os.path.join(corpus, t), exist_ok=True)
295-
os.makedirs(os.path.join(merge_dir, t), exist_ok=True)
295+
for m_dir in merge_dirs:
296+
(m_dir / t).mkdir(exist_ok=True)
296297

297298
def job(t, args):
298299
output = 'Run {} with args {}\n'.format(t, " ".join(args))

0 commit comments

Comments
 (0)