@@ -104,9 +104,11 @@ def main():
104
104
logging .error ("Must have fuzz executable built" )
105
105
sys .exit (1 )
106
106
107
+ fuzz_bin = os .getenv ("BITCOINFUZZ" , default = os .path .join (config ["environment" ]["BUILDDIR" ], 'src' , 'test' , 'fuzz' , 'fuzz' ))
108
+
107
109
# Build list of tests
108
110
test_list_all = parse_test_list (
109
- fuzz_bin = os . path . join ( config [ "environment" ][ "BUILDDIR" ], 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
111
+ fuzz_bin = fuzz_bin ,
110
112
source_dir = config ['environment' ]['SRCDIR' ],
111
113
)
112
114
@@ -151,7 +153,7 @@ def main():
151
153
try :
152
154
help_output = subprocess .run (
153
155
args = [
154
- os . path . join ( config [ "environment" ][ "BUILDDIR" ], 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
156
+ fuzz_bin ,
155
157
'-help=1' ,
156
158
],
157
159
env = get_fuzz_env (target = test_list_selection [0 ], source_dir = config ['environment' ]['SRCDIR' ]),
@@ -173,7 +175,7 @@ def main():
173
175
return generate_corpus (
174
176
fuzz_pool = fuzz_pool ,
175
177
src_dir = config ['environment' ]['SRCDIR' ],
176
- build_dir = config [ "environment" ][ "BUILDDIR" ] ,
178
+ fuzz_bin = fuzz_bin ,
177
179
corpus_dir = args .corpus_dir ,
178
180
targets = test_list_selection ,
179
181
)
@@ -184,7 +186,7 @@ def main():
184
186
corpus = args .corpus_dir ,
185
187
test_list = test_list_selection ,
186
188
src_dir = config ['environment' ]['SRCDIR' ],
187
- build_dir = config [ "environment" ][ "BUILDDIR" ] ,
189
+ fuzz_bin = fuzz_bin ,
188
190
merge_dirs = [Path (m_dir ) for m_dir in args .m_dir ],
189
191
)
190
192
return
@@ -194,7 +196,7 @@ def main():
194
196
corpus = args .corpus_dir ,
195
197
test_list = test_list_selection ,
196
198
src_dir = config ['environment' ]['SRCDIR' ],
197
- build_dir = config [ "environment" ][ "BUILDDIR" ] ,
199
+ fuzz_bin = fuzz_bin ,
198
200
using_libfuzzer = using_libfuzzer ,
199
201
use_valgrind = args .valgrind ,
200
202
empty_min_time = args .empty_min_time ,
@@ -237,7 +239,7 @@ def transform_rpc_target(targets, src_dir):
237
239
return targets
238
240
239
241
240
- def generate_corpus (* , fuzz_pool , src_dir , build_dir , corpus_dir , targets ):
242
+ def generate_corpus (* , fuzz_pool , src_dir , fuzz_bin , corpus_dir , targets ):
241
243
"""Generates new corpus.
242
244
243
245
Run {targets} without input, and outputs the generated corpus to
@@ -270,7 +272,7 @@ def job(command, t, t_env):
270
272
os .makedirs (target_corpus_dir , exist_ok = True )
271
273
use_value_profile = int (random .random () < .3 )
272
274
command = [
273
- os . path . join ( build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
275
+ fuzz_bin ,
274
276
"-rss_limit_mb=8000" ,
275
277
"-max_total_time=6000" ,
276
278
"-reload=0" ,
@@ -283,12 +285,12 @@ def job(command, t, t_env):
283
285
future .result ()
284
286
285
287
286
- def merge_inputs (* , fuzz_pool , corpus , test_list , src_dir , build_dir , merge_dirs ):
288
+ def merge_inputs (* , fuzz_pool , corpus , test_list , src_dir , fuzz_bin , merge_dirs ):
287
289
logging .info (f"Merge the inputs from the passed dir into the corpus_dir. Passed dirs { merge_dirs } " )
288
290
jobs = []
289
291
for t in test_list :
290
292
args = [
291
- os . path . join ( build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
293
+ fuzz_bin ,
292
294
'-rss_limit_mb=8000' ,
293
295
'-set_cover_merge=1' ,
294
296
# set_cover_merge is used instead of -merge=1 to reduce the overall
@@ -325,13 +327,13 @@ def job(t, args):
325
327
future .result ()
326
328
327
329
328
- def run_once (* , fuzz_pool , corpus , test_list , src_dir , build_dir , using_libfuzzer , use_valgrind , empty_min_time ):
330
+ def run_once (* , fuzz_pool , corpus , test_list , src_dir , fuzz_bin , using_libfuzzer , use_valgrind , empty_min_time ):
329
331
jobs = []
330
332
for t in test_list :
331
333
corpus_path = corpus / t
332
334
os .makedirs (corpus_path , exist_ok = True )
333
335
args = [
334
- os . path . join ( build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
336
+ fuzz_bin ,
335
337
]
336
338
empty_dir = not any (corpus_path .iterdir ())
337
339
if using_libfuzzer :
0 commit comments