summaryrefslogtreecommitdiff
path: root/test/lit/merge
diff options
context:
space:
mode:
authorJérôme Vouillon <jerome.vouillon@gmail.com>2024-03-06 13:20:38 -0500
committerGitHub <noreply@github.com>2024-03-06 10:20:38 -0800
commitf44912bf234d5e19a1adb34c770335f4b3190e2a (patch)
tree449996245f77e0996b76f0356fcf2d176e5a7af3 /test/lit/merge
parent71bf4b3fa2716d5c54e04f7e76c2463b1adddeae (diff)
downloadbinaryen-f44912bf234d5e19a1adb34c770335f4b3190e2a.tar.gz
binaryen-f44912bf234d5e19a1adb34c770335f4b3190e2a.tar.bz2
binaryen-f44912bf234d5e19a1adb34c770335f4b3190e2a.zip
Add sourcemap support to wasm-metadce and wasm-merge (#6372)
Diffstat (limited to 'test/lit/merge')
-rw-r--r--test/lit/merge/sourcemap.wat57
-rw-r--r--test/lit/merge/sourcemap.wat.second8
2 files changed, 65 insertions, 0 deletions
diff --git a/test/lit/merge/sourcemap.wat b/test/lit/merge/sourcemap.wat
new file mode 100644
index 000000000..7457d4307
--- /dev/null
+++ b/test/lit/merge/sourcemap.wat
@@ -0,0 +1,57 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: wasm-merge %s first %s.second second -S -o - | filecheck %s --check-prefix=CHECK-TEXT
+;; RUN: wasm-as %s -o %t.wasm --source-map %t.map
+;; RUN: wasm-as %s.second -o %t.second.wasm --source-map %t.second.map
+;; RUN: wasm-merge %t.wasm first --input-source-map %t.map %t.second.wasm second --input-source-map %t.second.map -o %t.merged.wasm --output-source-map %t.merged.map
+;; RUN: wasm-dis %t.merged.wasm --source-map %t.merged.map -o - | filecheck %s --check-prefix=CHECK-BIN
+
+;; Test that sourcemap information is preserved
+
+(module
+ ;;@ a:1:1
+ (func (export "f")
+ ;;@ a:2:1
+ (nop)
+ ;;@ a:3:1
+ )
+)
+;; CHECK-TEXT: (type $0 (func))
+
+;; CHECK-TEXT: (export "f" (func $0))
+
+;; CHECK-TEXT: (export "g" (func $0_1))
+
+;; CHECK-TEXT: ;;@ a:1:1
+;; CHECK-TEXT-NEXT: (func $0
+;; CHECK-TEXT-NEXT: ;;@ a:2:1
+;; CHECK-TEXT-NEXT: (nop)
+;; CHECK-TEXT-NEXT: ;;@ a:3:1
+;; CHECK-TEXT-NEXT: )
+
+;; CHECK-TEXT: ;;@ b:1:2
+;; CHECK-TEXT-NEXT: (func $0_1
+;; CHECK-TEXT-NEXT: ;;@ b:2:2
+;; CHECK-TEXT-NEXT: (nop)
+;; CHECK-TEXT-NEXT: ;;@ b:3:2
+;; CHECK-TEXT-NEXT: )
+
+;; CHECK-BIN: (type $0 (func))
+
+;; CHECK-BIN: (export "f" (func $0))
+
+;; CHECK-BIN: (export "g" (func $1))
+
+;; CHECK-BIN: ;;@ a:1:1
+;; CHECK-BIN-NEXT: (func $0
+;; CHECK-BIN-NEXT: ;;@ a:2:1
+;; CHECK-BIN-NEXT: (nop)
+;; CHECK-BIN-NEXT: ;;@ a:3:1
+;; CHECK-BIN-NEXT: )
+
+;; CHECK-BIN: ;;@ b:1:2
+;; CHECK-BIN-NEXT: (func $1
+;; CHECK-BIN-NEXT: ;;@ b:2:2
+;; CHECK-BIN-NEXT: (nop)
+;; CHECK-BIN-NEXT: ;;@ b:3:2
+;; CHECK-BIN-NEXT: )
diff --git a/test/lit/merge/sourcemap.wat.second b/test/lit/merge/sourcemap.wat.second
new file mode 100644
index 000000000..0ea7c75fa
--- /dev/null
+++ b/test/lit/merge/sourcemap.wat.second
@@ -0,0 +1,8 @@
+(module
+ ;;@ b:1:2
+ (func (export "g")
+ ;;@ b:2:2
+ (nop)
+ ;;@ b:3:2
+ )
+)