summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split
diff options
context:
space:
mode:
authorAleksander Guryanov <caiiiycuk@gmail.com>2021-08-23 22:08:26 +0700
committerGitHub <noreply@github.com>2021-08-23 15:08:26 +0000
commit3d88d11176a26b1156b83a71bbc033c71772dabe (patch)
tree6bea0d6a5fc77ce50a474eedefd1df4be9149d20 /test/lit/wasm-split
parentf1aa78c022eb3f96a0d97e28ce9c35edbe7c45a1 (diff)
downloadbinaryen-3d88d11176a26b1156b83a71bbc033c71772dabe.tar.gz
binaryen-3d88d11176a26b1156b83a71bbc033c71772dabe.tar.bz2
binaryen-3d88d11176a26b1156b83a71bbc033c71772dabe.zip
wasm-split: accept file in keep-funcs/split-funcs (#4053)
Diffstat (limited to 'test/lit/wasm-split')
-rw-r--r--test/lit/wasm-split/bar.txt1
-rw-r--r--test/lit/wasm-split/basic.wast25
-rw-r--r--test/lit/wasm-split/both.txt2
-rw-r--r--test/lit/wasm-split/foo.txt1
-rw-r--r--test/lit/wasm-split/none.txt1
5 files changed, 30 insertions, 0 deletions
diff --git a/test/lit/wasm-split/bar.txt b/test/lit/wasm-split/bar.txt
new file mode 100644
index 000000000..5716ca598
--- /dev/null
+++ b/test/lit/wasm-split/bar.txt
@@ -0,0 +1 @@
+bar
diff --git a/test/lit/wasm-split/basic.wast b/test/lit/wasm-split/basic.wast
index 7bbc14b49..6d5e6c870 100644
--- a/test/lit/wasm-split/basic.wast
+++ b/test/lit/wasm-split/basic.wast
@@ -1,23 +1,46 @@
+;; RUN: not wasm-split %s --export-prefix='%' -g -o1 %t.none.1.wasm -o2 %t.none.2.wasm --keep-funcs=@failed-to-open.txt -v 2>&1 \
+;; RUN: | filecheck %s --check-prefix FAILED-TO-OPEN
+
;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.none.1.wasm -o2 %t.none.2.wasm -v 2>&1 \
;; RUN: | filecheck %s --check-prefix KEEP-NONE
;; RUN: wasm-dis %t.none.1.wasm | filecheck %s --check-prefix KEEP-NONE-PRIMARY
;; RUN: wasm-dis %t.none.2.wasm | filecheck %s --check-prefix KEEP-NONE-SECONDARY
+;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.none.1.wasm -o2 %t.none.2.wasm --keep-funcs=@%S/none.txt -v 2>&1 \
+;; RUN: | filecheck %s --check-prefix KEEP-NONE
+;; RUN: wasm-dis %t.none.1.wasm | filecheck %s --check-prefix KEEP-NONE-PRIMARY
+;; RUN: wasm-dis %t.none.2.wasm | filecheck %s --check-prefix KEEP-NONE-SECONDARY
+
;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.foo.1.wasm -o2 %t.foo.2.wasm --keep-funcs=foo -v 2>&1 \
;; RUN: | filecheck %s --check-prefix KEEP-FOO
;; RUN: wasm-dis %t.foo.1.wasm | filecheck %s --check-prefix KEEP-FOO-PRIMARY
;; RUN: wasm-dis %t.foo.2.wasm | filecheck %s --check-prefix KEEP-FOO-SECONDARY
+;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.foo.1.wasm -o2 %t.foo.2.wasm --keep-funcs=@%S/foo.txt -v 2>&1 \
+;; RUN: | filecheck %s --check-prefix KEEP-FOO
+;; RUN: wasm-dis %t.foo.1.wasm | filecheck %s --check-prefix KEEP-FOO-PRIMARY
+;; RUN: wasm-dis %t.foo.2.wasm | filecheck %s --check-prefix KEEP-FOO-SECONDARY
+
;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm --keep-funcs=bar -v 2>&1 \
;; RUN: | filecheck %s --check-prefix KEEP-BAR
;; RUN: wasm-dis %t.bar.1.wasm | filecheck %s --check-prefix KEEP-BAR-PRIMARY
;; RUN: wasm-dis %t.bar.2.wasm | filecheck %s --check-prefix KEEP-BAR-SECONDARY
+;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm --keep-funcs=@%S/bar.txt -v 2>&1 \
+;; RUN: | filecheck %s --check-prefix KEEP-BAR
+;; RUN: wasm-dis %t.bar.1.wasm | filecheck %s --check-prefix KEEP-BAR-PRIMARY
+;; RUN: wasm-dis %t.bar.2.wasm | filecheck %s --check-prefix KEEP-BAR-SECONDARY
+
;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.both.1.wasm -o2 %t.both.2.wasm --keep-funcs=foo,bar -v 2>&1 \
;; RUN: | filecheck %s --check-prefix KEEP-BOTH
;; RUN: wasm-dis %t.both.1.wasm | filecheck %s --check-prefix KEEP-BOTH-PRIMARY
;; RUN: wasm-dis %t.both.2.wasm | filecheck %s --check-prefix KEEP-BOTH-SECONDARY
+;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.both.1.wasm -o2 %t.both.2.wasm --keep-funcs=@%S/both.txt -v 2>&1 \
+;; RUN: | filecheck %s --check-prefix KEEP-BOTH
+;; RUN: wasm-dis %t.both.1.wasm | filecheck %s --check-prefix KEEP-BOTH-PRIMARY
+;; RUN: wasm-dis %t.both.2.wasm | filecheck %s --check-prefix KEEP-BOTH-SECONDARY
+
(module
(table $table 1 1 funcref)
(elem (i32.const 0) $foo)
@@ -29,6 +52,8 @@
)
)
+;; FAILED-TO-OPEN: Failed opening 'failed-to-open.txt'
+
;; KEEP-NONE: warning: not keeping any functions in the primary module
;; KEEP-NONE-PRIMARY: (module
diff --git a/test/lit/wasm-split/both.txt b/test/lit/wasm-split/both.txt
new file mode 100644
index 000000000..3bd1f0e29
--- /dev/null
+++ b/test/lit/wasm-split/both.txt
@@ -0,0 +1,2 @@
+foo
+bar
diff --git a/test/lit/wasm-split/foo.txt b/test/lit/wasm-split/foo.txt
new file mode 100644
index 000000000..257cc5642
--- /dev/null
+++ b/test/lit/wasm-split/foo.txt
@@ -0,0 +1 @@
+foo
diff --git a/test/lit/wasm-split/none.txt b/test/lit/wasm-split/none.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/test/lit/wasm-split/none.txt
@@ -0,0 +1 @@
+