Skip to content

Commit

Permalink
Merge pull request #35 from yamt/test2
Browse files Browse the repository at this point in the history
separate memory64 tests for the convenience of runtimes w/o memory64
  • Loading branch information
fitzgen authored Jan 22, 2025
2 parents a18ff9b + 7b0b911 commit f722768
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
25 changes: 0 additions & 25 deletions test/core/custom-page-sizes/memory_max.wast
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,13 @@
(memory 0xFFFF_FFFF (pagesize 1)))
"unknown import")

;; i64 (pagesize 1)
(assert_unlinkable
(module
(import "test" "import" (func))
(memory i64 0xFFFF_FFFF_FFFF_FFFF (pagesize 1)))
"unknown import")

;; i32 (default pagesize)
(assert_unlinkable
(module
(import "test" "unknown" (func))
(memory 65536 (pagesize 65536)))
"unknown import")

;; i64 (default pagesize)
(assert_unlinkable
(module
(import "test" "unknown" (func))
(memory i64 0x1_0000_0000_0000 (pagesize 65536)))
"unknown import")

;; Memory size just over the maximum.
;;
;; These are malformed (for pagesize 1)
Expand All @@ -46,19 +32,8 @@
(module quote "(memory 0x1_0000_0000 (pagesize 1))")
"constant out of range")

;; i64 (pagesize 1)
(assert_malformed
(module quote "(memory i64 0x1_0000_0000_0000_0000 (pagesize 1))")
"constant out of range")

;; i32 (default pagesize)
(assert_invalid
(module
(memory 65537 (pagesize 65536)))
"memory size must be at most")

;; i64 (default pagesize)
(assert_invalid
(module
(memory i64 0x1_0000_0000_0001 (pagesize 65536)))
"memory size must be at most")
39 changes: 39 additions & 0 deletions test/core/custom-page-sizes/memory_max_i64.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;; Maximum memory sizes.
;;
;; These modules are valid, but instantiating them is unnecessary
;; and would only allocate very large memories and slow down running
;; the spec tests. Therefore, add a missing import so that it cannot
;; be instantiated and use `assert_unlinkable`. This approach
;; enforces that the module itself is still valid, but that its
;; instantiation fails early (hopefully before any memories are
;; actually allocated).

;; i64 (pagesize 1)
(assert_unlinkable
(module
(import "test" "import" (func))
(memory i64 0xFFFF_FFFF_FFFF_FFFF (pagesize 1)))
"unknown import")

;; i64 (default pagesize)
(assert_unlinkable
(module
(import "test" "unknown" (func))
(memory i64 0x1_0000_0000_0000 (pagesize 65536)))
"unknown import")

;; Memory size just over the maximum.
;;
;; These are malformed (for pagesize 1)
;; or invalid (for other pagesizes).

;; i64 (pagesize 1)
(assert_malformed
(module quote "(memory i64 0x1_0000_0000_0000_0000 (pagesize 1))")
"constant out of range")

;; i64 (default pagesize)
(assert_invalid
(module
(memory i64 0x1_0000_0000_0001 (pagesize 65536)))
"memory size must be at most")

0 comments on commit f722768

Please sign in to comment.