diff options
author | Alon Zakai <azakai@google.com> | 2024-11-26 16:24:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-26 16:24:34 -0800 |
commit | cd3805e31e8f2544d5e32aa505fc5e3abcf93df2 (patch) | |
tree | b0e932a03e3953e2ccaa13f0586a5d580e6a9ac2 | |
parent | 98f57983b0bbb05222ce45bb84cf8b87f36f03f1 (diff) | |
download | binaryen-cd3805e31e8f2544d5e32aa505fc5e3abcf93df2.tar.gz binaryen-cd3805e31e8f2544d5e32aa505fc5e3abcf93df2.tar.bz2 binaryen-cd3805e31e8f2544d5e32aa505fc5e3abcf93df2.zip |
[NFC] Add a node test for fuzz_shell.js running on two input wasms (#7123)
This feature is depended on by our ClusterFuzz integration.
-rw-r--r-- | test/lit/node/fuzz_shell_second.wast | 32 | ||||
-rw-r--r-- | test/lit/node/fuzz_shell_second.wast.second | 8 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/lit/node/fuzz_shell_second.wast b/test/lit/node/fuzz_shell_second.wast new file mode 100644 index 000000000..6fbe8d764 --- /dev/null +++ b/test/lit/node/fuzz_shell_second.wast @@ -0,0 +1,32 @@ +;; Test that the fuzz_shell.js file will run a second wasm file that is +;; provided, and call its exports as well as the first module's. + +(module + (func $first (export "first") (result i32) + (i32.const 42) + ) +) + +;; Build both files to binary. +;; +;; RUN: wasm-opt %s -o %t.wasm -q +;; RUN: wasm-opt %s.second -o %t.second.wasm -q + +;; Run in node. +;; +;; RUN: node %S/../../../scripts/fuzz_shell.js %t.wasm %t.second.wasm | filecheck %s +;; +;; CHECK: [fuzz-exec] calling first +;; CHECK: [fuzz-exec] note result: first => 42 +;; CHECK: [fuzz-exec] calling second +;; CHECK: [fuzz-exec] note result: second => 1337 + +;; Run in reverse order, flipping the order in the output. +;; +;; RUN: node %S/../../../scripts/fuzz_shell.js %t.second.wasm %t.wasm | filecheck %s --check-prefix=REVERSE +;; +;; REVERSE: [fuzz-exec] calling second +;; REVERSE: [fuzz-exec] note result: second => 1337 +;; REVERSE: [fuzz-exec] calling first +;; REVERSE: [fuzz-exec] note result: first => 42 + diff --git a/test/lit/node/fuzz_shell_second.wast.second b/test/lit/node/fuzz_shell_second.wast.second new file mode 100644 index 000000000..3c52a59c9 --- /dev/null +++ b/test/lit/node/fuzz_shell_second.wast.second @@ -0,0 +1,8 @@ +;; Second module for the test. + +(module + (func $second (export "second") (result i32) + (i32.const 1337) + ) +) + |