@@ -95,8 +95,8 @@ def main():
95
95
configfile = os .path .abspath (os .path .dirname (__file__ )) + "/../config.ini"
96
96
config .read_file (open (configfile , encoding = "utf8" ))
97
97
98
- if not config ["components" ].getboolean ("ENABLE_FUZZ " ):
99
- logging .error ("Must have fuzz targets built" )
98
+ if not config ["components" ].getboolean ("ENABLE_FUZZ_BINARY " ):
99
+ logging .error ("Must have fuzz executable built" )
100
100
sys .exit (1 )
101
101
102
102
# Build list of tests
@@ -148,11 +148,12 @@ def main():
148
148
],
149
149
env = get_fuzz_env (target = test_list_selection [0 ], source_dir = config ['environment' ]['SRCDIR' ]),
150
150
timeout = 20 ,
151
- check = True ,
151
+ check = False ,
152
152
stderr = subprocess .PIPE ,
153
153
text = True ,
154
154
).stderr
155
- if "libFuzzer" not in help_output :
155
+ using_libfuzzer = "libFuzzer" in help_output
156
+ if (args .generate or args .m_dir ) and not using_libfuzzer :
156
157
logging .error ("Must be built with libFuzzer" )
157
158
sys .exit (1 )
158
159
except subprocess .TimeoutExpired :
@@ -186,6 +187,7 @@ def main():
186
187
test_list = test_list_selection ,
187
188
src_dir = config ['environment' ]['SRCDIR' ],
188
189
build_dir = config ["environment" ]["BUILDDIR" ],
190
+ using_libfuzzer = using_libfuzzer ,
189
191
use_valgrind = args .valgrind ,
190
192
empty_min_time = args .empty_min_time ,
191
193
)
@@ -259,7 +261,7 @@ def job(t, args):
259
261
future .result ()
260
262
261
263
262
- def run_once (* , fuzz_pool , corpus , test_list , src_dir , build_dir , use_valgrind , empty_min_time ):
264
+ def run_once (* , fuzz_pool , corpus , test_list , src_dir , build_dir , using_libfuzzer , use_valgrind , empty_min_time ):
263
265
jobs = []
264
266
for t in test_list :
265
267
corpus_path = corpus / t
@@ -268,13 +270,16 @@ def run_once(*, fuzz_pool, corpus, test_list, src_dir, build_dir, use_valgrind,
268
270
os .path .join (build_dir , 'src' , 'test' , 'fuzz' , 'fuzz' ),
269
271
]
270
272
empty_dir = not any (corpus_path .iterdir ())
271
- if empty_min_time and empty_dir :
272
- args += [f"-max_total_time={ empty_min_time } " ]
273
+ if using_libfuzzer :
274
+ if empty_min_time and empty_dir :
275
+ args += [f"-max_total_time={ empty_min_time } " ]
276
+ else :
277
+ args += [
278
+ "-runs=1" ,
279
+ corpus_path ,
280
+ ]
273
281
else :
274
- args += [
275
- "-runs=1" ,
276
- corpus_path ,
277
- ]
282
+ args += [corpus_path ]
278
283
if use_valgrind :
279
284
args = ['valgrind' , '--quiet' , '--error-exitcode=1' ] + args
280
285
@@ -301,7 +306,7 @@ def job(t, args):
301
306
logging .info (e .stdout )
302
307
if e .stderr :
303
308
logging .info (e .stderr )
304
- logging .info ("Target \" {} \" failed with exit code {}" . format ( " " . join ( result . args ), e .returncode ) )
309
+ logging .info (f "Target { result . args } failed with exit code { e .returncode } " )
305
310
sys .exit (1 )
306
311
307
312
0 commit comments