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
2 changes: 1 addition & 1 deletion ci/vendor-wit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ get_github() {
}

p2=0.2.6
p3=0.3.0-rc-2026-02-09
p3=0.3.0-rc-2026-03-15

rm -rf crates/wasi-io/wit/deps
mkdir -p crates/wasi-io/wit/deps
Expand Down
2 changes: 1 addition & 1 deletion crates/test-programs/src/bin/p3_cli_many_tasks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use test_programs::p3::wasi as wasip3;

#[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.3.0-rc-2026-02-09")]
#[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15")]
unsafe extern "C" {
#[link_name = "[async-lower]wait-for"]
fn wait_for(dur: u64) -> u32;
Expand Down
26 changes: 13 additions & 13 deletions crates/test-programs/src/bin/p3_http_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ wit_bindgen::generate!({
path: "../wasi-http/src/p3/wit",
world: "wasi:http/middleware",
with: {
"wasi:http/handler@0.3.0-rc-2026-02-09": test_programs::p3::wasi::http::handler,
"wasi:http/types@0.3.0-rc-2026-02-09": test_programs::p3::wasi::http::types,
"wasi:http/client@0.3.0-rc-2026-02-09": test_programs::p3::wasi::http::client,
"wasi:random/random@0.3.0-rc-2026-02-09": test_programs::p3::wasi::random::random,
"wasi:random/insecure@0.3.0-rc-2026-02-09": test_programs::p3::wasi::random::insecure,
"wasi:random/insecure-seed@0.3.0-rc-2026-02-09": test_programs::p3::wasi::random::insecure_seed,
"wasi:cli/stdout@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::stdout,
"wasi:cli/stderr@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::stderr,
"wasi:cli/stdin@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::stdin,
"wasi:cli/types@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::types,
"wasi:clocks/monotonic-clock@0.3.0-rc-2026-02-09": test_programs::p3::wasi::clocks::monotonic_clock,
"wasi:clocks/system-clock@0.3.0-rc-2026-02-09": test_programs::p3::wasi::clocks::system_clock,
"wasi:clocks/types@0.3.0-rc-2026-02-09": test_programs::p3::wasi::clocks::types,
"wasi:http/handler@0.3.0-rc-2026-03-15": test_programs::p3::wasi::http::handler,
"wasi:http/types@0.3.0-rc-2026-03-15": test_programs::p3::wasi::http::types,
"wasi:http/client@0.3.0-rc-2026-03-15": test_programs::p3::wasi::http::client,
"wasi:random/random@0.3.0-rc-2026-03-15": test_programs::p3::wasi::random::random,
"wasi:random/insecure@0.3.0-rc-2026-03-15": test_programs::p3::wasi::random::insecure,
"wasi:random/insecure-seed@0.3.0-rc-2026-03-15": test_programs::p3::wasi::random::insecure_seed,
"wasi:cli/stdout@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::stdout,
"wasi:cli/stderr@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::stderr,
"wasi:cli/stdin@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::stdin,
"wasi:cli/types@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::types,
"wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15": test_programs::p3::wasi::clocks::monotonic_clock,
"wasi:clocks/system-clock@0.3.0-rc-2026-03-15": test_programs::p3::wasi::clocks::system_clock,
"wasi:clocks/types@0.3.0-rc-2026-03-15": test_programs::p3::wasi::clocks::types,
},
});

Expand Down
28 changes: 14 additions & 14 deletions crates/test-programs/src/bin/p3_http_middleware_with_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ mod bindings {
package local:local;

world middleware-with-chain {
include wasi:http/service@0.3.0-rc-2026-02-09;
include wasi:http/service@0.3.0-rc-2026-03-15;

import chain-http;
}

interface chain-http {
use wasi:http/types@0.3.0-rc-2026-02-09.{request, response, error-code};
use wasi:http/types@0.3.0-rc-2026-03-15.{request, response, error-code};

handle: async func(request: request) -> result<response, error-code>;
}
",
// workaround https://github.com/bytecodealliance/wit-bindgen/issues/1544
// generate_all
with: {
"wasi:http/types@0.3.0-rc-2026-02-09": test_programs::p3::wasi::http::types,
"wasi:http/client@0.3.0-rc-2026-02-09": test_programs::p3::wasi::http::client,
"wasi:random/random@0.3.0-rc-2026-02-09": test_programs::p3::wasi::random::random,
"wasi:random/insecure@0.3.0-rc-2026-02-09": test_programs::p3::wasi::random::insecure,
"wasi:random/insecure-seed@0.3.0-rc-2026-02-09": test_programs::p3::wasi::random::insecure_seed,
"wasi:cli/stdout@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::stdout,
"wasi:cli/stderr@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::stderr,
"wasi:cli/stdin@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::stdin,
"wasi:cli/types@0.3.0-rc-2026-02-09": test_programs::p3::wasi::cli::types,
"wasi:clocks/monotonic-clock@0.3.0-rc-2026-02-09": test_programs::p3::wasi::clocks::monotonic_clock,
"wasi:clocks/system-clock@0.3.0-rc-2026-02-09": test_programs::p3::wasi::clocks::system_clock,
"wasi:clocks/types@0.3.0-rc-2026-02-09": test_programs::p3::wasi::clocks::types,
"wasi:http/types@0.3.0-rc-2026-03-15": test_programs::p3::wasi::http::types,
"wasi:http/client@0.3.0-rc-2026-03-15": test_programs::p3::wasi::http::client,
"wasi:random/random@0.3.0-rc-2026-03-15": test_programs::p3::wasi::random::random,
"wasi:random/insecure@0.3.0-rc-2026-03-15": test_programs::p3::wasi::random::insecure,
"wasi:random/insecure-seed@0.3.0-rc-2026-03-15": test_programs::p3::wasi::random::insecure_seed,
"wasi:cli/stdout@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::stdout,
"wasi:cli/stderr@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::stderr,
"wasi:cli/stdin@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::stdin,
"wasi:cli/types@0.3.0-rc-2026-03-15": test_programs::p3::wasi::cli::types,
"wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15": test_programs::p3::wasi::clocks::monotonic_clock,
"wasi:clocks/system-clock@0.3.0-rc-2026-03-15": test_programs::p3::wasi::clocks::system_clock,
"wasi:clocks/types@0.3.0-rc-2026-03-15": test_programs::p3::wasi::clocks::types,
},
});

