summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/example/module-splitting.cpp4
-rw-r--r--test/lit/wasm-split/help.test2
-rw-r--r--test/lit/wasm-split/placeholdermap.wast24
3 files changed, 28 insertions, 2 deletions
diff --git a/test/example/module-splitting.cpp b/test/example/module-splitting.cpp
index 2aa67d6d5..9ff2818be 100644
--- a/test/example/module-splitting.cpp
+++ b/test/example/module-splitting.cpp
@@ -50,7 +50,7 @@ void do_test(const std::set<Name>& keptFuncs, std::string&& module) {
ModuleSplitting::Config config;
config.primaryFuncs = keptFuncs;
config.newExportPrefix = "%";
- auto secondary = splitFunctions(*primary, config);
+ auto secondary = splitFunctions(*primary, config).secondary;
std::cout << "After:\n";
std::cout << *primary.get();
@@ -476,7 +476,7 @@ void test_minimized_exports() {
config.newExportPrefix = "%";
config.minimizeNewExportNames = true;
- auto secondary = splitFunctions(primary, config);
+ auto secondary = splitFunctions(primary, config).secondary;
std::cout << "Minimized names primary:\n";
std::cout << primary << "\n";
std::cout << "Minimized names secondary:\n";
diff --git a/test/lit/wasm-split/help.test b/test/lit/wasm-split/help.test
index de789a362..8159e66db 100644
--- a/test/lit/wasm-split/help.test
+++ b/test/lit/wasm-split/help.test
@@ -34,6 +34,8 @@ CHECK-NEXT: --secondary-output,-o2 [split] Output file for the s
CHECK-NEXT: module.
CHECK-NEXT: --symbolmap [split] Write a symbol map file for each
CHECK-NEXT: of the output modules.
+CHECK-NEXT: --placeholdermap [split] Write a file mapping placeholder
+CHECK-NEXT: indices to the function names.
CHECK-NEXT: --import-namespace [split] The namespace from which to
CHECK-NEXT: import objects from the primary module
CHECK-NEXT: into the secondary module.
diff --git a/test/lit/wasm-split/placeholdermap.wast b/test/lit/wasm-split/placeholdermap.wast
new file mode 100644
index 000000000..dd8598b0b
--- /dev/null
+++ b/test/lit/wasm-split/placeholdermap.wast
@@ -0,0 +1,24 @@
+;; RUN: wasm-split %s --keep-funcs=bar -o1 %t.1.wasm -o2 %t.2.wasm --placeholdermap
+;; RUN: filecheck %s --check-prefix MAP < %t.1.wasm.placeholders
+;; RUN: wasm-dis %t.1.wasm | filecheck %s --check-prefix PRIMARY
+
+;; MAP: 0:foo
+;; MAP-NEXT: 2:baz
+;; MAP-NOT: bar
+
+;; Check that the names have been stripped.
+;; PRIMARY: (func $0
+
+(module
+ (table $table 3 3 funcref)
+ (elem $table (i32.const 0) $foo $bar $baz)
+ (func $foo
+ (nop)
+ )
+ (func $bar
+ (nop)
+ )
+ (func $baz
+ (nop)
+ )
+)