WebAssembly / WASI

WebAssembly System Interface
Other
4.89k stars 255 forks source link

Add a new style of test suite for the `witx` tooling similar to `*.wast` #392

Closed alexcrichton closed 3 years ago

alexcrichton commented 3 years ago

These commits add a new *.witxt style of test suite to be similar to the *.wast style of test suites. (supposed to be shorthand for "witx test")

Most existing tests have been converted to the *.witxt style of test as an example. There's a few goals from this translation:

For example one thing I'd like to add stricter tests for on https://github.com/WebAssembly/WASI/pull/391 is the elaboration of parsed types to the variant/record types. By using assert_representation I 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 *.witx usage 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 *.witx files in this repository for WASI itself.

pchickey commented 3 years ago

I love this!

alexcrichton commented 3 years ago

Ok with https://github.com/WebAssembly/WASI/pull/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.

alexcrichton commented 3 years ago

I think this should be good to merge now though!