Skip to content

Commit cd3805e

Browse files
authored
[NFC] Add a node test for fuzz_shell.js running on two input wasms (#7123)
This feature is depended on by our ClusterFuzz integration.
1 parent 98f5798 commit cd3805e

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
;; Test that the fuzz_shell.js file will run a second wasm file that is
2+
;; provided, and call its exports as well as the first module's.
3+
4+
(module
5+
(func $first (export "first") (result i32)
6+
(i32.const 42)
7+
)
8+
)
9+
10+
;; Build both files to binary.
11+
;;
12+
;; RUN: wasm-opt %s -o %t.wasm -q
13+
;; RUN: wasm-opt %s.second -o %t.second.wasm -q
14+
15+
;; Run in node.
16+
;;
17+
;; RUN: node %S/../../../scripts/fuzz_shell.js %t.wasm %t.second.wasm | filecheck %s
18+
;;
19+
;; CHECK: [fuzz-exec] calling first
20+
;; CHECK: [fuzz-exec] note result: first => 42
21+
;; CHECK: [fuzz-exec] calling second
22+
;; CHECK: [fuzz-exec] note result: second => 1337
23+
24+
;; Run in reverse order, flipping the order in the output.
25+
;;
26+
;; RUN: node %S/../../../scripts/fuzz_shell.js %t.second.wasm %t.wasm | filecheck %s --check-prefix=REVERSE
27+
;;
28+
;; REVERSE: [fuzz-exec] calling second
29+
;; REVERSE: [fuzz-exec] note result: second => 1337
30+
;; REVERSE: [fuzz-exec] calling first
31+
;; REVERSE: [fuzz-exec] note result: first => 42
32+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
;; Second module for the test.
2+
3+
(module
4+
(func $second (export "second") (result i32)
5+
(i32.const 1337)
6+
)
7+
)
8+

0 commit comments

Comments
 (0)