summaryrefslogtreecommitdiff
path: root/scripts/fuzz_opt.py
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-11-25 15:36:04 -0800
committerGitHub <noreply@github.com>2020-11-25 15:36:04 -0800
commit3c66ad3c7c602416d4cf674b3d7528d9acd6d51f (patch)
treeecf2308d4cbc2c995c66fcc9375b7bab341d6ca0 /scripts/fuzz_opt.py
parent72c035e905b3695f2763fdeb21163003d8595887 (diff)
downloadbinaryen-3c66ad3c7c602416d4cf674b3d7528d9acd6d51f.tar.gz
binaryen-3c66ad3c7c602416d4cf674b3d7528d9acd6d51f.tar.bz2
binaryen-3c66ad3c7c602416d4cf674b3d7528d9acd6d51f.zip
[TypedFunctionReferences] Enable call_ref in fuzzer, and fix minor misc fuzz bugs (#3401)
* Count signatures in tuple locals. * Count nested signature types (confirming @aheejin was right, that was missing). * Inlining was using the wrong type. * OptimizeInstructions should return -1 for unhandled types, not error. * The fuzzer should check for ref types as well, not just typed function references, similar to what GC does. * The fuzzer now creates a function if it has no other option for creating a constant expression of a function type, then does a ref.func of that. * Handle unreachability in call_ref binary reading. * S-expression parsing fixes in more places, and add a tiny fuzzer for it. * Switch fuzzer test to just have the metrics, and not print all the fuzz output which changes a lot. Also fix noprint handling which only worked on binaries before. * Fix Properties::getLiteral() to use the specific function type properly, and make Literal's function constructor require that, to prevent future bugs. * Turn all input types into nullable types, for now.
Diffstat (limited to 'scripts/fuzz_opt.py')
-rwxr-xr-xscripts/fuzz_opt.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index 78a706262..00031e3b7 100755
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -791,6 +791,15 @@ class Asyncify(TestCaseHandler):
return all([x in feature_opts for x in ['--disable-exception-handling', '--disable-simd', '--disable-tail-call', '--disable-reference-types', '--disable-multivalue', '--disable-gc']])
+# Check that the text format round-trips without error.
+class RoundtripText(TestCaseHandler):
+ frequency = 0.05
+
+ def handle(self, wasm):
+ run([in_bin('wasm-dis'), wasm, '-o', 'a.wast'])
+ run([in_bin('wasm-opt'), 'a.wast'] + FEATURE_OPTS)
+
+
# The global list of all test case handlers
testcase_handlers = [
FuzzExec(),
@@ -798,6 +807,7 @@ testcase_handlers = [
CheckDeterminism(),
Wasm2JS(),
Asyncify(),
+ RoundtripText()
]