Skip to content

Add a corpus of real toolchain-built components for end-to-end tests - #71

Merged
andreaTP merged 6 commits into
roastedroot:mainfrom
andreaTP:component-corpus
Oct 21, 2026
Merged

andreaTP merged 6 commits into
roastedroot:mainfrom
andreaTP:component-corpus

Conversation

@andreaTP

@andreaTP andreaTP commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds component-corpus, a module of real toolchain-built components for end-to-end tests, mirroring Endive's wasm-corpus. Upstream wasi-testsuite has no WASI 0.2 tests (only p1 and p3), so this is our p2 conformance source.

  • Rust first: 11 wasm32-wasip2 command programs (hello, args, env, exit codes, stdin, file read/write, directory listing, random, clocks), each with a spec in the wasi-testsuite format Endive's runner reads (args, env, root, exit_code, stdout, stderr) and fixture files. There is also a wit-bindgen library component covering records, variants, enums, flags, options, results, lists, strings, tuples and a resource.
  • Binaries are committed, as in Endive: 12 components, about 762 KiB.
  • Reproducible build: the base image is pinned by digest, and wasm-tools 1.245.1 and wasmtime 34.0.1 come from release tarballs checked by sha256, with crate versions locked.
    • ./run.sh rebuild && ./run.sh rust reproduces the committed binaries byte for byte. Use CONTAINER=podman for Podman.
    • ./run.sh verify runs every spec on wasmtime, so expectations are checked against the reference runtime.
  • Runtime tests: every component parses and validates, and the library's exports work end to end through ComponentLinker.

A follow-up runs the command programs through WasiPreview2. It needs wasi:cli and version-compatible linking, and all 11 programs already pass locally with the same exit codes and output as wasmtime.

@jeremyg484 jeremyg484 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall, this looks great! There may be some other test program examples we could borrow from Wasmtime at some point in the future: https://github.com/bytecodealliance/jco/tree/main/crates/test-components/src/bin

Specifically the p2_* test programs might be worth pulling in, or at least some subset of them. We might also want to take the wasi-testsuite p1 programs and apply the component adapter shim to them.

But that can all be done later, this is a great start!

@andreaTP

Copy link
Copy Markdown
Contributor Author

We might also want to take the wasi-testsuite

I thought about it but a first attempt seemed to be steep, so decided to take it from another angle: WebAssembly/wasi-testsuite#295

Next time I'll look into the jco tests, thanks for the pointer!

@andreaTP
andreaTP merged commit 5ab27be into roastedroot:main Oct 21, 2026
3 checks passed
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