Skip to content

Commit fad0ae6

Browse files
author
MarcoFalke
committed
doc: Rename fuzz seed_dir to corpus_dir
1 parent a22653a commit fad0ae6

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

test/fuzz/test_runner.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_fuzz_env(*, target, source_dir):
2727
def main():
2828
parser = argparse.ArgumentParser(
2929
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
30-
description='''Run the fuzz targets with all inputs from the seed_dir once.''',
30+
description='''Run the fuzz targets with all inputs from the corpus_dir once.''',
3131
)
3232
parser.add_argument(
3333
"-l",
@@ -54,8 +54,8 @@ def main():
5454
help='How many targets to merge or execute in parallel.',
5555
)
5656
parser.add_argument(
57-
'seed_dir',
58-
help='The seed corpus to run on (must contain subfolders for each fuzz target).',
57+
'corpus_dir',
58+
help='The corpus to run on (must contain subfolders for each fuzz target).',
5959
)
6060
parser.add_argument(
6161
'target',
@@ -64,15 +64,15 @@ def main():
6464
)
6565
parser.add_argument(
6666
'--m_dir',
67-
help='Merge inputs from this directory into the seed_dir.',
67+
help='Merge inputs from this directory into the corpus_dir.',
6868
)
6969
parser.add_argument(
7070
'-g',
7171
'--generate',
7272
action='store_true',
73-
help='Create new corpus seeds (or extend the existing ones) by running'
73+
help='Create new corpus (or extend the existing ones) by running'
7474
' the given targets for a finite number of times. Outputs them to'
75-
' the passed seed_dir.'
75+
' the passed corpus_dir.'
7676
)
7777

7878
args = parser.parse_args()
@@ -119,19 +119,19 @@ def main():
119119
logging.info("{} of {} detected fuzz target(s) selected: {}".format(len(test_list_selection), len(test_list_all), " ".join(test_list_selection)))
120120

121121
if not args.generate:
122-
test_list_seedless = []
122+
test_list_missing_corpus = []
123123
for t in test_list_selection:
124-
corpus_path = os.path.join(args.seed_dir, t)
124+
corpus_path = os.path.join(args.corpus_dir, t)
125125
if not os.path.exists(corpus_path) or len(os.listdir(corpus_path)) == 0:
126-
test_list_seedless.append(t)
127-
test_list_seedless.sort()
128-
if test_list_seedless:
126+
test_list_missing_corpus.append(t)
127+
test_list_missing_corpus.sort()
128+
if test_list_missing_corpus:
129129
logging.info(
130-
"Fuzzing harnesses lacking a seed corpus: {}".format(
131-
" ".join(test_list_seedless)
130+
"Fuzzing harnesses lacking a corpus: {}".format(
131+
" ".join(test_list_missing_corpus)
132132
)
133133
)
134-
logging.info("Please consider adding a fuzz seed corpus at https://github.com/bitcoin-core/qa-assets")
134+
logging.info("Please consider adding a fuzz corpus at https://github.com/bitcoin-core/qa-assets")
135135

136136
try:
137137
help_output = subprocess.run(
@@ -154,18 +154,18 @@ def main():
154154

155155
with ThreadPoolExecutor(max_workers=args.par) as fuzz_pool:
156156
if args.generate:
157-
return generate_corpus_seeds(
157+
return generate_corpus(
158158
fuzz_pool=fuzz_pool,
159159
src_dir=config['environment']['SRCDIR'],
160160
build_dir=config["environment"]["BUILDDIR"],
161-
seed_dir=args.seed_dir,
161+
corpus_dir=args.corpus_dir,
162162
targets=test_list_selection,
163163
)
164164

165165
if args.m_dir:
166166
merge_inputs(
167167
fuzz_pool=fuzz_pool,
168-
corpus=args.seed_dir,
168+
corpus=args.corpus_dir,
169169
test_list=test_list_selection,
170170
src_dir=config['environment']['SRCDIR'],
171171
build_dir=config["environment"]["BUILDDIR"],
@@ -175,21 +175,21 @@ def main():
175175

176176
run_once(
177177
fuzz_pool=fuzz_pool,
178-
corpus=args.seed_dir,
178+
corpus=args.corpus_dir,
179179
test_list=test_list_selection,
180180
src_dir=config['environment']['SRCDIR'],
181181
build_dir=config["environment"]["BUILDDIR"],
182182
use_valgrind=args.valgrind,
183183
)
184184

185185

186-
def generate_corpus_seeds(*, fuzz_pool, src_dir, build_dir, seed_dir, targets):
187-
"""Generates new corpus seeds.
186+
def generate_corpus(*, fuzz_pool, src_dir, build_dir, corpus_dir, targets):
187+
"""Generates new corpus.
188188
189-
Run {targets} without input, and outputs the generated corpus seeds to
190-
{seed_dir}.
189+
Run {targets} without input, and outputs the generated corpus to
190+
{corpus_dir}.
191191
"""
192-
logging.info("Generating corpus seeds to {}".format(seed_dir))
192+
logging.info("Generating corpus to {}".format(corpus_dir))
193193

194194
def job(command, t):
195195
logging.debug("Running '{}'\n".format(" ".join(command)))
@@ -205,12 +205,12 @@ def job(command, t):
205205

206206
futures = []
207207
for target in targets:
208-
target_seed_dir = os.path.join(seed_dir, target)
209-
os.makedirs(target_seed_dir, exist_ok=True)
208+
target_corpus_dir = os.path.join(corpus_dir, target)
209+
os.makedirs(target_corpus_dir, exist_ok=True)
210210
command = [
211211
os.path.join(build_dir, 'src', 'test', 'fuzz', 'fuzz'),
212212
"-runs=100000",
213-
target_seed_dir,
213+
target_corpus_dir,
214214
]
215215
futures.append(fuzz_pool.submit(job, command, target))
216216

@@ -219,7 +219,7 @@ def job(command, t):
219219

220220

221221
def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir):
222-
logging.info("Merge the inputs from the passed dir into the seed_dir. Passed dir {}".format(merge_dir))
222+
logging.info("Merge the inputs from the passed dir into the corpus_dir. Passed dir {}".format(merge_dir))
223223
jobs = []
224224
for t in test_list:
225225
args = [

0 commit comments

Comments
 (0)