Skip to content

Commit e8ce6ec

Browse files
committed
Move "memory max" tests to new file
1 parent b198b97 commit e8ce6ec

File tree

2 files changed

+64
-65
lines changed

2 files changed

+64
-65
lines changed

test/core/custom-page-sizes/custom-page-sizes-invalid.wast

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -113,68 +113,3 @@
113113
)
114114
"memory types incompatible"
115115
)
116-
117-
;; Maximum memory sizes.
118-
;;
119-
;; These modules are valid, but instantiating them is unnecessary
120-
;; and would only allocate very large memories and slow down running
121-
;; the spec tests. Therefore, add a missing import so that it cannot
122-
;; be instantiated and use `assert_unlinkable`. This approach
123-
;; enforces that the module itself is still valid, but that its
124-
;; instantiation fails early (hopefully before any memories are
125-
;; actually allocated).
126-
127-
;; i32 (pagesize 1)
128-
(assert_unlinkable
129-
(module
130-
(import "test" "unknown" (func))
131-
(memory 0xFFFF_FFFF (pagesize 1)))
132-
"unknown import")
133-
134-
;; i64 (pagesize 1)
135-
(assert_unlinkable
136-
(module
137-
(import "test" "import" (func))
138-
(memory i64 0xFFFF_FFFF_FFFF_FFFF (pagesize 1)))
139-
"unknown import")
140-
141-
;; i32 (default pagesize)
142-
(assert_unlinkable
143-
(module
144-
(import "test" "unknown" (func))
145-
(memory 65536 (pagesize 65536)))
146-
"unknown import")
147-
148-
;; i64 (default pagesize)
149-
(assert_unlinkable
150-
(module
151-
(import "test" "unknown" (func))
152-
(memory i64 0x1_0000_0000_0000 (pagesize 65536)))
153-
"unknown import")
154-
155-
;; Memory size just over the maximum.
156-
;;
157-
;; These are malformed (for pagesize 1)
158-
;; or invalid (for other pagesizes).
159-
160-
;; i32 (pagesize 1)
161-
(assert_malformed
162-
(module quote "(memory 0x1_0000_0000 (pagesize 1))")
163-
"constant out of range")
164-
165-
;; i64 (pagesize 1)
166-
(assert_malformed
167-
(module quote "(memory i64 0x1_0000_0000_0000_0000 (pagesize 1))")
168-
"constant out of range")
169-
170-
;; i32 (default pagesize)
171-
(assert_invalid
172-
(module
173-
(memory 65537 (pagesize 65536)))
174-
"memory size must be at most")
175-
176-
;; i64 (default pagesize)
177-
(assert_invalid
178-
(module
179-
(memory i64 0x1_0000_0000_0001 (pagesize 65536)))
180-
"memory size must be at most")
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
;; Maximum memory sizes.
2+
;;
3+
;; These modules are valid, but instantiating them is unnecessary
4+
;; and would only allocate very large memories and slow down running
5+
;; the spec tests. Therefore, add a missing import so that it cannot
6+
;; be instantiated and use `assert_unlinkable`. This approach
7+
;; enforces that the module itself is still valid, but that its
8+
;; instantiation fails early (hopefully before any memories are
9+
;; actually allocated).
10+
11+
;; i32 (pagesize 1)
12+
(assert_unlinkable
13+
(module
14+
(import "test" "unknown" (func))
15+
(memory 0xFFFF_FFFF (pagesize 1)))
16+
"unknown import")
17+
18+
;; i64 (pagesize 1)
19+
(assert_unlinkable
20+
(module
21+
(import "test" "import" (func))
22+
(memory i64 0xFFFF_FFFF_FFFF_FFFF (pagesize 1)))
23+
"unknown import")
24+
25+
;; i32 (default pagesize)
26+
(assert_unlinkable
27+
(module
28+
(import "test" "unknown" (func))
29+
(memory 65536 (pagesize 65536)))
30+
"unknown import")
31+
32+
;; i64 (default pagesize)
33+
(assert_unlinkable
34+
(module
35+
(import "test" "unknown" (func))
36+
(memory i64 0x1_0000_0000_0000 (pagesize 65536)))
37+
"unknown import")
38+
39+
;; Memory size just over the maximum.
40+
;;
41+
;; These are malformed (for pagesize 1)
42+
;; or invalid (for other pagesizes).
43+
44+
;; i32 (pagesize 1)
45+
(assert_malformed
46+
(module quote "(memory 0x1_0000_0000 (pagesize 1))")
47+
"constant out of range")
48+
49+
;; i64 (pagesize 1)
50+
(assert_malformed
51+
(module quote "(memory i64 0x1_0000_0000_0000_0000 (pagesize 1))")
52+
"constant out of range")
53+
54+
;; i32 (default pagesize)
55+
(assert_invalid
56+
(module
57+
(memory 65537 (pagesize 65536)))
58+
"memory size must be at most")
59+
60+
;; i64 (default pagesize)
61+
(assert_invalid
62+
(module
63+
(memory i64 0x1_0000_0000_0001 (pagesize 65536)))
64+
"memory size must be at most")

0 commit comments

Comments
 (0)