@@ -27,7 +27,7 @@ def get_fuzz_env(*, target, source_dir):
27
27
def main ():
28
28
parser = argparse .ArgumentParser (
29
29
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.''' ,
31
31
)
32
32
parser .add_argument (
33
33
"-l" ,
@@ -54,8 +54,8 @@ def main():
54
54
help = 'How many targets to merge or execute in parallel.' ,
55
55
)
56
56
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).' ,
59
59
)
60
60
parser .add_argument (
61
61
'target' ,
@@ -64,15 +64,15 @@ def main():
64
64
)
65
65
parser .add_argument (
66
66
'--m_dir' ,
67
- help = 'Merge inputs from this directory into the seed_dir .' ,
67
+ help = 'Merge inputs from this directory into the corpus_dir .' ,
68
68
)
69
69
parser .add_argument (
70
70
'-g' ,
71
71
'--generate' ,
72
72
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'
74
74
' the given targets for a finite number of times. Outputs them to'
75
- ' the passed seed_dir .'
75
+ ' the passed corpus_dir .'
76
76
)
77
77
78
78
args = parser .parse_args ()
@@ -119,19 +119,19 @@ def main():
119
119
logging .info ("{} of {} detected fuzz target(s) selected: {}" .format (len (test_list_selection ), len (test_list_all ), " " .join (test_list_selection )))
120
120
121
121
if not args .generate :
122
- test_list_seedless = []
122
+ test_list_missing_corpus = []
123
123
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 )
125
125
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 :
129
129
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 )
132
132
)
133
133
)
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" )
135
135
136
136
try :
137
137
help_output = subprocess .run (
@@ -154,18 +154,18 @@ def main():
154
154
155
155
with ThreadPoolExecutor (max_workers = args .par ) as fuzz_pool :
156
156
if args .generate :
157
- return generate_corpus_seeds (
157
+ return generate_corpus (
158
158
fuzz_pool = fuzz_pool ,
159
159
src_dir = config ['environment' ]['SRCDIR' ],
160
160
build_dir = config ["environment" ]["BUILDDIR" ],
161
- seed_dir = args .seed_dir ,
161
+ corpus_dir = args .corpus_dir ,
162
162
targets = test_list_selection ,
163
163
)
164
164
165
165
if args .m_dir :
166
166
merge_inputs (
167
167
fuzz_pool = fuzz_pool ,
168
- corpus = args .seed_dir ,
168
+ corpus = args .corpus_dir ,
169
169
test_list = test_list_selection ,
170
170
src_dir = config ['environment' ]['SRCDIR' ],
171
171
build_dir = config ["environment" ]["BUILDDIR" ],
@@ -175,21 +175,21 @@ def main():
175
175
176
176
run_once (
177
177
fuzz_pool = fuzz_pool ,
178
- corpus = args .seed_dir ,
178
+ corpus = args .corpus_dir ,
179
179
test_list = test_list_selection ,
180
180
src_dir = config ['environment' ]['SRCDIR' ],
181
181
build_dir = config ["environment" ]["BUILDDIR" ],
182
182
use_valgrind = args .valgrind ,
183
183
)
184
184
185
185
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.
188
188
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 }.
191
191
"""
192
- logging .info ("Generating corpus seeds to {}" .format (seed_dir ))
192
+ logging .info ("Generating corpus to {}" .format (corpus_dir ))
193
193
194
194
def job (command , t ):
195
195
logging .debug ("Running '{}'\n " .format (" " .join (command )))
@@ -205,12 +205,12 @@ def job(command, t):
205
205
206
206
futures = []
207
207
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 )
210
210
command = [
211
211
os .path .join (build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ),
212
212
"-runs=100000" ,
213
- target_seed_dir ,
213
+ target_corpus_dir ,
214
214
]
215
215
futures .append (fuzz_pool .submit (job , command , target ))
216
216
@@ -219,7 +219,7 @@ def job(command, t):
219
219
220
220
221
221
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 ))
223
223
jobs = []
224
224
for t in test_list :
225
225
args = [
0 commit comments