Skip to content

Add more tests, delete some redundant tests, and reorganize some existing tests. #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions ml-proto/TestingTodo.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,8 @@ specified in
have a link to an open issue/PR, or be obvious. Comments/corrections/additions
welcome.

Misc semantics:
- ~~test that linear memory is little-endian for all integers and floats~~
- test that unaligned and misaligned accesses work, even if slow
- ~~test that runaway recursion traps~~
- test that too-big `grow_memory` fails appropriately
- test that too-big linear memory initial allocation fails
- test that function addresses are monotonic indices, and not actual addresses.
- ~~test that non-pagesize `grow_memory` fails~~
- test that one can clobber the entire contents of the linear memory without corrupting: call stack, local variables, program execution.

Operator semantics:
- test that promote/demote, sext/trunc, zext/trunc is bit-preserving if not NaN
- ~~test that promote/demote is bit-preserving if not NaN~~
- ~~test that clz/ctz handle zero~~
- ~~test that numbers slightly outside of the int32 range round into the int32 range in floating-to-int32 conversion~~
- ~~test that neg, abs, copysign, reinterpretcast, store+load, set+get, preserve the sign bit and significand bits of NaN and don't canonicalize~~
Expand Down Expand Up @@ -54,19 +44,27 @@ Floating point semantics:

Linear memory semantics:
- test that loading from null works
- test that loading from constant OOB traps and is not DCE'd or folded (pending [discussion](https://github.com/WebAssembly/design/blob/master/AstSemantics.md#out-of-bounds))
- ~~test that loading from constant OOB traps and is not DCE'd or folded (pending [discussion](https://github.com/WebAssembly/design/blob/master/AstSemantics.md#out-of-bounds))~~
- test that loading from "beyond the STACKPTR" succeeds
- test that "stackptr + (linearmemptr - stackptr)" loads from linearmemptr.
- test loading "uninitialized" things from aliased stack frames return what's there
- test that loadwithoffset traps in overflow cases
- test that newly allocated memory is zeroed
- test that grow_memory does a full 32-bit unsigned check for page_size divisibility
- test that newly allocated memory (program start and `grow_memory`) is zeroed
- test that `grow_memory` does a full 32-bit unsigned check for page-size divisibility
- test that load/store addreses are full int32 (or int64), and not OCaml int
- test that when allocating 4GiB, accessing index -1 fails
- ~~test that linear memory is little-endian for all integers and floats~~
- test that unaligned and misaligned accesses work, even if slow
- ~~test that runaway recursion traps~~
- test that too-big `grow_memory` fails appropriately
- test that too-big linear memory initial allocation fails
- ~~test that non-pagesize `grow_memory` fails~~
- test that one can clobber the entire contents of the linear memory without corrupting: call stack, local variables, program execution.
- test that an i64 store with 4-byte alignment that's 4 bytes out of bounds traps without storing anything.

