summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/wasm-split')
-rw-r--r--test/lit/wasm-split/instrument-funcs.wast2
-rw-r--r--test/lit/wasm-split/mismatched-hashes.wast23
2 files changed, 24 insertions, 1 deletions
diff --git a/test/lit/wasm-split/instrument-funcs.wast b/test/lit/wasm-split/instrument-funcs.wast
index bdd222d82..4b729aed2 100644
--- a/test/lit/wasm-split/instrument-funcs.wast
+++ b/test/lit/wasm-split/instrument-funcs.wast
@@ -59,7 +59,7 @@
;; CHECK-NEXT: (block
;; CHECK-NEXT: (i64.store align=1
;; CHECK-NEXT: (local.get $addr)
-;; CHECK-NEXT: (i64.const 0)
+;; CHECK-NEXT: (i64.const {{.*}})
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.store offset=8 align=1
;; CHECK-NEXT: (local.get $addr)
diff --git a/test/lit/wasm-split/mismatched-hashes.wast b/test/lit/wasm-split/mismatched-hashes.wast
new file mode 100644
index 000000000..561135bbe
--- /dev/null
+++ b/test/lit/wasm-split/mismatched-hashes.wast
@@ -0,0 +1,23 @@
+;; Check that using different inputs for the instrumentation and splitting steps
+;; results in an error.
+
+;; Instrument the module
+;; RUN: wasm-split --instrument %s -o %t.instrumented.wasm
+
+;; Generate a profile
+;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.prof
+
+;; Attempt to split the instrumented module
+;; RUN: not wasm-split %t.instrumented.wasm --profile=%t.prof -o1 %t.1.wasm -o2 %t.2.wasm \
+;; RUN: 2>&1 | filecheck %s
+
+;; CHECK: error: checksum in profile does not match module checksum.
+;; CHECK-SAME: The split module must be the original module that was instrumented
+;; CHECK-SAME: to generate the profile.
+
+;; Check that the matcing module succeeds
+;; RUN: wasm-split %s --profile=%t.prof -o1 %t.1.wasm -o2 %t.2.wasm
+
+(module
+ (export "memory" (memory 0 0))
+)