@@ -432,8 +432,8 @@ def pick_initial_contents():
432432# Host limits are reported as [host limit REASON]
433433HOST_LIMIT_PREFIX = '[host limit '
434434
435- # --fuzz-exec reports calls as [fuzz-exec] calling foo
436- FUZZ_EXEC_CALL_PREFIX = '[fuzz-exec] calling '
435+ # --fuzz-exec reports calls as [fuzz-exec] export foo
436+ FUZZ_EXEC_EXPORT_PREFIX = '[fuzz-exec] export '
437437
438438# --fuzz-exec reports a stack limit using this notation
439439STACK_LIMIT = '[trap stack limit]'
@@ -449,11 +449,11 @@ def pick_initial_contents():
449449EXCEPTION_PREFIX = 'exception thrown: '
450450
451451
452- # given a call line that includes FUZZ_EXEC_CALL_PREFIX , return the export that
453- # is called
454- def get_export_from_call_line ( call_line ):
455- assert FUZZ_EXEC_CALL_PREFIX in call_line
456- return call_line .split (FUZZ_EXEC_CALL_PREFIX )[1 ].strip ()
452+ # given an export line that includes FUZZ_EXEC_EXPORT_PREFIX , return the export
453+ # that is called
454+ def get_export_from_export_line ( export_line ):
455+ assert FUZZ_EXEC_EXPORT_PREFIX in export_line
456+ return export_line .split (FUZZ_EXEC_EXPORT_PREFIX )[1 ].strip ()
457457
458458
459459# compare two strings, strictly
@@ -795,7 +795,7 @@ class BinaryenInterpreter:
795795 def run (self , wasm ):
796796 output = run_bynterp (wasm , ['--fuzz-exec-before' ])
797797 if output != IGNORE :
798- calls = output .count (FUZZ_EXEC_CALL_PREFIX )
798+ calls = output .count (FUZZ_EXEC_EXPORT_PREFIX )
799799 errors = output .count (TRAP_PREFIX ) + output .count (HOST_LIMIT_PREFIX )
800800 if errors > calls / 2 :
801801 # A significant amount of execution on this testcase
@@ -1140,14 +1140,14 @@ def fix_number(x):
11401140 # we can't test this function, which the trap is in the middle of.
11411141 # erase everything from this function's output and onward, so we
11421142 # only compare the previous trap-free code
1143- call_start = interpreter .rindex (FUZZ_EXEC_CALL_PREFIX , 0 , trap_index )
1143+ call_start = interpreter .rindex (FUZZ_EXEC_EXPORT_PREFIX , 0 , trap_index )
11441144 call_end = interpreter .index ('\n ' , call_start )
1145- call_line = interpreter [call_start :call_end ]
1145+ export_line = interpreter [call_start :call_end ]
11461146 # fix up the call line so it matches the JS
1147- fixed_call_line = fix_output_for_js (call_line )
1148- before = before [:before .index (fixed_call_line )]
1149- after = after [:after .index (fixed_call_line )]
1150- interpreter = interpreter [:interpreter .index (call_line )]
1147+ fixed_export_line = fix_output_for_js (export_line )
1148+ before = before [:before .index (fixed_export_line )]
1149+ after = after [:after .index (fixed_export_line )]
1150+ interpreter = interpreter [:interpreter .index (export_line )]
11511151
11521152 if compare_before_to_after :
11531153 compare_between_vms (before , after , 'Wasm2JS (before/after)' )
@@ -1302,14 +1302,14 @@ def handle_pair(self, input, before_wasm, after_wasm, opts):
13021302 # finding the call line right before us. that is, the output looks
13031303 # like this:
13041304 #
1305- # [fuzz-exec] calling foo
1305+ # [fuzz-exec] export foo
13061306 # .. stuff happening during foo ..
1307- # [fuzz-exec] calling bar
1307+ # [fuzz-exec] export bar
13081308 # .. stuff happening during bar ..
13091309 #
13101310 # if the trap happened during bar, the relevant call line is
1311- # "[fuzz-exec] calling bar".
1312- call_start = before .rfind (FUZZ_EXEC_CALL_PREFIX , 0 , trap_index )
1311+ # "[fuzz-exec] export bar".
1312+ call_start = before .rfind (FUZZ_EXEC_EXPORT_PREFIX , 0 , trap_index )
13131313 if call_start < 0 :
13141314 # the trap happened before we called an export, so it occured
13151315 # during startup (the start function, or memory segment
@@ -1320,17 +1320,17 @@ def handle_pair(self, input, before_wasm, after_wasm, opts):
13201320 # be prefixes of each other
13211321 call_end = before .index (os .linesep , call_start ) + 1
13221322 # we now know the contents of the call line after which the trap
1323- # happens, which is something like "[fuzz-exec] calling bar", and
1323+ # happens, which is something like "[fuzz-exec] export bar", and
13241324 # it is unique since it contains the function being called.
1325- call_line = before [call_start :call_end ]
1326- trapping_export = get_export_from_call_line ( call_line )
1325+ export_line = before [call_start :call_end ]
1326+ trapping_export = get_export_from_export_line ( export_line )
13271327
13281328 # now that we know the trapping export, we can leave only the safe
13291329 # ones that are before it
13301330 safe_exports = []
13311331 for line in before .splitlines ():
1332- if FUZZ_EXEC_CALL_PREFIX in line :
1333- export = get_export_from_call_line (line )
1332+ if FUZZ_EXEC_EXPORT_PREFIX in line :
1333+ export = get_export_from_export_line (line )
13341334 if export == trapping_export :
13351335 break
13361336 safe_exports .append (export )
@@ -1446,10 +1446,10 @@ def traps_in_instantiation(output):
14461446 trap_index = output .find ('*exception*' )
14471447 if trap_index == - 1 :
14481448 return False
1449- call_index = output .find (FUZZ_EXEC_CALL_PREFIX )
1450- if call_index == - 1 :
1449+ export_index = output .find (FUZZ_EXEC_EXPORT_PREFIX )
1450+ if export_index == - 1 :
14511451 return True
1452- return trap_index < call_index
1452+ return trap_index < export_index
14531453
14541454
14551455# Tests wasm-merge
@@ -1584,8 +1584,8 @@ def handle(self, wasm):
15841584 # primary module, but only the original ones.
15851585 exports = []
15861586 for line in output .splitlines ():
1587- if FUZZ_EXEC_CALL_PREFIX in line :
1588- exports .append (get_export_from_call_line (line ))
1587+ if FUZZ_EXEC_EXPORT_PREFIX in line :
1588+ exports .append (get_export_from_export_line (line ))
15891589
15901590 # pick which to split out, with a random rate of picking (biased towards
15911591 # 0.5).
@@ -1779,7 +1779,7 @@ def handle_pair(self, input, before_wasm, after_wasm, opts):
17791779 fuzz_file ,
17801780 'extracted' ])
17811781 if get_exports ('extracted.0.wasm' , ['func' ]):
1782- assert FUZZ_EXEC_CALL_PREFIX in output
1782+ assert FUZZ_EXEC_EXPORT_PREFIX in output
17831783
17841784 def ensure (self ):
17851785 # The first time we actually run, set things up: make a bundle like the
@@ -1892,7 +1892,7 @@ def handle(self, wasm):
18921892 # wasm files.
18931893 exports = get_exports (wasm , ['func' , 'global' ])
18941894 exports += get_exports (second_wasm , ['func' , 'global' ])
1895- calls_in_output = output .count (FUZZ_EXEC_CALL_PREFIX )
1895+ calls_in_output = output .count (FUZZ_EXEC_EXPORT_PREFIX )
18961896 if calls_in_output == 0 :
18971897 print (f'warning: no calls in output. output:\n { output } ' )
18981898 assert calls_in_output == len (exports ), exports
@@ -2009,11 +2009,11 @@ def compare_to_merged_output(self, output, merged_output):
20092009 b = merged_output_lines [i ]
20102010 if a == b :
20112011 continue
2012- if a .startswith (FUZZ_EXEC_CALL_PREFIX ):
2012+ if a .startswith (FUZZ_EXEC_EXPORT_PREFIX ):
20132013 # Fix up
2014- # [fuzz-exec] calling foo/bar
2014+ # [fuzz-exec] export foo/bar
20152015 # for different foo/bar. Just copy the original.
2016- assert b .startswith (FUZZ_EXEC_CALL_PREFIX )
2016+ assert b .startswith (FUZZ_EXEC_EXPORT_PREFIX )
20172017 merged_output_lines [i ] = output_lines [i ]
20182018 elif a .startswith (FUZZ_EXEC_NOTE_RESULT ):
20192019 # Fix up
@@ -2272,7 +2272,7 @@ def handle(self, wasm):
22722272 # any logging before the first call.)
22732273 line_groups = [['before calls' ]]
22742274 for line in out .splitlines ():
2275- if line .startswith (FUZZ_EXEC_CALL_PREFIX ):
2275+ if line .startswith (FUZZ_EXEC_EXPORT_PREFIX ):
22762276 line_groups .append ([line ])
22772277 else :
22782278 line_groups [- 1 ].append (line )
0 commit comments