diff options
author | Alon Zakai <azakai@google.com> | 2023-10-13 11:21:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-13 18:21:58 +0000 |
commit | d77f9abf6113f92fea7e38cee1334c822e51e31e (patch) | |
tree | 72bb102545c607f7a41ff2a608790bfe73e75880 /scripts | |
parent | 5ac91ae35a6f62b30eaa2e80644ac2594ab8576d (diff) | |
download | binaryen-d77f9abf6113f92fea7e38cee1334c822e51e31e.tar.gz binaryen-d77f9abf6113f92fea7e38cee1334c822e51e31e.tar.bz2 binaryen-d77f9abf6113f92fea7e38cee1334c822e51e31e.zip |
Fuzzer: Mark runs where over 50% of functions trap as ignored (#6007)
The number of ignored functions is logged out, so this can help us avoid getting
into a situation where many testcases just trap most of the time rather than
doing anything useful.
50% seems a reasonable cutoff. Even if 50% of functions trap, at least we are
getting 50% that don't, so lots of useful work.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/fuzz_opt.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index 6362b3c3f..9e7b59329 100755 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -592,9 +592,9 @@ def fix_spec_output(out): ignored_vm_runs = 0 -def note_ignored_vm_run(): +def note_ignored_vm_run(text='(ignore VM run)'): global ignored_vm_runs - print('(ignore VM run)') + print(text) ignored_vm_runs += 1 @@ -718,7 +718,22 @@ class CompareVMs(TestCaseHandler): name = 'binaryen interpreter' def run(self, wasm): - return run_bynterp(wasm, ['--fuzz-exec-before']) + output = run_bynterp(wasm, ['--fuzz-exec-before']) + if output != IGNORE: + calls = output.count(FUZZ_EXEC_CALL_PREFIX) + errors = output.count(TRAP_PREFIX) + output.count(HOST_LIMIT_PREFIX) + if errors > calls / 2: + # A significant amount of execution on this testcase + # simply trapped, and was not very useful, so mark it + # as ignored. Ideally the fuzzer testcases would be + # improved to reduce this number. + # + # Note that we don't change output=IGNORE as there may + # 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(f'(testcase mostly ignored: {calls} calls, {errors} errors)') + return output def can_run(self, wasm): return True |