diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/exec/fuzzing-api.wast | 56 | ||||
-rw-r--r-- | test/passes/fuzz_metrics_noprint.bin.txt | 56 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz_all-features_metrics_noprint.txt | 80 |
3 files changed, 119 insertions, 73 deletions
diff --git a/test/lit/exec/fuzzing-api.wast b/test/lit/exec/fuzzing-api.wast index 0d0f25130..38a8ce41b 100644 --- a/test/lit/exec/fuzzing-api.wast +++ b/test/lit/exec/fuzzing-api.wast @@ -13,8 +13,13 @@ (import "fuzzing-support" "table-set" (func $table.set (param i32 funcref))) (import "fuzzing-support" "table-get" (func $table.get (param i32) (result funcref))) + (import "fuzzing-support" "call-export" (func $call.export (param i32))) + (import "fuzzing-support" "call-export-catch" (func $call.export.catch (param i32) (result i32))) + (table $table 10 20 funcref) + ;; Note that the exported table appears first here, but in the binary and in + ;; the IR it is actually last, as we always add function exports first. (export "table" (table $table)) ;; CHECK: [fuzz-exec] calling logging @@ -53,7 +58,6 @@ ;; 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 @@ -77,6 +81,43 @@ ) ) ) + + ;; CHECK: [fuzz-exec] calling export.calling + ;; CHECK-NEXT: [LoggingExternalInterface logging 42] + ;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159] + ;; CHECK-NEXT: [exception thrown: __private ()] + (func $export.calling (export "export.calling") + ;; At index 0 in the exports we have $logging, so we will do those loggings. + (call $call.export + (i32.const 0) + ) + ;; At index 999 we have nothing, so we'll error. + (call $call.export + (i32.const 999) + ) + ) + + ;; CHECK: [fuzz-exec] calling export.calling.catching + ;; CHECK-NEXT: [LoggingExternalInterface logging 42] + ;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159] + ;; CHECK-NEXT: [LoggingExternalInterface logging 0] + ;; CHECK-NEXT: [LoggingExternalInterface logging 1] + ;; CHECK-NEXT: warning: no passes specified, not doing any work + (func $export.calling.catching (export "export.calling.catching") + ;; At index 0 in the exports we have $logging, so we will do those loggings, + ;; then log a 0 as no exception happens. + (call $log-i32 + (call $call.export.catch + (i32.const 0) + ) + ) + ;; At index 999 we have nothing, so we'll error, catch it, and log 1. + (call $log-i32 + (call $call.export.catch + (i32.const 999) + ) + ) + ) ) ;; CHECK: [fuzz-exec] calling logging ;; CHECK-NEXT: [LoggingExternalInterface logging 42] @@ -92,6 +133,19 @@ ;; CHECK-NEXT: [LoggingExternalInterface logging 0] ;; CHECK-NEXT: [LoggingExternalInterface logging 1] ;; CHECK-NEXT: [exception thrown: __private ()] + +;; CHECK: [fuzz-exec] calling export.calling +;; CHECK-NEXT: [LoggingExternalInterface logging 42] +;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159] +;; CHECK-NEXT: [exception thrown: __private ()] + +;; CHECK: [fuzz-exec] calling export.calling.catching +;; CHECK-NEXT: [LoggingExternalInterface logging 42] +;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159] +;; CHECK-NEXT: [LoggingExternalInterface logging 0] +;; CHECK-NEXT: [LoggingExternalInterface logging 1] +;; CHECK-NEXT: [fuzz-exec] comparing export.calling +;; CHECK-NEXT: [fuzz-exec] comparing export.calling.catching ;; CHECK-NEXT: [fuzz-exec] comparing logging ;; CHECK-NEXT: [fuzz-exec] comparing table.getting ;; CHECK-NEXT: [fuzz-exec] comparing table.setting diff --git a/test/passes/fuzz_metrics_noprint.bin.txt b/test/passes/fuzz_metrics_noprint.bin.txt index ba0ccaa10..0fa206e0a 100644 --- a/test/passes/fuzz_metrics_noprint.bin.txt +++ b/test/passes/fuzz_metrics_noprint.bin.txt @@ -1,35 +1,35 @@ Metrics total - [exports] : 25 - [funcs] : 40 + [exports] : 45 + [funcs] : 60 [globals] : 18 - [imports] : 4 + [imports] : 5 [memories] : 1 [memory-data] : 24 - [table-data] : 19 + [table-data] : 15 [tables] : 1 [tags] : 0 - [total] : 5335 - [vars] : 170 - Binary : 403 - Block : 900 - Break : 163 - Call : 197 - CallIndirect : 11 - Const : 824 - Drop : 56 - GlobalGet : 464 - GlobalSet : 342 - If : 298 - Load : 87 - LocalGet : 402 - LocalSet : 304 - Loop : 126 - Nop : 74 - RefFunc : 19 - Return : 60 - Select : 34 - Store : 46 - Switch : 1 - Unary : 356 - Unreachable : 168 + [total] : 5475 + [vars] : 222 + Binary : 410 + Block : 870 + Break : 148 + Call : 271 + CallIndirect : 30 + Const : 915 + Drop : 51 + GlobalGet : 458 + GlobalSet : 323 + If : 293 + Load : 96 + LocalGet : 442 + LocalSet : 284 + Loop : 99 + Nop : 76 + RefFunc : 15 + Return : 78 + Select : 47 + Store : 44 + Switch : 2 + Unary : 365 + Unreachable : 158 diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt index fd37193f5..a77708b2e 100644 --- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt +++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt @@ -1,56 +1,48 @@ Metrics total - [exports] : 7 - [funcs] : 8 + [exports] : 6 + [funcs] : 12 [globals] : 4 [imports] : 8 [memories] : 1 [memory-data] : 112 - [table-data] : 0 + [table-data] : 3 [tables] : 1 - [tags] : 1 - [total] : 645 - [vars] : 33 - ArrayGet : 2 - ArrayLen : 1 - ArrayNew : 3 + [tags] : 0 + [total] : 608 + [vars] : 48 + ArrayNew : 5 ArrayNewFixed : 5 - AtomicCmpxchg : 1 - AtomicFence : 1 - AtomicRMW : 1 - Binary : 76 - Block : 64 + Binary : 75 + Block : 80 + BrOn : 5 Break : 4 - Call : 15 - Const : 149 - DataDrop : 1 - Drop : 1 - GlobalGet : 25 - GlobalSet : 22 - If : 22 - Load : 25 - LocalGet : 55 - LocalSet : 35 - Loop : 4 - MemoryFill : 1 + Call : 21 + CallRef : 1 + Const : 113 + Drop : 15 + GlobalGet : 39 + GlobalSet : 36 + If : 21 + Load : 17 + LocalGet : 45 + LocalSet : 20 + Loop : 7 Nop : 7 - Pop : 6 - RefAs : 5 - RefCast : 1 - RefEq : 2 - RefFunc : 13 + RefAs : 2 + RefEq : 1 + RefFunc : 9 + RefI31 : 1 RefIsNull : 1 - RefNull : 10 + RefNull : 8 Return : 5 - SIMDExtract : 1 - Select : 6 - StringConst : 1 - StringEncode : 1 - StructNew : 24 - StructSet : 1 - Try : 7 - TryTable : 2 - TupleExtract : 2 - TupleMake : 3 - Unary : 23 - Unreachable : 11 + Select : 2 + Store : 1 + StringConst : 4 + StringEq : 1 + StringMeasure : 2 + StructNew : 13 + TupleExtract : 1 + TupleMake : 4 + Unary : 19 + Unreachable : 18 |