Expand Down
4 changes: 2 additions & 2 deletions crates/test-programs/src/bin/p3_readdir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ async fn test_readdir(dir: &Descriptor) {
let entries = read_dir(dir).await;
assert_eq!(entries.len(), 2);
assert_eq!(entries[0].name, "file");
assert_eq!(entries[0].type_, DescriptorType::RegularFile);
assert!(matches!(entries[0].type_, DescriptorType::RegularFile));
assert_eq!(entries[1].name, "nested");
assert_eq!(entries[1].type_, DescriptorType::Directory);
assert!(matches!(entries[1].type_, DescriptorType::Directory));

assert_empty_dir(&nested).await;
drop(nested);
Expand Down
24 changes: 12 additions & 12 deletions crates/test-programs/src/bin/p3_sockets_ip_name_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,32 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
);

// Invalid inputs
assert_eq!(
assert!(matches!(
resolve_addresses("".into()).await.unwrap_err(),
ErrorCode::InvalidArgument
);
assert_eq!(
));
assert!(matches!(
resolve_addresses(" ".into()).await.unwrap_err(),
ErrorCode::InvalidArgument
);
assert_eq!(
));
assert!(matches!(
resolve_addresses("a.b<&>".into()).await.unwrap_err(),
ErrorCode::InvalidArgument
);
assert_eq!(
));
assert!(matches!(
resolve_addresses("127.0.0.1:80".into()).await.unwrap_err(),
ErrorCode::InvalidArgument
);
assert_eq!(
));
assert!(matches!(
resolve_addresses("[::]:80".into()).await.unwrap_err(),
ErrorCode::InvalidArgument
);
assert_eq!(
));
assert!(matches!(
resolve_addresses("http://example.com/".into())
.await
.unwrap_err(),
ErrorCode::InvalidArgument
);
));
Ok(())
}
}
Expand Down
10 changes: 8 additions & 2 deletions crates/test-programs/src/bin/p3_sockets_tcp_bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ fn test_tcp_bind_addrinuse(ip: IpAddress) {
let bound_addr = sock1.get_local_address().unwrap();

let sock2 = TcpSocket::create(ip.family()).unwrap();
assert_eq!(sock2.bind(bound_addr), Err(ErrorCode::AddressInUse));
assert!(matches!(
sock2.bind(bound_addr),
Err(ErrorCode::AddressInUse)
));
}

