diff options
author | Alon Zakai <azakai@google.com> | 2024-10-31 13:54:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 13:54:21 -0700 |
commit | 1b066cb3101dade3fe5be69218a7de41fa79599f (patch) | |
tree | 13b539c2452eb9dea02779eeac43c91e5081d611 /test/lit/exec | |
parent | e32b76d6325f0997fabef20cc546526075db09a4 (diff) | |
download | binaryen-1b066cb3101dade3fe5be69218a7de41fa79599f.tar.gz binaryen-1b066cb3101dade3fe5be69218a7de41fa79599f.tar.bz2 binaryen-1b066cb3101dade3fe5be69218a7de41fa79599f.zip |
Fuzz the Table from JS (#7042)
Continues the work from #7027 which added throwing from JS, this adds
table get/set operations from JS, to further increase our coverage of
Wasm/JS interactions (the table can be used from both sides).
Diffstat (limited to 'test/lit/exec')
-rw-r--r-- | test/lit/exec/fuzzing-api.wast | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/test/lit/exec/fuzzing-api.wast b/test/lit/exec/fuzzing-api.wast index d37d7ef4a..0d0f25130 100644 --- a/test/lit/exec/fuzzing-api.wast +++ b/test/lit/exec/fuzzing-api.wast @@ -10,6 +10,13 @@ (import "fuzzing-support" "throw" (func $throw)) + (import "fuzzing-support" "table-set" (func $table.set (param i32 funcref))) + (import "fuzzing-support" "table-get" (func $table.get (param i32) (result funcref))) + + (table $table 10 20 funcref) + + (export "table" (table $table)) + ;; CHECK: [fuzz-exec] calling logging ;; CHECK-NEXT: [LoggingExternalInterface logging 42] ;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159] @@ -24,10 +31,52 @@ ;; CHECK: [fuzz-exec] calling throwing ;; CHECK-NEXT: [exception thrown: __private ()] - ;; CHECK-NEXT: warning: no passes specified, not doing any work (func $throwing (export "throwing") (call $throw) ) + + ;; CHECK: [fuzz-exec] calling table.setting + ;; CHECK-NEXT: [exception thrown: __private ()] + (func $table.setting (export "table.setting") + (call $table.set + (i32.const 5) + (ref.func $table.setting) + ) + ;; Out of bounds sets will throw. + (call $table.set + (i32.const 9999) + (ref.func $table.setting) + ) + ) + + ;; CHECK: [fuzz-exec] calling table.getting + ;; CHECK-NEXT: [LoggingExternalInterface logging 0] + ;; CHECK-NEXT: [LoggingExternalInterface logging 1] + ;; CHECK-NEXT: [exception thrown: __private ()] + ;; CHECK-NEXT: warning: no passes specified, not doing any work + (func $table.getting (export "table.getting") + ;; There is a non-null value at 5, and a null at 6. + (call $log-i32 + (ref.is_null + (call $table.get + (i32.const 5) + ) + ) + ) + (call $log-i32 + (ref.is_null + (call $table.get + (i32.const 6) + ) + ) + ) + ;; Out of bounds gets will throw. + (drop + (call $table.get + (i32.const 9999) + ) + ) + ) ) ;; CHECK: [fuzz-exec] calling logging ;; CHECK-NEXT: [LoggingExternalInterface logging 42] @@ -35,5 +84,15 @@ ;; CHECK: [fuzz-exec] calling throwing ;; CHECK-NEXT: [exception thrown: __private ()] + +;; CHECK: [fuzz-exec] calling table.setting +;; CHECK-NEXT: [exception thrown: __private ()] + +;; CHECK: [fuzz-exec] calling table.getting +;; CHECK-NEXT: [LoggingExternalInterface logging 0] +;; CHECK-NEXT: [LoggingExternalInterface logging 1] +;; CHECK-NEXT: [exception thrown: __private ()] ;; CHECK-NEXT: [fuzz-exec] comparing logging +;; CHECK-NEXT: [fuzz-exec] comparing table.getting +;; CHECK-NEXT: [fuzz-exec] comparing table.setting ;; CHECK-NEXT: [fuzz-exec] comparing throwing |