summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/exec/fuzzing-api.wast39
-rw-r--r--test/lit/exec/host-limit.wast2
-rw-r--r--test/passes/fuzz_metrics_noprint.bin.txt52
-rw-r--r--test/passes/simplify-locals_all-features.txt6
-rw-r--r--test/passes/simplify-locals_all-features.wast6
-rw-r--r--test/passes/simplify-locals_all-features_disable-exception-handling.txt6
-rw-r--r--test/passes/simplify-locals_all-features_disable-exception-handling.wast6
-rw-r--r--test/passes/translate-to-fuzz_all-features_metrics_noprint.txt83
8 files changed, 123 insertions, 77 deletions
diff --git a/test/lit/exec/fuzzing-api.wast b/test/lit/exec/fuzzing-api.wast
new file mode 100644
index 000000000..d37d7ef4a
--- /dev/null
+++ b/test/lit/exec/fuzzing-api.wast
@@ -0,0 +1,39 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.
+
+;; RUN: wasm-opt %s -all --fuzz-exec -o /dev/null 2>&1 | filecheck %s
+
+;; Test the fuzzing-support module imports.
+
+(module
+ (import "fuzzing-support" "log-i32" (func $log-i32 (param i32)))
+ (import "fuzzing-support" "log-f64" (func $log-f64 (param f64)))
+
+ (import "fuzzing-support" "throw" (func $throw))
+
+ ;; CHECK: [fuzz-exec] calling logging
+ ;; CHECK-NEXT: [LoggingExternalInterface logging 42]
+ ;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159]
+ (func $logging (export "logging")
+ (call $log-i32
+ (i32.const 42)
+ )
+ (call $log-f64
+ (f64.const 3.14159)
+ )
+ )
+
+ ;; 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 logging
+;; CHECK-NEXT: [LoggingExternalInterface logging 42]
+;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159]
+
+;; CHECK: [fuzz-exec] calling throwing
+;; CHECK-NEXT: [exception thrown: __private ()]
+;; CHECK-NEXT: [fuzz-exec] comparing logging
+;; CHECK-NEXT: [fuzz-exec] comparing throwing
diff --git a/test/lit/exec/host-limit.wast b/test/lit/exec/host-limit.wast
index e64a47d8a..ba5087f69 100644
--- a/test/lit/exec/host-limit.wast
+++ b/test/lit/exec/host-limit.wast
@@ -9,7 +9,7 @@
(module
(type $type$0 (array i8))
- (import "fuzzing-support" "log" (func $log (param i32)))
+ (import "fuzzing-support" "log-i32" (func $log (param i32)))
(global $global (mut (ref $type$0)) (array.new_default $type$0
(i32.const -1)
diff --git a/test/passes/fuzz_metrics_noprint.bin.txt b/test/passes/fuzz_metrics_noprint.bin.txt
index 2f1719633..fab2ccc9d 100644
--- a/test/passes/fuzz_metrics_noprint.bin.txt
+++ b/test/passes/fuzz_metrics_noprint.bin.txt
@@ -1,35 +1,35 @@
Metrics
total
- [exports] : 23
- [funcs] : 34
+ [exports] : 50
+ [funcs] : 72
[globals] : 9
[imports] : 4
[memories] : 1
[memory-data] : 2
- [table-data] : 6
+ [table-data] : 25
[tables] : 1
[tags] : 0
- [total] : 4303
- [vars] : 100
- Binary : 355
- Block : 684
- Break : 149
- Call : 219
+ [total] : 4381
+ [vars] : 218
+ Binary : 335
+ Block : 725
+ Break : 120
+ Call : 210
CallIndirect : 23
- Const : 643
- Drop : 50
- GlobalGet : 367
- GlobalSet : 258
- If : 206
- Load : 78
- LocalGet : 339
- LocalSet : 236
- Loop : 93
- Nop : 41
- RefFunc : 6
- Return : 45
- Select : 41
- Store : 36
- Switch : 1
- Unary : 304
- Unreachable : 129
+ Const : 692
+ Drop : 64
+ GlobalGet : 391
+ GlobalSet : 298
+ If : 236
+ Load : 71
+ LocalGet : 285
+ LocalSet : 209
+ Loop : 76
+ Nop : 63
+ RefFunc : 25
+ Return : 60
+ Select : 23
+ Store : 29
+ Switch : 2
+ Unary : 293
+ Unreachable : 151
diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt
index befbe33ef..9daee90a2 100644
--- a/test/passes/simplify-locals_all-features.txt
+++ b/test/passes/simplify-locals_all-features.txt
@@ -1220,9 +1220,9 @@
(type $9 (func (result f64)))
(type $10 (func (param i32 i32) (result f64)))
(type $11 (func (param i32 i32) (result i32)))
- (import "fuzzing-support" "log1" (func $fimport$0 (type $FUNCSIG$i) (result i32)))
- (import "fuzzing-support" "log2" (func $fimport$1 (type $4) (param i32)))
- (import "fuzzing-support" "log3" (func $fimport$2 (type $7) (param f32)))
+ (import "env" "get1" (func $fimport$0 (type $FUNCSIG$i) (result i32)))
+ (import "fuzzing-support" "log-i32" (func $fimport$1 (type $4) (param i32)))
+ (import "fuzzing-support" "log-f32" (func $fimport$2 (type $7) (param f32)))
(global $global$0 (mut i32) (i32.const 10))
(memory $0 256 256 shared)
(func $nonatomics (type $FUNCSIG$i) (result i32)
diff --git a/test/passes/simplify-locals_all-features.wast b/test/passes/simplify-locals_all-features.wast
index 47bb7f1b5..0c296e378 100644
--- a/test/passes/simplify-locals_all-features.wast
+++ b/test/passes/simplify-locals_all-features.wast
@@ -1194,9 +1194,9 @@
(type $4 (func (param i32)))
(type $5 (func (param i32) (result i32)))
(type $6 (func (param i32 i32 i32 i32 i32 i32)))
- (import "fuzzing-support" "log1" (func $fimport$0 (result i32)))
- (import "fuzzing-support" "log2" (func $fimport$1 (param i32)))
- (import "fuzzing-support" "log3" (func $fimport$2 (param f32)))
+ (import "env" "get1" (func $fimport$0 (result i32)))
+ (import "fuzzing-support" "log-i32" (func $fimport$1 (param i32)))
+ (import "fuzzing-support" "log-f32" (func $fimport$2 (param f32)))
(memory 256 256 shared)
(global $global$0 (mut i32) (i32.const 10))
(func $nonatomics (result i32) ;; loads are reordered
diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.txt b/test/passes/simplify-locals_all-features_disable-exception-handling.txt
index 111223c49..923562867 100644
--- a/test/passes/simplify-locals_all-features_disable-exception-handling.txt
+++ b/test/passes/simplify-locals_all-features_disable-exception-handling.txt
@@ -1214,9 +1214,9 @@
(type $9 (func (result f64)))
(type $10 (func (param i32 i32) (result f64)))
(type $11 (func (param i32 i32) (result i32)))
- (import "fuzzing-support" "log1" (func $fimport$0 (type $FUNCSIG$i) (result i32)))
- (import "fuzzing-support" "log2" (func $fimport$1 (type $4) (param i32)))
- (import "fuzzing-support" "log3" (func $fimport$2 (type $7) (param f32)))
+ (import "env" "get1" (func $fimport$0 (type $FUNCSIG$i) (result i32)))
+ (import "fuzzing-support" "log-i32" (func $fimport$1 (type $4) (param i32)))
+ (import "fuzzing-support" "log-f32" (func $fimport$2 (type $7) (param f32)))
(global $global$0 (mut i32) (i32.const 10))
(memory $0 256 256 shared)
(func $nonatomics (type $FUNCSIG$i) (result i32)
diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.wast b/test/passes/simplify-locals_all-features_disable-exception-handling.wast
index 0fc110696..44c31e344 100644
--- a/test/passes/simplify-locals_all-features_disable-exception-handling.wast
+++ b/test/passes/simplify-locals_all-features_disable-exception-handling.wast
@@ -1194,9 +1194,9 @@
(type $4 (func (param i32)))
(type $5 (func (param i32) (result i32)))
(type $6 (func (param i32 i32 i32 i32 i32 i32)))
- (import "fuzzing-support" "log1" (func $fimport$0 (result i32)))
- (import "fuzzing-support" "log2" (func $fimport$1 (param i32)))
- (import "fuzzing-support" "log3" (func $fimport$2 (param f32)))
+ (import "env" "get1" (func $fimport$0 (result i32)))
+ (import "fuzzing-support" "log-i32" (func $fimport$1 (param i32)))
+ (import "fuzzing-support" "log-f32" (func $fimport$2 (param f32)))
(memory 256 256 shared)
(global $global$0 (mut i32) (i32.const 10))
(func $nonatomics (result i32) ;; loads are reordered
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 3cc841610..c17c9cd1e 100644
--- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
+++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
@@ -1,51 +1,58 @@
Metrics
total
- [exports] : 4
- [funcs] : 7
+ [exports] : 3
+ [funcs] : 4
[globals] : 26
- [imports] : 5
+ [imports] : 6
[memories] : 1
[memory-data] : 20
- [table-data] : 2
+ [table-data] : 0
[tables] : 1
[tags] : 2
- [total] : 510
- [vars] : 15
- ArrayNew : 14
- ArrayNewFixed : 2
- AtomicFence : 1
- Binary : 64
- Block : 45
- Break : 2
- Call : 8
+ [total] : 665
+ [vars] : 20
+ ArrayGet : 2
+ ArrayLen : 2
+ ArrayNew : 15
+ ArrayNewFixed : 3
+ AtomicCmpxchg : 1
+ AtomicRMW : 1
+ Binary : 71
+ Block : 63
+ BrOn : 4
+ Break : 7
+ Call : 18
CallRef : 2
- Const : 127
- Drop : 5
- GlobalGet : 28
+ Const : 142
+ Drop : 10
+ GlobalGet : 33
GlobalSet : 16
- If : 12
- Load : 18
- LocalGet : 46
- LocalSet : 29
- Loop : 3
- MemoryCopy : 1
+ I31Get : 1
+ If : 21
+ Load : 20
+ LocalGet : 61
+ LocalSet : 52
+ Loop : 6
+ MemoryFill : 1
MemoryInit : 1
- Nop : 4
- Pop : 2
- RefCast : 1
- RefFunc : 7
- RefNull : 6
- Return : 9
+ Nop : 7
+ Pop : 1
+ RefAs : 11
+ RefEq : 1
+ RefFunc : 3
+ RefI31 : 1
+ RefNull : 14
+ Return : 5
SIMDExtract : 1
- Store : 1
- StringConst : 7
- StringEq : 1
- StringMeasure : 1
- StringSliceWTF : 1
- StructNew : 14
- Try : 2
+ Select : 2
+ StringConst : 5
+ StringEncode : 1
+ StructGet : 4
+ StructNew : 16
+ StructSet : 1
+ Try : 1
TryTable : 1
- TupleExtract : 3
+ TupleExtract : 2
TupleMake : 6
- Unary : 9
- Unreachable : 10
+ Unary : 20
+ Unreachable : 9