Skip to content

Commit 869fefd

Browse files
authored
[NFC] Fix fuzzer counting of ignored runs due to many errors (#6444)
When the interpreter sees that most exports simply trap we mark the iteration as ignored. But we run the interpreter on the before wasm and also the after wasm, so we were incrementing that counter by 2 each time, which could be misleading.
1 parent 165953e commit 869fefd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scripts/fuzz_opt.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,12 @@ def fix_spec_output(out):
632632

633633
# Notes a VM run that we ignore, and the reason for it (for metrics purposes).
634634
# Extra text can also be printed that is not included in the metrics.
635-
def note_ignored_vm_run(reason, extra_text=''):
635+
def note_ignored_vm_run(reason, extra_text='', amount=1):
636636
global ignored_vm_runs
637637
print(f'(ignore VM run: {reason}{extra_text})')
638-
ignored_vm_runs += 1
638+
ignored_vm_runs += amount
639639
ignored_vm_run_reasons.setdefault(reason, 0)
640-
ignored_vm_run_reasons[reason] += 1
640+
ignored_vm_run_reasons[reason] += amount
641641

642642

643643
def run_vm(cmd):
@@ -784,7 +784,15 @@ def run(self, wasm):
784784
# still be useful testing here (up to 50%), so we only
785785
# note that this is a mostly-ignored run, but we do not
786786
# ignore the parts that are useful.
787-
note_ignored_vm_run('too many errors vs calls', extra_text=f' ({calls} calls, {errors} errors)')
787+
#
788+
# Note that we set amount to 0.5 because we are run both
789+
# on the before wasm and the after wasm. Those will be
790+
# in sync (because the optimizer does not remove traps)
791+
# and so by setting 0.5 we only increment by 1 for the
792+
# entire iteration.
793+
note_ignored_vm_run('too many errors vs calls',
794+
extra_text=f' ({calls} calls, {errors} errors)',
795+
amount=0.5)
788796
return output
789797

790798
def can_run(self, wasm):

0 commit comments

Comments
 (0)