Function pointer semantics:
- test that function addresses are monotonic indices, and not actual addresses.
- test that function pointers work [correctly](https://github.com/WebAssembly/design/issues/89)
- ~~test that function pointers work [correctly](https://github.com/WebAssembly/design/issues/89)~~

Expression optimizer bait:
- ~~test that `a+1<b+1` isn't folded to `a<b`~~
Expand Down Expand Up @@ -111,10 +109,9 @@ Misc x87-isms:
- ~~test for loading and storing NaNs~~

Validation errors:
- load/store or variables with type void/bool/funcptr/etc.
- sign-extend load from int64 to int32 etc.
- fp-promote load and fp-demote store
- alignment greater than the size of a load or store
- ~~sign-extend load from int64 to int32 etc.~~
- ~~fp-promote load and fp-demote store~~
- alignment greater than the size of a load or store (https://github.com/WebAssembly/spec/issues/302)

SIMD (post-MVP):
- test that SIMD insert/extract don't canonicalize NaNs
Expand Down
25 changes: 20 additions & 5 deletions ml-proto/test/conversions.wast
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,20 @@
(assert_return (invoke "f32.demote_f64" (f64.const -0x0.0000000000001p-1022)) (f32.const -0.0))
(assert_return (invoke "f32.demote_f64" (f64.const 1.0)) (f32.const 1.0))
(assert_return (invoke "f32.demote_f64" (f64.const -1.0)) (f32.const -1.0))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1p-149)) (f32.const -0x1p-149))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffe0000000p-127)) (f32.const 0x1p-126))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffe0000000p-127)) (f32.const -0x1p-126))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffdfffffffp-127)) (f32.const 0x1.fffffcp-127))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffdfffffffp-127)) (f32.const -0x1.fffffcp-127))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1p-149)) (f32.const 0x1p-149))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1p-149)) (f32.const -0x1p-149))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffd0000000p+127)) (f32.const 0x1.fffffcp+127))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffd0000000p+127)) (f32.const -0x1.fffffcp+127))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffd0000001p+127)) (f32.const 0x1.fffffep+127))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffd0000001p+127)) (f32.const -0x1.fffffep+127))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffefffffffp+127)) (f32.const 0x1.fffffep+127))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffefffffffp+127)) (f32.const -0x1.fffffep+127))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.ffffffp+127)) (f32.const infinity))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.ffffffp+127)) (f32.const -infinity))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1p-119)) (f32.const 0x1p-119))
Expand All @@ -377,8 +387,15 @@
(assert_return (invoke "f32.demote_f64" (f64.const -infinity)) (f32.const -infinity))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000000000001p+0)) (f32.const 1.0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffffffffffp-1)) (f32.const 1.0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000000p+0)) (f32.const 0x1.000000p+0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000001p+0)) (f32.const 0x1.000002p+0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.000002fffffffp+0)) (f32.const 0x1.000002p+0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000030000000p+0)) (f32.const 0x1.000004p+0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000050000000p+0)) (f32.const 0x1.000004p+0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000000p+24)) (f32.const 0x1.0p+24))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000001p+24)) (f32.const 0x1.000002p+24))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.000002fffffffp+24)) (f32.const 0x1.000002p+24))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000030000000p+24)) (f32.const 0x1.000004p+24))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.4eae4f7024c7p+108)) (f32.const 0x1.4eae5p+108))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.a12e71e358685p-113)) (f32.const 0x1.a12e72p-113))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.cb98354d521ffp-127)) (f32.const 0x1.cb9834p-127))
Expand All @@ -387,10 +404,8 @@
(assert_return (invoke "f32.demote_f64" (f64.const nan)) (f32.const nan))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1p-1022)) (f32.const 0.0))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1p-1022)) (f32.const -0.0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x0.0000000000001p-1022)) (f32.const 0.0))
(assert_return (invoke "f32.demote_f64" (f64.const -0x0.0000000000001p-1022)) (f32.const -0.0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x0.8p-149)) (f32.const 0.0))
(assert_return (invoke "f32.demote_f64" (f64.const -0x0.8p-149)) (f32.const -0.0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0p-150)) (f32.const 0.0))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.0p-150)) (f32.const -0.0))
(assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000000000001p-150)) (f32.const 0x1p-149))
(assert_return (invoke "f32.demote_f64" (f64.const -0x1.0000000000001p-150)) (f32.const -0x1p-149))

Expand Down
1 change: 1 addition & 0 deletions ml-proto/test/f32.load32.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (result f32) (f32.load32 (get_local 0))))
1 change: 1 addition & 0 deletions ml-proto/test/f32.load64.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (result f32) (f32.load64 (get_local 0))))
1 change: 1 addition & 0 deletions ml-proto/test/f32.store32.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (param f32) (f32.store32 (get_local 0) (get_local 1))))
1 change: 1 addition & 0 deletions ml-proto/test/f32.store64.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (param f64) (f32.store64 (get_local 0) (get_local 1))))
1 change: 1 addition & 0 deletions ml-proto/test/f64.load32.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (result f64) (f64.load32 (get_local 0))))
1 change: 1 addition & 0 deletions ml-proto/test/f64.load64.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (result f64) (f64.load64 (get_local 0))))
1 change: 1 addition & 0 deletions ml-proto/test/f64.store32.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (param f32) (f64.store32 (get_local 0) (get_local 1))))
1 change: 1 addition & 0 deletions ml-proto/test/f64.store64.fail.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module (memory 1) (func (param i32) (param f64) (f64.store64 (get_local 0) (get_local 1))))
Loading