summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-09-24 14:25:05 -0700
committerGitHub <noreply@github.com>2021-09-24 14:25:05 -0700
commitab3811dafb27edd81f919d0096630014184b3836 (patch)
tree632000d37a75a3c5913bce7b0c17c163b430acbf /test/lit/wasm-split
parenta6dbadb8d180aff3c481ad8fd3009a712c11b449 (diff)
downloadbinaryen-ab3811dafb27edd81f919d0096630014184b3836.tar.gz
binaryen-ab3811dafb27edd81f919d0096630014184b3836.tar.bz2
binaryen-ab3811dafb27edd81f919d0096630014184b3836.zip
[wasm-split] Disallow mixing --profile, --keep-funcs, and --split-funcs (#4187)
Previously the set of functions to keep was initially empty, then the profile added new functions to keep, then the --keep-funcs functions were added, then the --split-funcs functions were removed. This method of composing these different options was arbitrary and not necessarily intuitive, and it prevented reasonable workflows from working. For example, providing only a --split-funcs list would result in all functions being split out not matter which functions were listed. To make the behavior of these options, and --split-funcs in particular, more intuitive, disallow mixing them and when --split-funcs is used, split out only the listed functions.
Diffstat (limited to 'test/lit/wasm-split')
-rw-r--r--test/lit/wasm-split/basic.wast6
-rw-r--r--test/lit/wasm-split/invalid-options.wast18
-rw-r--r--test/lit/wasm-split/verbose.wast2
3 files changed, 25 insertions, 1 deletions
diff --git a/test/lit/wasm-split/basic.wast b/test/lit/wasm-split/basic.wast
index 6d5e6c870..c0f4db8d0 100644
--- a/test/lit/wasm-split/basic.wast
+++ b/test/lit/wasm-split/basic.wast
@@ -41,6 +41,12 @@
;; 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
+;; Also check the inverse workflow using --keep-all and --split-funcs
+;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.split-bar.1.wasm -o2 %t.split-bar.2.wasm --split-funcs=bar -v 2>&1 \
+;; RUN: | filecheck %s --check-prefix KEEP-FOO
+;; RUN: wasm-dis %t.split-bar.1.wasm | filecheck %s --check-prefix KEEP-FOO-PRIMARY
+;; RUN: wasm-dis %t.split-bar.2.wasm | filecheck %s --check-prefix KEEP-FOO-SECONDARY
+
(module
(table $table 1 1 funcref)
(elem (i32.const 0) $foo)
diff --git a/test/lit/wasm-split/invalid-options.wast b/test/lit/wasm-split/invalid-options.wast
index c77691ecc..2f9c0a148 100644
--- a/test/lit/wasm-split/invalid-options.wast
+++ b/test/lit/wasm-split/invalid-options.wast
@@ -53,6 +53,18 @@
;; RUN: not wasm-split %s --merge-profiles -g 2>&1 \
;; RUN: | filecheck %s --check-prefix MERGE-DEBUGINFO
+;; --profile cannot be used with --keep-funcs
+;; RUN: not wasm-split %s --profile=foo --keep-funcs=foo 2>&1 \
+;; RUN: | filecheck %s --check-prefix PROFILE-KEEP
+
+;; --profile cannot be used with --split-funcs
+;; RUN: not wasm-split %s --profile=foo --split-funcs=foo 2>&1 \
+;; RUN: | filecheck %s --check-prefix PROFILE-SPLIT
+
+;; --keep-funcs cannot be used with --split-funcs
+;; RUN: not wasm-split %s --keep-funcs=foo --split-funcs=foo 2>&1 \
+;; RUN: | filecheck %s --check-prefix KEEP-SPLIT
+
;; INSTRUMENT-PROFILE: error: Option --profile cannot be used in instrument mode.
;; INSTRUMENT-OUT1: error: Option --primary-output cannot be used in instrument mode.
@@ -79,4 +91,10 @@
;; MERGE-DEBUGINFO: error: Option --debuginfo cannot be used in merge-profiles mode.
+;; PROFILE-KEEP: error: Cannot use both --profile and --keep-funcs.
+
+;; PROFILE-SPLIT: error: Cannot use both --profile and --split-funcs.
+
+;; KEEP-SPLIT: error: Cannot use both --keep-funcs and --split-funcs.
+
(module)
diff --git a/test/lit/wasm-split/verbose.wast b/test/lit/wasm-split/verbose.wast
index cdedbfae6..0518a03a6 100644
--- a/test/lit/wasm-split/verbose.wast
+++ b/test/lit/wasm-split/verbose.wast
@@ -1,6 +1,6 @@
;; Test that --verbose mode correctly prints the kept and split funcs
-;; RUN: wasm-split %s --keep-funcs=foo,bar --split-funcs=baz --verbose \
+;; RUN: wasm-split %s --keep-funcs=foo,bar --verbose \
;; RUN: -o1 %t1.wasm -o2 %t2.wasm | filecheck %s
;; CHECK: Keeping functions: bar, foo{{$}}