Add a new style of test suite for the witx tooling similar to *.wast#392
Merged
Conversation
Contributor
|
I love this! |
pchickey
approved these changes
Feb 10, 2021
pchickey
left a comment
Contributor
There was a problem hiding this comment.
Lets release this as witx 0.9?
As the functionality of `witx` grows this will hopefully make adding tests for new functionality as well as new kinds of tests easier. The goal is to make it very easy to drop a test file with various directives to exercise the functionality of `witx` and its internals. For now the testsuite is quite simple, simply asserting whether documents are either valid or invalid. My hope, though, is that this can be expanded over time with more styles of assertions directives.
Contributor
Author
|
Ok with #391 merged I've rebased this on master to get all the tests passing again with adjusted syntax. This actually helped uncover a few bugs here and there! Unless there's an anything urgent I'd prefer to not have a new release just yet. My hope is to next start implementing conveniences for code generators (e.g. witx-bindgen in Rust, wiggle in Wasmtime, the C header generator in wasi-libc, ...) to largely not have to worry about these changes. This is still a work in progress but it'd be nice if they didn't have to update twice or land in the middle by accident. |
Contributor
Author
|
I think this should be good to merge now though! |
pchickey
approved these changes
Feb 11, 2021
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
…st` (WebAssembly#392) * Add a wast-like testsuite for the witx tool As the functionality of `witx` grows this will hopefully make adding tests for new functionality as well as new kinds of tests easier. The goal is to make it very easy to drop a test file with various directives to exercise the functionality of `witx` and its internals. For now the testsuite is quite simple, simply asserting whether documents are either valid or invalid. My hope, though, is that this can be expanded over time with more styles of assertions directives. * Migrate union test to `union.witxt` * Add documentation/roundtrip testing to all documents * Translate multi-module test suite to `*.witxt` * Move wasi tests into `witxt` test suites * Convert representation tests to `*.witxt` * Rebased onto origin/main
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
…st` (WebAssembly#392) * Add a wast-like testsuite for the witx tool As the functionality of `witx` grows this will hopefully make adding tests for new functionality as well as new kinds of tests easier. The goal is to make it very easy to drop a test file with various directives to exercise the functionality of `witx` and its internals. For now the testsuite is quite simple, simply asserting whether documents are either valid or invalid. My hope, though, is that this can be expanded over time with more styles of assertions directives. * Migrate union test to `union.witxt` * Add documentation/roundtrip testing to all documents * Translate multi-module test suite to `*.witxt` * Move wasi tests into `witxt` test suites * Convert representation tests to `*.witxt` * Rebased onto origin/main
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
…st` (WebAssembly#392) * Add a wast-like testsuite for the witx tool As the functionality of `witx` grows this will hopefully make adding tests for new functionality as well as new kinds of tests easier. The goal is to make it very easy to drop a test file with various directives to exercise the functionality of `witx` and its internals. For now the testsuite is quite simple, simply asserting whether documents are either valid or invalid. My hope, though, is that this can be expanded over time with more styles of assertions directives. * Migrate union test to `union.witxt` * Add documentation/roundtrip testing to all documents * Translate multi-module test suite to `*.witxt` * Move wasi tests into `witxt` test suites * Convert representation tests to `*.witxt` * Rebased onto origin/main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These commits add a new
*.witxtstyle of test suite to be similar to the*.waststyle of test suites. (supposed to be shorthand for "witx test")Most existing tests have been converted to the
*.witxtstyle of test as an example. There's a few goals from this translation:*.witxtfile is quite easy and low-overhead. The intention is to make the barrier-to-entry on adding test extremely low.witxcrate change.witxgrows and expands this is intended to make it easier to add new classes of test suites. We'll in theory already have a lot of witx documents in the test suite already and are used to writing inline witx documents, so adding future functionality should be much easier to test by either reusing existing test directives or adding a small handful of new directives.For example one thing I'd like to add stricter tests for on #391 is the elaboration of parsed types to the variant/record types. By using
assert_representationI could reuse those definitions and existing type checking to assert this by adding a new text file here. Additionally I'd like to start codifying more of the translation of a witx signature to the expected ABI, and I believe that will be much easier with a test suite like this.Another thought on this style of test suite is that as
*.witxusage grows beyond simply WASI we'll want the ability to test more and more pieces of functionality that aren't necessarily used by WASI itself, which means it'll get more important to have strict and exhaustive tests outside of just the*.witxfiles in this repository for WASI itself.