summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/binary/bad-data-count-mismatch.txt23
-rw-r--r--test/binary/bad-data-count-order-after-code.txt11
-rw-r--r--test/binary/bad-data-count-order-before-elem.txt11
-rw-r--r--test/dump/bulk-memory.txt52
-rw-r--r--test/dump/data-count-section.txt36
-rwxr-xr-xtest/gen-wasm.py1
-rw-r--r--test/spec/custom.txt2
7 files changed, 109 insertions, 27 deletions
diff --git a/test/binary/bad-data-count-mismatch.txt b/test/binary/bad-data-count-mismatch.txt
new file mode 100644
index 00000000..90f196d8
--- /dev/null
+++ b/test/binary/bad-data-count-mismatch.txt
@@ -0,0 +1,23 @@
+;;; TOOL: run-gen-wasm-bad
+;;; ARGS1: --enable-bulk-memory
+;;; ARGS2: --enable-bulk-memory
+magic
+version
+section(MEMORY) {
+ count[1]
+ has_max[0]
+ initial[1]
+}
+section(DATACOUNT) {
+ count[2]
+}
+section(DATA) {
+ count[1]
+ memory_index[0]
+ offset[i32.const 0 end]
+ data[str("whoops")]
+}
+(;; STDERR ;;;
+0000013: error: data segment count does not equal count in DataCount section
+0000013: error: data segment count does not equal count in DataCount section
+;;; STDERR ;;)
diff --git a/test/binary/bad-data-count-order-after-code.txt b/test/binary/bad-data-count-order-after-code.txt
new file mode 100644
index 00000000..6af64f24
--- /dev/null
+++ b/test/binary/bad-data-count-order-after-code.txt
@@ -0,0 +1,11 @@
+;;; TOOL: run-gen-wasm-bad
+;;; ARGS1: --enable-bulk-memory
+;;; ARGS2: --enable-bulk-memory
+magic
+version
+section(CODE) { count[0] }
+section(DATACOUNT) { count[0] }
+(;; STDERR ;;;
+000000d: error: section DataCount out of order
+000000d: error: section DataCount out of order
+;;; STDERR ;;)
diff --git a/test/binary/bad-data-count-order-before-elem.txt b/test/binary/bad-data-count-order-before-elem.txt
new file mode 100644
index 00000000..226b2c71
--- /dev/null
+++ b/test/binary/bad-data-count-order-before-elem.txt
@@ -0,0 +1,11 @@
+;;; TOOL: run-gen-wasm-bad
+;;; ARGS1: --enable-bulk-memory
+;;; ARGS2: --enable-bulk-memory
+magic
+version
+section(DATACOUNT) { count[0] }
+section(ELEM) { count[0] }
+(;; STDERR ;;;
+000000d: error: section Elem out of order
+000000d: error: section Elem out of order
+;;; STDERR ;;)
diff --git a/test/dump/bulk-memory.txt b/test/dump/bulk-memory.txt
index be06dba5..a3cdae98 100644
--- a/test/dump/bulk-memory.txt
+++ b/test/dump/bulk-memory.txt
@@ -25,30 +25,30 @@ bulk-memory.wasm: file format wasm 0x1
Code Disassembly:
-000028 func[0]:
- 000029: 41 00 | i32.const 0
- 00002b: 41 00 | i32.const 0
- 00002d: 41 00 | i32.const 0
- 00002f: fc 08 00 00 | memory.init 0 0
- 000033: fc 09 00 | memory.drop 0
- 000036: 41 00 | i32.const 0
- 000038: 41 00 | i32.const 0
- 00003a: 41 00 | i32.const 0
- 00003c: fc 0a 00 | memory.copy 0
- 00003f: 41 00 | i32.const 0
- 000041: 41 00 | i32.const 0
- 000043: 41 00 | i32.const 0
- 000045: fc 0b 00 | memory.fill 0
- 000048: 0b | end
-00004a func[1]:
- 00004b: 41 00 | i32.const 0
- 00004d: 41 00 | i32.const 0
- 00004f: 41 00 | i32.const 0
- 000051: fc 0c 00 00 | table.init 0 0
- 000055: fc 0d 00 | table.drop 0
- 000058: 41 00 | i32.const 0
- 00005a: 41 00 | i32.const 0
- 00005c: 41 00 | i32.const 0
- 00005e: fc 0e 00 | table.copy 0
- 000061: 0b | end
+00002b func[0]:
+ 00002c: 41 00 | i32.const 0
+ 00002e: 41 00 | i32.const 0
+ 000030: 41 00 | i32.const 0
+ 000032: fc 08 00 00 | memory.init 0 0
+ 000036: fc 09 00 | memory.drop 0
+ 000039: 41 00 | i32.const 0
+ 00003b: 41 00 | i32.const 0
+ 00003d: 41 00 | i32.const 0
+ 00003f: fc 0a 00 | memory.copy 0
+ 000042: 41 00 | i32.const 0
+ 000044: 41 00 | i32.const 0
+ 000046: 41 00 | i32.const 0
+ 000048: fc 0b 00 | memory.fill 0
+ 00004b: 0b | end
+00004d func[1]:
+ 00004e: 41 00 | i32.const 0
+ 000050: 41 00 | i32.const 0
+ 000052: 41 00 | i32.const 0
+ 000054: fc 0c 00 00 | table.init 0 0
+ 000058: fc 0d 00 | table.drop 0
+ 00005b: 41 00 | i32.const 0
+ 00005d: 41 00 | i32.const 0
+ 00005f: 41 00 | i32.const 0
+ 000061: fc 0e 00 | table.copy 0
+ 000064: 0b | end
;;; STDOUT ;;)
diff --git a/test/dump/data-count-section.txt b/test/dump/data-count-section.txt
new file mode 100644
index 00000000..0c995d58
--- /dev/null
+++ b/test/dump/data-count-section.txt
@@ -0,0 +1,36 @@
+;;; TOOL: run-objdump
+;;; ARGS0: --enable-bulk-memory
+;;; ARGS1: -hx
+(module
+ (memory 1)
+ (data (i32.const 0) "hi")
+ (data (i32.const 2) "world")
+ (data (i32.const 7) "goodbye")
+)
+(;; STDOUT ;;;
+
+data-count-section.wasm: file format wasm 0x1
+
+Sections:
+
+ Memory start=0x0000000a end=0x0000000d (size=0x00000003) count: 1
+DataCount start=0x0000000f end=0x00000010 (size=0x00000001) count: 3
+ Data start=0x00000012 end=0x00000030 (size=0x0000001e) count: 3
+
+Section Details:
+
+Memory[1]:
+ - memory[0] pages: initial=1
+DataCount:
+ - data count: 3
+Data[3]:
+ - segment[0] size=2 - init i32=0
+ - 0000000: 6869 hi
+ - segment[1] size=5 - init i32=2
+ - 0000002: 776f 726c 64 world
+ - segment[2] size=7 - init i32=7
+ - 0000007: 676f 6f64 6279 65 goodbye
+
+Code Disassembly:
+
+;;; STDOUT ;;)
diff --git a/test/gen-wasm.py b/test/gen-wasm.py
index 0e076c46..5e5467ea 100755
--- a/test/gen-wasm.py
+++ b/test/gen-wasm.py
@@ -62,6 +62,7 @@ NAMED_VALUES = {
'ELEM': 9,
'CODE': 10,
'DATA': 11,
+ 'DATACOUNT': 12,
# name subsection codes
'NAME_MODULE': 0,
diff --git a/test/spec/custom.txt b/test/spec/custom.txt
index 2e962408..9d74b871 100644
--- a/test/spec/custom.txt
+++ b/test/spec/custom.txt
@@ -10,7 +10,7 @@ out/test/spec/custom.wast:77: assert_malformed passed:
out/test/spec/custom.wast:85: assert_malformed passed:
000000a: error: invalid section size: extends past end
out/test/spec/custom.wast:93: assert_malformed passed:
- 0000031: error: invalid section code: 36; max is 11
+ 0000031: error: invalid section code: 36
out/test/spec/custom.wast:102: assert_malformed passed:
000003e: error: function signature count != function body count
out/test/spec/custom.wast:115: assert_malformed passed: