From 45d8f24ad36562939bed14b2157fd5bb51c396bc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 20 Nov 2024 16:40:29 -0800 Subject: [NFC] Refactor nice methods in fuzz_shell.js (#7096) This mostly moves the code around and avoids some duplication. It also tracks the list of exports with both names and values, so that if we compile more than one module, we can still access exports from the previous. Also add a first test of running fuzz_shell.js in node. This does make build() append the exports, which was done before on the main module but not the second one. That only affects the wasm-split fuzzer, which is not active yet, so this is still NFC. --- test/lit/node/fuzz_shell.wast | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/lit/node/fuzz_shell.wast (limited to 'test') diff --git a/test/lit/node/fuzz_shell.wast b/test/lit/node/fuzz_shell.wast new file mode 100644 index 000000000..deb157ec8 --- /dev/null +++ b/test/lit/node/fuzz_shell.wast @@ -0,0 +1,20 @@ +;; Test running a wasm file in fuzz_shell.js. + +(module + (func $test (export "test") (result i32) + (i32.const 42) + ) +) + +;; Build to a binary wasm. +;; +;; RUN: wasm-opt %s -o %t.wasm -q + +;; Run in node. +;; +;; RUN: node %S/../../../scripts/fuzz_shell.js %t.wasm | filecheck %s +;; +;; CHECK: [fuzz-exec] calling test +;; CHECK: [fuzz-exec] note result: test => 42 + + -- cgit v1.2.3