Stream: general

Topic: testing components


view this post on Zulip Randy Reddig (Mar 12 2024 at 16:58):

As part of my work with Go bindings generation, I’d like to have a reliable way to test component implementations.

I’d like to have a Test component and an Implementation component where the Test component imports an interface exported by the Implementation component. Is there a process for combining the two components into a single component that, say, Wasmtime can run?

The Test component would use a world that combines wasi:cli/command + another world to test. The Implementation component would export the latter.

view this post on Zulip fitzgen (he/him) (Mar 12 2024 at 17:01):

There is the wasm-tools compose subcommand of the wasm-tools CLI: https://github.com/bytecodealliance/wasm-tools

Or there is the Rust crate that does the same things as a library: https://crates.io/crates/wasm-compose

CLI and Rust libraries for low-level manipulation of WebAssembly modules - GitHub - bytecodealliance/wasm-tools: CLI and Rust libraries for low-level manipulation of WebAssembly modules

view this post on Zulip fitzgen (he/him) (Mar 12 2024 at 17:02):

looks like the crate's README is a bit outdated

view this post on Zulip fitzgen (he/him) (Mar 12 2024 at 17:02):

in the bit about implementation status

view this post on Zulip fitzgen (he/him) (Mar 12 2024 at 17:03):

https://github.com/bytecodealliance/wasm-tools/pull/1447

CLI and Rust libraries for low-level manipulation of WebAssembly modules - Remove outdated warning about no/wip component support in runtimes from wasm-compose README by fitzgen · Pull Request #1447 · bytecodealliance/wasm-tools

view this post on Zulip Alex Crichton (Mar 12 2024 at 17:07):

I'll also drop a link to https://github.com/peterhuene/wac which is intended for compositions as well and is sort of the "next generation" of wasm-tools compose, although it's still in development so it may not be suitable for all use cases yet

WebAssembly Composition (WAC) tooling. Contribute to peterhuene/wac development by creating an account on GitHub.

view this post on Zulip Randy Reddig (Mar 12 2024 at 17:07):

OK, thanks!

view this post on Zulip Alex Crichton (Mar 12 2024 at 17:08):

I'll also mention that the testing story in wit-bindgen is one I've always lamented is "not great". It's pretty heavyweight today and is one that I would love to improve, and what you're describing is a way I've wanted to try implementing before.

view this post on Zulip Alex Crichton (Mar 12 2024 at 17:08):

tl;dr; I like your idea, and if it works out I'd like to change wit-bindgen to a similar scheme

view this post on Zulip Alex Crichton (Mar 12 2024 at 17:08):

ideally one day I'd hope that there could be sort of a shared test suite for all bindings generators to easily use

view this post on Zulip Randy Reddig (Mar 12 2024 at 17:53):

That’d be great.

view this post on Zulip Randy Reddig (Mar 12 2024 at 17:55):

something like a straightforward invocation of a standard tool to compose a wasi:cli/command + another component + with a --test-world $WORLD


Last updated: Dec 23 2024 at 13:07 UTC