-
Notifications
You must be signed in to change notification settings - Fork 1
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
Upstream initial test suite from wasm-tools
#85
base: main
Are you sure you want to change the base?
Conversation
This change starts this proposal's test suite by adding encoding, decoding, and validation tests for the new instructions. This is a wholesale copy of the current state of the `wasm-tools` [tests]. Some things to note: - some of the tests were generated mechanically to attempt to "cover all possibilities;" not all proposals do this, though, so it's unclear whether we want to here (it's verbose, but hopefully more complete) - these tests include the component model built-ins, which are not executable in many engines; it's unclear whether to keep that file (the proposal speaks of this) or not - these tests are a start, not the end state: we're missing anything to do with "thread locals," `pause`, and possibly some other bits. [tests]: https://github.com/bytecodealliance/wasm-tools/tree/5a83828/tests/local/shared-everything-threads
@rossberg, looks like we don't even have CI turned on here... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it makes sense to inlude mechanically generated tests to improve coverage, and we might as well include the component model tests in case they are useful to more folks. We can always remove things later once we have an interpreter implementation and CI running.
test/core/shared-everything-threads/shared-everything-threads/arrays.wast
Outdated
Show resolved
Hide resolved
test/core/shared-everything-threads/shared-everything-threads/arrays.wast
Outdated
Show resolved
Hide resolved
test/core/shared-everything-threads/shared-everything-threads/globals.wast
Outdated
Show resolved
Hide resolved
test/core/shared-everything-threads/shared-everything-threads/i31.wast
Outdated
Show resolved
Hide resolved
test/core/shared-everything-threads/shared-everything-threads/i31.wast
Outdated
Show resolved
Hide resolved
(table shared (ref null (shared func)) (elem (ref.null (shared func)))) | ||
) | ||
|
||
;; Note that shared elements can live within an unshared table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to test that the reverse is invalid. Also, we can test the interaction with shared and unshared globals used in the table initializers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to test that the reverse is invalid.
We do; they're just a few lines down. I'll move those closer to this assertion.
Also, we can test the interaction with shared and unshared globals used in the table initializers.
Were you thinking of variations on this kind of thing?
(module
(type $f (shared (func)))
(global $g (shared (ref null $f)) (ref.null $f))
(table $t shared 1 (ref null $f) (ref.null $f))
(elem (global.get $g))
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, although that test could be simplified by removing the table entirely and just keeping the element segment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? Both wasm-tools
and wabt
seem to expect an elem
to have a preceding table
definition or we get an error. E.g., (module (elem (i32.const 0) funcref))
is invalid in wat2wasm
v1.0.33.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...but see 740c560 (a lot more notation is necessary than I might have expected to convince wasm-tools
it is valid).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? Both
wasm-tools
andwabt
seem to expect anelem
to have a precedingtable
definition or we get an error. E.g.,(module (elem (i32.const 0) funcref))
is invalid inwat2wasm
v1.0.33.
That module is invalid because it defines an active segment, which needs a table to be initialized into. Get rid of the (i32.const 0)
offset and it should validate.
Co-authored-by: Thomas Lively <[email protected]>
Co-authored-by: Thomas Lively <[email protected]>
This change starts this proposal's test suite by adding encoding, decoding, and validation tests for the new instructions. This is a wholesale copy of the current state of the
wasm-tools
tests. Some things to note:pause
, and possibly some other bits.