@@ -99,9 +99,11 @@ def main():
9999 logging .error ("Must have fuzz targets built" )
100100 sys .exit (1 )
101101
102+ fuzz_bin = os .getenv ("DASHFUZZ" , default = os .path .join (config ["environment" ]["BUILDDIR" ], 'src' , 'test' , 'fuzz' , 'fuzz' ))
103+
102104 # Build list of tests
103105 test_list_all = parse_test_list (
104- fuzz_bin = os . path . join ( config [ "environment" ][ "BUILDDIR" ], 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
106+ fuzz_bin = fuzz_bin ,
105107 source_dir = config ['environment' ]['SRCDIR' ],
106108 )
107109
@@ -146,7 +148,7 @@ def main():
146148 try :
147149 help_output = subprocess .run (
148150 args = [
149- os . path . join ( config [ "environment" ][ "BUILDDIR" ], 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
151+ fuzz_bin ,
150152 '-help=1' ,
151153 ],
152154 env = get_fuzz_env (target = test_list_selection [0 ], source_dir = config ['environment' ]['SRCDIR' ]),
@@ -167,7 +169,7 @@ def main():
167169 return generate_corpus (
168170 fuzz_pool = fuzz_pool ,
169171 src_dir = config ['environment' ]['SRCDIR' ],
170- build_dir = config [ "environment" ][ "BUILDDIR" ] ,
172+ fuzz_bin = fuzz_bin ,
171173 corpus_dir = args .corpus_dir ,
172174 targets = test_list_selection ,
173175 )
@@ -178,7 +180,7 @@ def main():
178180 corpus = args .corpus_dir ,
179181 test_list = test_list_selection ,
180182 src_dir = config ['environment' ]['SRCDIR' ],
181- build_dir = config [ "environment" ][ "BUILDDIR" ] ,
183+ fuzz_bin = fuzz_bin ,
182184 merge_dir = args .m_dir ,
183185 )
184186 return
@@ -188,13 +190,13 @@ def main():
188190 corpus = args .corpus_dir ,
189191 test_list = test_list_selection ,
190192 src_dir = config ['environment' ]['SRCDIR' ],
191- build_dir = config [ "environment" ][ "BUILDDIR" ] ,
193+ fuzz_bin = fuzz_bin ,
192194 use_valgrind = args .valgrind ,
193195 empty_min_time = args .empty_min_time ,
194196 )
195197
196198
197- def generate_corpus (* , fuzz_pool , src_dir , build_dir , corpus_dir , targets ):
199+ def generate_corpus (* , fuzz_pool , src_dir , fuzz_bin , corpus_dir , targets ):
198200 """Generates new corpus.
199201
200202 Run {targets} without input, and outputs the generated corpus to
@@ -220,7 +222,7 @@ def job(command, t):
220222 os .makedirs (target_corpus_dir , exist_ok = True )
221223 use_value_profile = int (random .random () < .3 )
222224 command = [
223- os . path . join ( build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
225+ fuzz_bin ,
224226 "-rss_limit_mb=8000" ,
225227 "-max_total_time=6000" ,
226228 "-reload=0" ,
@@ -233,12 +235,12 @@ def job(command, t):
233235 future .result ()
234236
235237
236- def merge_inputs (* , fuzz_pool , corpus , test_list , src_dir , build_dir , merge_dir ):
238+ def merge_inputs (* , fuzz_pool , corpus , test_list , src_dir , fuzz_bin , merge_dir ):
237239 logging .info ("Merge the inputs from the passed dir into the corpus_dir. Passed dir {}" .format (merge_dir ))
238240 jobs = []
239241 for t in test_list :
240242 args = [
241- os . path . join ( build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
243+ fuzz_bin ,
242244 '-rss_limit_mb=8000' ,
243245 '-set_cover_merge=1' ,
244246 # set_cover_merge is used instead of -merge=1 to reduce the overall
@@ -271,13 +273,13 @@ def job(t, args):
271273 future .result ()
272274
273275
274- def run_once (* , fuzz_pool , corpus , test_list , src_dir , build_dir , use_valgrind , empty_min_time ):
276+ def run_once (* , fuzz_pool , corpus , test_list , src_dir , fuzz_bin , use_valgrind , empty_min_time ):
275277 jobs = []
276278 for t in test_list :
277279 corpus_path = corpus / t
278280 os .makedirs (corpus_path , exist_ok = True )
279281 args = [
280- os . path . join ( build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ) ,
282+ fuzz_bin ,
281283 ]
282284 empty_dir = not any (corpus_path .iterdir ())
283285 if empty_min_time and empty_dir :
0 commit comments