// The WASI runtime should set SO_REUSEADDR for us
Expand Down Expand Up @@ -111,7 +114,10 @@ fn test_tcp_bind_addrnotavail(ip: IpAddress) {

let sock = TcpSocket::create(ip.family()).unwrap();

assert_eq!(sock.bind(bind_addr), Err(ErrorCode::AddressNotBindable));
assert!(matches!(
sock.bind(bind_addr),
Err(ErrorCode::AddressNotBindable)
));
}

/// Bind should validate the address family.
Expand Down
34 changes: 20 additions & 14 deletions crates/test-programs/src/bin/p3_sockets_tcp_connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ async fn test_tcp_connect_unspec(family: IpAddressFamily) {
let addr = IpSocketAddress::new(IpAddress::new_unspecified(family), SOME_PORT);
let sock = TcpSocket::create(family).unwrap();

assert_eq!(sock.connect(addr).await, Err(ErrorCode::InvalidArgument));
assert!(matches!(
sock.connect(addr).await,
Err(ErrorCode::InvalidArgument)
));
}

/// 0 is not a valid remote port.
async fn test_tcp_connect_port_0(family: IpAddressFamily) {
let addr = IpSocketAddress::new(IpAddress::new_loopback(family), 0);
let sock = TcpSocket::create(family).unwrap();

assert_eq!(sock.connect(addr).await, Err(ErrorCode::InvalidArgument));
assert!(matches!(
sock.connect(addr).await,
Err(ErrorCode::InvalidArgument)
));
}

/// Connect should validate the address family.
Expand All @@ -36,10 +42,10 @@ async fn test_tcp_connect_wrong_family(family: IpAddressFamily) {

let sock = TcpSocket::create(family).unwrap();

assert_eq!(
assert!(matches!(
sock.connect(remote_addr).await,
Err(ErrorCode::InvalidArgument)
);
));
}

/// Can only connect to unicast addresses.
Expand All @@ -52,18 +58,18 @@ async fn test_tcp_connect_non_unicast() {
let sock_v4 = TcpSocket::create(IpAddressFamily::Ipv4).unwrap();
let sock_v6 = TcpSocket::create(IpAddressFamily::Ipv6).unwrap();

assert_eq!(
assert!(matches!(
sock_v4.connect(ipv4_broadcast).await,
Err(ErrorCode::InvalidArgument)
);
assert_eq!(
));
assert!(matches!(
sock_v4.connect(ipv4_multicast).await,
Err(ErrorCode::InvalidArgument)
);
assert_eq!(
));
assert!(matches!(
sock_v6.connect(ipv6_multicast).await,
Err(ErrorCode::InvalidArgument)
);
));
}

async fn test_tcp_connect_dual_stack() {
Expand All @@ -83,15 +89,15 @@ async fn test_tcp_connect_dual_stack() {
// Tests:

// Connecting to an IPv4 address on an IPv6 socket should fail:
assert_eq!(
assert!(matches!(
v6_client.connect(v4_listener_addr).await,
Err(ErrorCode::InvalidArgument)
);
));
// Connecting to an IPv4-mapped-IPv6 address on an IPv6 socket should fail:
assert_eq!(
assert!(matches!(
v6_client.connect(v6_listener_addr).await,
Err(ErrorCode::InvalidArgument)
);
));
}

/// Client sockets can be explicitly bound.
Expand Down
2 changes: 1 addition & 1 deletion crates/test-programs/src/bin/p3_sockets_tcp_listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn test_tcp_listen_with_bind(family: IpAddressFamily) {
let local_addr = sock.get_local_address().unwrap();

assert!(matches!(sock.listen(), Ok(_)));
assert_eq!(sock.get_local_address(), Ok(local_addr));
assert_eq!(sock.get_local_address().unwrap(), local_addr);
}

impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
Expand Down
Loading
Loading