Skip to content

Commit

Permalink
[NFC] Fix fuzzer counting of ignored runs due to many errors (WebAsse…
Browse files Browse the repository at this point in the history
…mbly#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.
  • Loading branch information
kripken committed Mar 27, 2024
1 parent 165953e commit 869fefd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/fuzz_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,12 @@ def fix_spec_output(out):

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


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

def can_run(self, wasm):
Expand Down

0 comments on commit 869fefd

Please sign in to comment.