summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-07-02 23:58:30 +0000
committerGitHub <noreply@github.com>2021-07-02 16:58:30 -0700
commit643b96736b7b5b75b91ab35ee926154eb33492e0 (patch)
treeb3d52c14f369110983386df523ac5ad5713c1cb9 /test
parent94b6c5f625541550c1df484a37daf0225c318396 (diff)
downloadbinaryen-643b96736b7b5b75b91ab35ee926154eb33492e0.tar.gz
binaryen-643b96736b7b5b75b91ab35ee926154eb33492e0.tar.bz2
binaryen-643b96736b7b5b75b91ab35ee926154eb33492e0.zip
Support generating checks for multiple modules (#3962)
In conjunction with the `foreach` tool, allows autogenerating checks for lit tests containing multiple modules. Supporting this will help automatically port existing bespoke wast tests to be lit tests, since many of those tests contain multiple modules per file.
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/extract-function.wast69
1 files changed, 41 insertions, 28 deletions
diff --git a/test/lit/passes/extract-function.wast b/test/lit/passes/extract-function.wast
index 1a8970598..606fd326c 100644
--- a/test/lit/passes/extract-function.wast
+++ b/test/lit/passes/extract-function.wast
@@ -1,71 +1,84 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: foreach %s %t wasm-opt --extract-function=foo -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt --extract-function --pass-arg=extract-function@foo -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt --extract-function-index=0 -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt --extract-function-index --pass-arg=extract-function-index@0 -S -o - | filecheck %s
-;; CHECK: (module
-;; CHECK-NEXT: (type $none_=>_none (func))
-;; CHECK-NEXT: (import "env" "bar" (func $bar))
-;; CHECK-NEXT: (export "foo" (func $foo))
-;; CHECK-NEXT: (func $foo
-;; CHECK-NEXT: (call $bar)
-;; CHECK-NEXT: )
-;; CHECK-NEXT: )
(module
+ ;; CHECK: (type $none_=>_none (func))
+
+ ;; CHECK: (import "env" "bar" (func $bar))
+
+ ;; CHECK: (export "foo" (func $foo))
+
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (call $bar)
+ ;; CHECK-NEXT: )
(func $foo
(call $bar)
)
+
(func $bar
(call $foo)
)
+
(func $other
(drop (i32.const 1))
)
)
-;; CHECK: (module
-;; CHECK-NEXT: (type $none_=>_none (func))
-;; CHECK-NEXT: (import "env" "other" (func $other))
-;; CHECK-NEXT: (export "foo" (func $foo))
-;; CHECK-NEXT: (func $foo
-;; CHECK-NEXT: (nop)
-;; CHECK-NEXT: )
-;; CHECK-NEXT: )
(module
;; Use another function in the table, but the table is not used in the
;; extracted function
(table $t 10 funcref)
+
(elem $0 (table $t) (i32.const 0) func $other)
+
+ ;; CHECK: (type $none_=>_none (func))
+
+ ;; CHECK: (import "env" "other" (func $other))
+
+ ;; CHECK: (export "foo" (func $foo))
+
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $foo
(nop)
)
+
(func $other
(drop (i32.const 1))
)
)
-;; CHECK: (module
-;; CHECK-NEXT: (type $none (func))
-;; CHECK-NEXT: (import "env" "other" (func $other))
-;; CHECK-NEXT: (table $t 10 funcref)
-;; CHECK-NEXT: (elem $0 (i32.const 0) $other)
-;; CHECK-NEXT: (export "foo" (func $foo))
-;; CHECK-NEXT: (func $foo
-;; CHECK-NEXT: (call_indirect (type $none)
-;; CHECK-NEXT: (i32.const 10)
-;; CHECK-NEXT: )
-;; CHECK-NEXT: )
-;; CHECK-NEXT: )
(module
;; Use another function in the table, and the table *is* used. As a result,
;; the table and its elements will remain. The called function, $other, will
;; remain as an import that is placed in the table.
+
+ ;; CHECK: (type $none (func))
(type $none (func))
+
+ ;; CHECK: (import "env" "other" (func $other))
+
+ ;; CHECK: (table $t 10 funcref)
(table $t 10 funcref)
+
+ ;; CHECK: (elem $0 (i32.const 0) $other)
(elem $0 (table $t) (i32.const 0) func $other)
+
+ ;; CHECK: (export "foo" (func $foo))
+
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (call_indirect (type $none)
+ ;; CHECK-NEXT: (i32.const 10)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
(func $foo
(call_indirect (type $none) (i32.const 10))
)
+
(func $other
(drop (i32.const 1))
)