Skip to content
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

[test] Add more custom-page-sizes tests #31

Merged
merged 3 commits into from
Nov 8, 2024
Merged

Conversation

keithw
Copy link
Member

@keithw keithw commented Nov 8, 2024

This PR adds some tests that I found helpful in implementing the proposal in WABT.

wasm-tools already passes these (with the exception of the ones marked ;; Test data abbreviation syntax -- I think the wast crate hasn't added support for the abbreviation yet).

Copy link
Collaborator

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One minor nitpick below and then we can merge this.

Comment on lines 117 to 119
;; Maximum memory sizes.
;; These modules are valid, but instantiating them would allocate
;; a huge memory, so test with `assert_unlinkable` + a missing import.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making a suggested rewording to this comment because it took me a little bit to understand the subtleties of this set up.

Suggested change
;; Maximum memory sizes.
;; These modules are valid, but instantiating them would allocate
;; a huge memory, so test with `assert_unlinkable` + a missing import.
;; 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).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, since these modules are actually valid, it may make sense to remove these tests from this custom-page-sizes-invalid.wast file and move them to the custom-page-sizes.wast file (or alternatively to their own dedicated max-sized-memory.wast file).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm -- done.

Copy link
Collaborator

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fitzgen fitzgen merged commit ba05ecd into WebAssembly:main Nov 8, 2024
1 check passed
@keithw keithw deleted the add-test branch November 9, 2024 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants