diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/help/wasm-split.test | 11 | ||||
-rw-r--r-- | test/lit/wasm-split/bar.txt | 1 | ||||
-rw-r--r-- | test/lit/wasm-split/basic.wast | 25 | ||||
-rw-r--r-- | test/lit/wasm-split/both.txt | 2 | ||||
-rw-r--r-- | test/lit/wasm-split/foo.txt | 1 | ||||
-rw-r--r-- | test/lit/wasm-split/none.txt | 1 |
6 files changed, 39 insertions, 2 deletions
diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test index 28f079d2f..362c20d84 100644 --- a/test/lit/help/wasm-split.test +++ b/test/lit/help/wasm-split.test @@ -36,13 +36,20 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --keep-funcs [split] Comma-separated list of functions ;; CHECK-NEXT: to keep in the primary module, regardless -;; CHECK-NEXT: of any profile. +;; CHECK-NEXT: of any profile. You can also pass a file +;; CHECK-NEXT: with a list of functions separated by new +;; CHECK-NEXT: lines. To do this, prepend @ before +;; CHECK-NEXT: filename (--keep-funcs @myfile) ;; CHECK-NEXT: ;; CHECK-NEXT: --split-funcs [split] Comma-separated list of functions ;; CHECK-NEXT: to split into the secondary module, ;; CHECK-NEXT: regardless of any profile. If there is no ;; CHECK-NEXT: profile, then this defaults to all -;; CHECK-NEXT: functions defined in the module. +;; CHECK-NEXT: functions defined in the module. You can +;; CHECK-NEXT: also pass a file with a list of functions +;; CHECK-NEXT: separated by new lines. To do this, +;; CHECK-NEXT: prepend @ before filename (--split-funcs +;; CHECK-NEXT: @myfile) ;; CHECK-NEXT: ;; CHECK-NEXT: --primary-output,-o1 [split] Output file for the primary ;; CHECK-NEXT: module. 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 @@ + |