diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/help/wasm-merge.test | 12 | ||||
-rw-r--r-- | test/lit/help/wasm-metadce.test | 7 | ||||
-rw-r--r-- | test/lit/merge/sourcemap.wat | 57 | ||||
-rw-r--r-- | test/lit/merge/sourcemap.wat.second | 8 | ||||
-rw-r--r-- | test/lit/metadce/sourcemap.wat | 26 | ||||
-rw-r--r-- | test/lit/metadce/sourcemap.wat.json | 13 |
6 files changed, 123 insertions, 0 deletions
diff --git a/test/lit/help/wasm-merge.test b/test/lit/help/wasm-merge.test index 50719f988..7d55074c3 100644 --- a/test/lit/help/wasm-merge.test +++ b/test/lit/help/wasm-merge.test @@ -14,6 +14,11 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: Note that filenames and modules names are interleaved (which is hopefully less ;; CHECK-NEXT: confusing). +;; CHECK-NEXT: +;; CHECK-NEXT: Input source maps can be specified by adding an -ism option right after the +;; CHECK-NEXT: module name: +;; CHECK-NEXT: +;; CHECK-NEXT: wasm-merge foo.wasm foo -ism foo.wasm.map ... ;; CHECK-NEXT: ================================================================================ ;; CHECK-NEXT: ;; CHECK-NEXT: @@ -22,6 +27,13 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --output,-o Output file (stdout if not specified) ;; CHECK-NEXT: +;; CHECK-NEXT: --input-source-map,-ism Consume source maps from the specified +;; CHECK-NEXT: file +;; CHECK-NEXT: +;; CHECK-NEXT: --output-source-map,-osm Emit source map to the specified file +;; CHECK-NEXT: +;; CHECK-NEXT: --output-source-map-url,-osu Emit specified string as source map URL +;; CHECK-NEXT: ;; CHECK-NEXT: --rename-export-conflicts,-rec Rename exports to avoid conflicts (rather ;; CHECK-NEXT: than error) ;; CHECK-NEXT: diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test index 4334dbd01..4d706dc0f 100644 --- a/test/lit/help/wasm-metadce.test +++ b/test/lit/help/wasm-metadce.test @@ -53,6 +53,13 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --output,-o Output file (stdout if not specified) ;; CHECK-NEXT: +;; CHECK-NEXT: --input-source-map,-ism Consume source map from the specified +;; CHECK-NEXT: file +;; CHECK-NEXT: +;; CHECK-NEXT: --output-source-map,-osm Emit source map to the specified file +;; CHECK-NEXT: +;; CHECK-NEXT: --output-source-map-url,-osu Emit specified string as source map URL +;; CHECK-NEXT: ;; CHECK-NEXT: --emit-text,-S Emit text instead of binary for the ;; CHECK-NEXT: output file ;; CHECK-NEXT: 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 + ) +) diff --git a/test/lit/metadce/sourcemap.wat b/test/lit/metadce/sourcemap.wat new file mode 100644 index 000000000..bf695fd21 --- /dev/null +++ b/test/lit/metadce/sourcemap.wat @@ -0,0 +1,26 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-metadce %s --graph-file %s.json -S -o - | filecheck %s +;; RUN: wasm-as %s -o %t.wasm --source-map %t.map +;; RUN: wasm-metadce %t.wasm --input-source-map %t.map --graph-file %s.json -o %t.out.wasm --output-source-map %t.out.map +;; RUN: wasm-dis %t.out.wasm --source-map %t.out.map -o - | filecheck %s + +;; Test that sourcemap information is preserved + +(module + ;;@ a:1:1 + (func (export "f") + ;;@ a:2:1 + (nop) + ;;@ a:3:1 + ) +) +;; CHECK: (type $0 (func)) + +;; CHECK: (export "f" (func $0)) + +;; CHECK: ;;@ a:1:1 +;; CHECK-NEXT: (func $0 +;; CHECK-NEXT: ;;@ a:2:1 +;; CHECK-NEXT: (nop) +;; CHECK-NEXT: ;;@ a:3:1 +;; CHECK-NEXT: ) diff --git a/test/lit/metadce/sourcemap.wat.json b/test/lit/metadce/sourcemap.wat.json new file mode 100644 index 000000000..4b2028140 --- /dev/null +++ b/test/lit/metadce/sourcemap.wat.json @@ -0,0 +1,13 @@ +[ + { + "name": "root", + "reaches": [ + "f" + ], + "root": true + }, + { + "name": "f", + "export": "f" + } +] |