diff options
author | Alon Zakai <azakai@google.com> | 2024-12-16 15:21:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-16 15:21:10 -0800 |
commit | aa0550e28002183dd7ea9c2a48ec3533ba70f862 (patch) | |
tree | 56566cbe1c03ef9477171651cb8514289c16a65e /test/lit/exec | |
parent | 353b759b230dff8fb82aeb157aeb6db360d74a49 (diff) | |
download | binaryen-aa0550e28002183dd7ea9c2a48ec3533ba70f862.tar.gz binaryen-aa0550e28002183dd7ea9c2a48ec3533ba70f862.tar.bz2 binaryen-aa0550e28002183dd7ea9c2a48ec3533ba70f862.zip |
Fuzz JSPI (#7148)
* Add a new "sleep" fuzzer import, that does a sleep for some ms.
* Add JSPI support in fuzz_shell.js. This is in the form of commented-out async/await
keywords - commented out so that normal fuzzing is not impacted. When we want
to fuzz JSPI, we uncomment them. We also apply the JSPI operations of marking
imports and exports as suspending/promising.
JSPI fuzzing is added to both fuzz_opt.py and ClusterFuzz's run.py.
Diffstat (limited to 'test/lit/exec')
-rw-r--r-- | test/lit/exec/fuzzing-api.wast | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/lit/exec/fuzzing-api.wast b/test/lit/exec/fuzzing-api.wast index 7c975cb75..8e251b2ed 100644 --- a/test/lit/exec/fuzzing-api.wast +++ b/test/lit/exec/fuzzing-api.wast @@ -19,6 +19,8 @@ (import "fuzzing-support" "call-ref" (func $call.ref (param funcref))) (import "fuzzing-support" "call-ref-catch" (func $call.ref.catch (param funcref) (result i32))) + (import "fuzzing-support" "sleep" (func $sleep (param i32 i32) (result i32))) + (table $table 10 20 funcref) ;; Note that the exported table appears first here, but in the binary and in @@ -284,7 +286,6 @@ ;; CHECK: [fuzz-exec] calling ref.calling.trap ;; CHECK-NEXT: [trap unreachable] - ;; CHECK-NEXT: warning: no passes specified, not doing any work (func $ref.calling.trap (export "ref.calling.trap") ;; We try to catch an exception here, but the target function traps, which is ;; not something we can catch. We will trap here, and not log at all. @@ -294,6 +295,18 @@ ) ) ) + + ;; CHECK: [fuzz-exec] calling do-sleep + ;; CHECK-NEXT: [fuzz-exec] note result: do-sleep => 42 + ;; CHECK-NEXT: warning: no passes specified, not doing any work + (func $do-sleep (export "do-sleep") (result i32) + (call $sleep + ;; A ridiculous amount of ms, but in the interpreter it is ignored anyhow. + (i32.const -1) + ;; An id, that is returned back to us. + (i32.const 42) + ) + ) ) ;; CHECK: [fuzz-exec] calling logging ;; CHECK-NEXT: [LoggingExternalInterface logging 42] @@ -354,6 +367,10 @@ ;; CHECK: [fuzz-exec] calling ref.calling.trap ;; CHECK-NEXT: [trap unreachable] + +;; CHECK: [fuzz-exec] calling do-sleep +;; CHECK-NEXT: [fuzz-exec] note result: do-sleep => 42 +;; CHECK-NEXT: [fuzz-exec] comparing do-sleep ;; CHECK-NEXT: [fuzz-exec] comparing export.calling ;; CHECK-NEXT: [fuzz-exec] comparing export.calling.catching ;; CHECK-NEXT: [fuzz-exec] comparing logging |