summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/help/wasm-opt.test3
-rw-r--r--test/lit/help/wasm2js.test3
-rw-r--r--test/lit/passes/separate-data-segments.wast22
3 files changed, 28 insertions, 0 deletions
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index 4607a94b9..95d25cc61 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -395,6 +395,9 @@
;; CHECK-NEXT: --safe-heap instrument loads and stores to
;; CHECK-NEXT: check for invalid behavior
;; CHECK-NEXT:
+;; CHECK-NEXT: --separate-data-segments write data segments to a file
+;; CHECK-NEXT: and strip them from the module
+;; CHECK-NEXT:
;; CHECK-NEXT: --set-globals sets specified globals to
;; CHECK-NEXT: specified values
;; CHECK-NEXT:
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index 0b041ddd3..d3df47eb6 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -354,6 +354,9 @@
;; CHECK-NEXT: --safe-heap instrument loads and stores to
;; CHECK-NEXT: check for invalid behavior
;; CHECK-NEXT:
+;; CHECK-NEXT: --separate-data-segments write data segments to a file
+;; CHECK-NEXT: and strip them from the module
+;; CHECK-NEXT:
;; CHECK-NEXT: --set-globals sets specified globals to
;; CHECK-NEXT: specified values
;; CHECK-NEXT:
diff --git a/test/lit/passes/separate-data-segments.wast b/test/lit/passes/separate-data-segments.wast
new file mode 100644
index 000000000..ad921df79
--- /dev/null
+++ b/test/lit/passes/separate-data-segments.wast
@@ -0,0 +1,22 @@
+;; RUN: wasm-opt %s --separate-data-segments=%t.data --pass-arg=separate-data-segments-global-base@1024 -S -o - | filecheck %s
+;; RUN: cat %t.data | filecheck %s --check-prefix=CHECK-DATA
+
+(module
+ ;; CHECK: (memory $0 1 1)
+ (memory 1 1)
+
+ ;; CHECK-NOT (data
+ (data (i32.const 1024) "hello world\n")
+
+ ;; CHECK: (func $foo
+ (func $foo
+ (call $bar)
+ )
+
+ ;; CHECK: (func $bar
+ (func $bar
+ (call $foo)
+ )
+)
+
+;; CHECK-DATA: {{^}}hello world{{$}}