-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
So, until WASI preview 3 is out, we compile our Rust tests using a wasip2 toolchain. One can import and test the WASIp3 APIs just fine, but the wasm files also include wasip2 imports.
Consider the simple monotonic-clock.rs test. Its compiled wasm component includes the following imports:
[dev-env] wingo@beastie ~/src/wasip3/wasi-testsuite$ wasm-tools component wit tests/rust/testsuite/wasm32-wasip3/multi-clock-wait.wasm
package root:component;
world root {
import wasi:clocks/monotonic-clock@0.3.0-rc-2025-09-16;
import wasi:io/error@0.2.6;
import wasi:io/streams@0.2.6;
import wasi:cli/environment@0.2.6;
import wasi:cli/exit@0.2.6;
import wasi:cli/stdout@0.2.6;
import wasi:cli/stderr@0.2.6;
export wasi:cli/run@0.3.0-rc-2025-09-16;
export wasi:cli/run@0.2.6;
}
package wasi:clocks@0.3.0-rc-2025-09-16 {
interface monotonic-clock {
type instant = u64;
now: func() -> instant;
wait-until: async func(when: instant);
}
}
package wasi:io@0.2.6 {
interface error {
resource error {
to-debug-string: func() -> string;
}
}
interface streams {
use error.{error};
resource output-stream {
blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>;
}
variant stream-error {
last-operation-failed(error),
closed,
}
}
}
package wasi:cli@0.2.6 {
interface environment {
get-environment: func() -> list<tuple<string, string>>;
}
interface exit {
exit: func(status: result);
}
interface stdout {
use wasi:io/streams@0.2.6.{output-stream};
get-stdout: func() -> output-stream;
}
interface stderr {
use wasi:io/streams@0.2.6.{output-stream};
get-stderr: func() -> output-stream;
}
interface run {
run: func() -> result;
}
}
package wasi:cli@0.3.0-rc-2025-09-16 {
interface run {
run: async func() -> result;
}
}I.e., note the use of the wasi:cli@0.2.6 and wasi:io@0.2.6 imports. This is OK -- all wasip3 hosts will support wasip2, because that's where they are right now -- but it's not a pure wasip3 test.
Metadata
Metadata
Assignees
Labels
No labels