summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split/merge-profiles.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/wasm-split/merge-profiles.wast')
-rw-r--r--test/lit/wasm-split/merge-profiles.wast42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/lit/wasm-split/merge-profiles.wast b/test/lit/wasm-split/merge-profiles.wast
new file mode 100644
index 000000000..fdaf6678e
--- /dev/null
+++ b/test/lit/wasm-split/merge-profiles.wast
@@ -0,0 +1,42 @@
+;; Instrument the module
+;; RUN: wasm-split --instrument %s -o %t.instrumented.wasm -g
+
+;; Generate profiles
+;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.foo.prof foo
+;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.foo.bar.prof foo bar
+;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.bar.baz.prof bar baz
+
+;; Merge profiles
+;; RUN: wasm-split --merge-profiles -v %t.foo.prof %t.foo.bar.prof %t.bar.baz.prof -o %t.merged.prof 2>&1 \
+;; RUN: | filecheck %s --check-prefix MERGE
+
+;; Split the module
+;; RUN: wasm-split %s --profile %t.merged.prof -o1 %t.1.wasm -o2 %t.2.wasm -g -v \
+;; RUN: | filecheck %s --check-prefix SPLIT
+
+;; MERGE: Profile {{.*}}foo.prof only includes functions included in other profiles.
+;; MERGE: Profile {{.*}}foo.bar.prof only includes functions included in other profiles.
+;; MERGE-NOT: Profile {{.*}}bar.baz.prof only includes functions included in other profiles.
+
+;; SPLIT: Keeping functions: bar, baz, foo{{$}}
+;; SPLIT-NEXT: Splitting out functions: qux{{$}}
+
+(module
+ (export "memory" (memory 0 0))
+ (export "foo" (func $foo))
+ (export "bar" (func $bar))
+ (export "baz" (func $baz))
+ (export "qux" (func $qux))
+ (func $foo
+ (nop)
+ )
+ (func $bar
+ (nop)
+ )
+ (func $baz
+ (nop)
+ )
+ (func $qux
+ (nop)
+ )
+)