Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions tests/rust/wasm32-wasip3/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/rust/wasm32-wasip3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2024"

[dependencies]
wit-bindgen = "0.48"
wit-bindgen = "0.51"
futures = "0.3.31"
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-advise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-dotdot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-flags-and-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-hard-links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-is-same-object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-metadata-hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-open-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-read-directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-set-size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand Down
16 changes: 8 additions & 8 deletions tests/rust/wasm32-wasip3/src/bin/filesystem-stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:filesystem/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:filesystem/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
Expand All @@ -16,13 +16,13 @@ wit_bindgen::generate!({
generate_all
});

use wasi::clocks::wall_clock::Datetime;
use wasi::clocks::system_clock::Instant;
use wasi::filesystem::types::Descriptor;
use wasi::filesystem::types::NewTimestamp;
use wasi::filesystem::types::{DescriptorFlags, ErrorCode, OpenFlags, PathFlags};
use wasi::filesystem::types::{DescriptorStat, DescriptorType};

fn check_timestamp(t: Datetime) {
fn check_timestamp(t: Instant) {
assert!(t.nanoseconds < 1_000_000_000);
}

Expand Down Expand Up @@ -104,11 +104,11 @@ async fn test_stat(dir: &Descriptor) {
)
};
{
let atime = Datetime {
let atime = Instant {
seconds: 42,
nanoseconds: 0,
};
let mtime = Datetime {
let mtime = Instant {
seconds: 69,
nanoseconds: 0,
};
Expand Down Expand Up @@ -149,11 +149,11 @@ async fn test_stat(dir: &Descriptor) {
.unwrap()
.data_modification_timestamp
.unwrap();
let new_atime = Datetime {
let new_atime = Instant {
seconds: 42,
nanoseconds: 0,
};
let new_mtime = Datetime {
let new_mtime = Instant {
seconds: 69,
nanoseconds: 0,
};
Expand Down
17 changes: 13 additions & 4 deletions tests/rust/wasm32-wasip3/src/bin/http-response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:http/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:http/service@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
features:["clocks-timezone"],
generate_all
});

use wasi::http::types::{Fields, HeaderError, Response};
use wasi::http::types::{ErrorCode, Fields, HeaderError, Request, Response};

fn test_response_field_default_values(response: &Response) {
assert_eq!(response.get_status_code(), 200);
Expand Down Expand Up @@ -45,7 +45,7 @@ fn test_headers_same(left: &Fields, right: &Fields) {
assert_eq!(left.copy_all(), right.copy_all());
}

async fn test_response() {
async fn test_response() -> Response {
let headers = Fields::new();
// No field-specific syntax checks.
headers.append("content-type", b"!!!! invalid").unwrap();
Expand All @@ -58,10 +58,19 @@ async fn test_response() {
test_status_codes(&response);
test_immutable_headers(&response.get_headers());
test_headers_same(&response.get_headers(), &headers_copy);

response
}

struct Component;
export!(Component);

impl exports::wasi::http::handler::Guest for Component {
async fn handle(_r: Request) -> Result<Response, ErrorCode> {
Ok(test_response().await)
}
}

impl exports::wasi::cli::run::Guest for Component {
async fn run() -> Result<(), ()> {
test_response().await;
Expand Down
8 changes: 4 additions & 4 deletions tests/rust/wasm32-wasip3/src/bin/monotonic-clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ wit_bindgen::generate!({
package test:test;

world test {
include wasi:clocks/imports@0.3.0-rc-2025-09-16;
include wasi:cli/command@0.3.0-rc-2025-09-16;
include wasi:clocks/imports@0.3.0-rc-2026-01-06;
include wasi:cli/command@0.3.0-rc-2026-01-06;
}
",
// Work around https://github.com/bytecodealliance/wasm-tools/issues/2285.
features:["clocks-timezone"],
generate_all
});

use monotonic_clock::{Duration, Instant};
use monotonic_clock::{Duration, Mark};
use wasi::clocks::monotonic_clock;

const NANOSECOND: Duration = 1;
Expand All @@ -25,7 +25,7 @@ const MINUTE: Duration = SECOND * 60;
const HOUR: Duration = MINUTE * 60;
const DAY: Duration = HOUR * 24;

fn compute_duration(start: Instant, end: Instant) -> Duration {
fn compute_duration(start: Mark, end: Mark) -> Duration {
// Assume that this test takes less than a day to run (in terms of
// the monotonic clock), and that therefore the difference between
// any two `monotonic-clock#now` calls should be less than a day;
Expand Down
Loading
Loading