1010
1111That will run forever or until it finds a problem.
1212
13+ You can put files in the local directory 'fuzz' (under the top level of the
14+ binaryen repo) and the fuzzer will treat them as important content to fuzz
15+ with high frequency.
16+
1317Setup: Some tools are optional, like emcc and wasm2c. The v8 shell (d8),
1418however, is used in various sub-fuzzers and so it is mandatory.
1519
@@ -200,24 +204,13 @@ def randomize_fuzz_settings():
200204
201205
202206def init_important_initial_contents ():
203- FIXED_IMPORTANT_INITIAL_CONTENTS = [
204- # Perenially-important passes
205- os .path .join ('lit' , 'passes' , 'optimize-instructions-mvp.wast' ),
206- os .path .join ('passes' , 'optimize-instructions_fuzz-exec.wast' ),
207- ]
208- MANUAL_RECENT_INITIAL_CONTENTS = [
209- # Recently-added or modified passes. These can be added to and pruned
210- # frequently.
211- os .path .join ('lit' , 'passes' , 'once-reduction.wast' ),
212- os .path .join ('passes' , 'remove-unused-brs_enable-multivalue.wast' ),
213- os .path .join ('lit' , 'passes' , 'optimize-instructions-bulk-memory.wast' ),
214- os .path .join ('lit' , 'passes' , 'optimize-instructions-ignore-traps.wast' ),
215- os .path .join ('lit' , 'passes' , 'optimize-instructions-gc.wast' ),
216- os .path .join ('lit' , 'passes' , 'optimize-instructions-gc-iit.wast' ),
217- os .path .join ('lit' , 'passes' , 'optimize-instructions-call_ref.wast' ),
218- os .path .join ('lit' , 'passes' , 'inlining_splitting.wast' ),
219- os .path .join ('heap-types.wast' ),
220- ]
207+ # Fuzz dir contents are always important to us.
208+ fuzz_dir = os .path .join (shared .options .binaryen_root , 'fuzz' )
209+ fuzz_cases = shared .get_tests (fuzz_dir , test_suffixes , recursive = True )
210+ FIXED_IMPORTANT_INITIAL_CONTENTS = fuzz_cases
211+
212+ # If auto_initial_contents is set we'll also grab all test files that are
213+ # recent.
221214 RECENT_DAYS = 30
222215
223216 # Returns the list of test wast/wat files added or modified within the
@@ -258,7 +251,7 @@ def is_git_repo():
258251 'so not automatically selecting initial contents.' )
259252 shared .options .auto_initial_contents = False
260253
261- print ('- Perenially-important initial contents:' )
254+ print ('- Important provided initial contents:' )
262255 for test in FIXED_IMPORTANT_INITIAL_CONTENTS :
263256 print (' ' + test )
264257 print ()
@@ -268,9 +261,6 @@ def is_git_repo():
268261 if shared .options .auto_initial_contents :
269262 print (f'(automatically selected: within last { RECENT_DAYS } days):' )
270263 recent_contents += auto_select_recent_initial_contents ()
271- else :
272- print ('(manually selected):' )
273- recent_contents = MANUAL_RECENT_INITIAL_CONTENTS
274264 for test in recent_contents :
275265 print (' ' + test )
276266 print ()
@@ -335,7 +325,7 @@ def pick_initial_contents():
335325 return
336326 # some of the time use initial contents that are known to be especially
337327 # important
338- if random .random () < 0.5 :
328+ if IMPORTANT_INITIAL_CONTENTS and random .random () < 0.5 :
339329 test_name = random .choice (IMPORTANT_INITIAL_CONTENTS )
340330 else :
341331 test_name = random .choice (all_tests )
@@ -1393,6 +1383,7 @@ def handle(self, wasm):
13931383
13941384
13951385test_suffixes = ['*.wasm' , '*.wast' , '*.wat' ]
1386+
13961387core_tests = shared .get_tests (shared .get_test_dir ('.' ), test_suffixes )
13971388passes_tests = shared .get_tests (shared .get_test_dir ('passes' ), test_suffixes )
13981389spec_tests = shared .get_tests (shared .get_test_dir ('spec' ), test_suffixes )
0 commit comments