summaryrefslogtreecommitdiff
path: root/test/lit
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit')
-rw-r--r--test/lit/passes/post-emscripten.wast28
-rw-r--r--test/lit/wasm-emscripten-finalize/em_asm.wat7
-rw-r--r--test/lit/wasm-emscripten-finalize/em_asm_partial.wat24
-rw-r--r--test/lit/wasm-emscripten-finalize/em_js.wat10
4 files changed, 28 insertions, 41 deletions
diff --git a/test/lit/passes/post-emscripten.wast b/test/lit/passes/post-emscripten.wast
new file mode 100644
index 000000000..259a16729
--- /dev/null
+++ b/test/lit/passes/post-emscripten.wast
@@ -0,0 +1,28 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+;; RUN: wasm-opt %s --post-emscripten -S -o - | filecheck %s
+
+;; Checks that the start/stop exports are removed and that the data they
+;; refer to is either zero'd out, or the segment emptied.
+
+(module
+ ;; CHECK: (global $g1 i32 (i32.const 1000))
+ (global $g1 i32 (i32.const 1000))
+ ;; CHECK: (global $g2 i32 (i32.const 1011))
+ (global $g2 i32 (i32.const 1011))
+ ;; CHECK: (global $g3 i32 (i32.const 2006))
+ (global $g3 i32 (i32.const 2006))
+ ;; CHECK: (global $g4 i32 (i32.const 2015))
+ (global $g4 i32 (i32.const 2015))
+ (memory 10 10)
+ ;; CHECK: (memory $0 10 10)
+
+ ;; CHECK: (data $data1 (i32.const 1000) "")
+ (data $data1 (i32.const 1000) "hello world")
+ ;; CHECK: (data $data2 (i32.const 2000) "hello \00\00\00\00\00\00\00\00\00 world")
+ (data $data2 (i32.const 2000) "hello DELETE ME world")
+ (export "__start_em_asm" (global $g1))
+ (export "__stop_em_asm" (global $g2))
+ (export "__start_em_js" (global $g3))
+ (export "__stop_em_js" (global $g4))
+)
+
diff --git a/test/lit/wasm-emscripten-finalize/em_asm.wat b/test/lit/wasm-emscripten-finalize/em_asm.wat
index 43dbfb9ae..195c4b9af 100644
--- a/test/lit/wasm-emscripten-finalize/em_asm.wat
+++ b/test/lit/wasm-emscripten-finalize/em_asm.wat
@@ -6,18 +6,11 @@
;; Check that the data segment that contains only EM_ASM strings resized to
;; zero, and that the string are extracted into the metadata.
-;; CHECK: (data (i32.const 100) "normal data")
-;; CHECK-NEXT: (data (i32.const 512) "")
-;; CHECK-NEXT: (data (i32.const 1024) "more data")
-
;; CHECK: "asmConsts": {
;; CHECK-NEXT: "512": "{ console.log('JS hello'); }",
;; CHECK-NEXT: "541": "{ console.log('hello again'); }"
;; CHECK-NEXT: },
-;; Check that the exports are removed
-;; CHECK-NOT: export
-
(module
(memory 1 1)
(global (export "__start_em_asm") i32 (i32.const 512))
diff --git a/test/lit/wasm-emscripten-finalize/em_asm_partial.wat b/test/lit/wasm-emscripten-finalize/em_asm_partial.wat
deleted file mode 100644
index 6432f1689..000000000
--- a/test/lit/wasm-emscripten-finalize/em_asm_partial.wat
+++ /dev/null
@@ -1,24 +0,0 @@
-;; Test that em_asm string are extraced correctly when the __start_em_asm
-;; and __stop_em_asm globals are exported.
-
-;; RUN: wasm-emscripten-finalize %s -S | filecheck %s
-
-;; Check for the case when __start_em_asm and __stop_em_asm don't define an
-;; entire segment. In this case we preserve the segment but zero the data.
-
-;; CHECK: (data (i32.const 512) "xx\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00yy")
-
-;; CHECK: "asmConsts": {
-;; CHECK-NEXT: "514": "{ console.log('JS hello'); }",
-;; CHECK-NEXT: "543": "{ console.log('hello again'); }"
-;; CHECK-NEXT: },
-
-;; Check that the exports are removed
-;; CHECK-NOT: export
-
-(module
- (memory 1 1)
- (global (export "__start_em_asm") i32 (i32.const 514))
- (global (export "__stop_em_asm") i32 (i32.const 575))
- (data (i32.const 512) "xx{ console.log('JS hello'); }\00{ console.log('hello again'); }\00yy")
-)
diff --git a/test/lit/wasm-emscripten-finalize/em_js.wat b/test/lit/wasm-emscripten-finalize/em_js.wat
index 02fc32bfc..b10774ed3 100644
--- a/test/lit/wasm-emscripten-finalize/em_js.wat
+++ b/test/lit/wasm-emscripten-finalize/em_js.wat
@@ -3,16 +3,6 @@
;; RUN: wasm-emscripten-finalize %s -S | filecheck %s
-;; All functions should be stripped from the binary, regardless
-;; of internal name
-;; CHECK-NOT: (global
-
-;; The data section that contains only em_js strings should
-;; be stripped (shrunk to zero size):
-;; CHECK: (data (i32.const 1024) "some JS string data\00xxx")
-;; CHECK: (data (i32.const 512) "")
-;; CHECK: (data (i32.const 2048) "more JS string data\00yyy")
-
;; CHECK: "emJsFuncs": {
;; CHECK-NEXT: "bar": "more JS string data",
;; CHECK-NEXT: "baz": "Only em_js strings here",