From f31b7c6b7bd3a5b7fa33d4efcd6563b27de173e5 Mon Sep 17 00:00:00 2001 From: Adam Bratschi-Kaye Date: Fri, 20 Nov 2026 16:37:59 -0500 Subject: [PATCH 1/3] enable weather test on p3 --- test-programs/tests/axum_weather.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/test-programs/tests/axum_weather.rs b/test-programs/tests/axum_weather.rs index f2b3f3c..7ec0e0f 100644 --- a/test-programs/tests/axum_weather.rs +++ b/test-programs/tests/axum_weather.rs @@ -9,7 +9,6 @@ fn weather() -> Result<()> { run(test_programs::axum::WEATHER) } -#[ignore] #[test_log::test] fn weather_p3() -> Result<()> { run(test_programs::axum::WEATHER_P3) From 405403bfcae723cf18c5612d9789fa8e38bcc56b Mon Sep 17 00:00:00 2001 From: Adam Bratschi-Kaye Date: Fri, 20 Nov 2026 16:49:04 -0500 Subject: [PATCH 2/3] time: make the WASIp3 `Wait` future `Sync` This is required by aws-smithy-wasm. --- src/time/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time/mod.rs b/src/time/mod.rs index ed22947..c649463 100644 --- a/src/time/mod.rs +++ b/src/time/mod.rs @@ -171,7 +171,7 @@ mod timer { /// Future created by [`Timer::wait`]. #[must_use = "futures do nothing unless polled or .awaited"] - pub struct Wait(Pin + Send>>); + pub struct Wait(Pin + Send + Sync>>); impl Future for Wait { type Output = Instant; From a31a119bf28df41561fa456269a42e9202500fd0 Mon Sep 17 00:00:00 2001 From: Adam Bratschi-Kaye Date: Fri, 20 Nov 2026 16:49:04 -0500 Subject: [PATCH 3/3] test: run the aws s3 example on WASIp3 --- aws-example/Cargo.toml | 3 +++ test-programs/build.rs | 13 ++++--------- test-programs/tests/aws_s3.rs | 28 +++++++++++++++++++++++----- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/aws-example/Cargo.toml b/aws-example/Cargo.toml index 1e4f034..05a0c0e 100644 --- a/aws-example/Cargo.toml +++ b/aws-example/Cargo.toml @@ -24,3 +24,6 @@ aws-smithy-wasm = "0.1.10" wstd = "0.6.5" [workspace] + +[patch.crates-io] +wstd = { path = ".." } diff --git a/test-programs/build.rs b/test-programs/build.rs index 0f6b874..c42748b 100644 --- a/test-programs/build.rs +++ b/test-programs/build.rs @@ -34,22 +34,17 @@ fn main() { assert!(status.success()); } - fn build_targets(pkg: &str, manifest: &str, kind: &str, build_p3: bool, out_dir: &Path) { + fn build_targets(pkg: &str, manifest: &str, kind: &str, out_dir: &Path) { build_target(pkg, manifest, kind, "wasm32-wasip2", out_dir); - - if build_p3 { - build_target(pkg, manifest, kind, "wasm32-wasip3", out_dir); - } + build_target(pkg, manifest, kind, "wasm32-wasip3", out_dir); } - build_targets("wstd", "../Cargo.toml", "--examples", true, &out_dir); - build_targets("wstd-axum", "../Cargo.toml", "--examples", true, &out_dir); + build_targets("wstd", "../Cargo.toml", "--examples", &out_dir); + build_targets("wstd-axum", "../Cargo.toml", "--examples", &out_dir); build_targets( "wstd-aws-example", "../aws-example/Cargo.toml", "--bins", - // TODO: enable when aws example is running for WASIp3 - false, &out_dir, ); diff --git a/test-programs/tests/aws_s3.rs b/test-programs/tests/aws_s3.rs index f5f26fb..77dd66a 100644 --- a/test-programs/tests/aws_s3.rs +++ b/test-programs/tests/aws_s3.rs @@ -2,15 +2,17 @@ use anyhow::Result; use std::path::Path; use std::process::Command; -fn run_s3_example() -> Command { +fn run_s3_example(component: &str) -> Command { let mut command = Command::new("wasmtime"); command.arg("run"); command.arg("-Shttp"); + // Also supports WASIp2 components. + command.arg("-Sp3"); command.args(["--env", "AWS_ACCESS_KEY_ID"]); command.args(["--env", "AWS_SECRET_ACCESS_KEY"]); command.args(["--env", "AWS_SESSION_TOKEN"]); command.args(["--dir", ".::."]); - command.arg(test_programs::aws::S3); + command.arg(component); command.arg(format!( "--region={}", std::env::var("AWS_REGION").unwrap_or_else(|_| "us-west-2".to_owned()) @@ -25,8 +27,20 @@ fn run_s3_example() -> Command { #[test_log::test] #[cfg_attr(feature = "no-aws", ignore)] fn aws_s3() -> Result<()> { + run(test_programs::aws::S3, "shoug_p2.jpg") +} + +#[test_log::test] +#[cfg_attr(feature = "no-aws", ignore)] +fn aws_s3_p3() -> Result<()> { + run(test_programs::aws::S3_P3, "shoug_p3.jpg") +} + +/// `out` is where the downloaded object is written; it must be distinct per +/// test, since tests run concurrently. +fn run(component: &str, out: &str) -> Result<()> { // bucket list command - let output = run_s3_example().arg("list").output()?; + let output = run_s3_example(component).arg("list").output()?; println!("{:?}", output); assert!(output.status.success()); let stdout = String::from_utf8_lossy(&output.stdout); @@ -34,11 +48,15 @@ fn aws_s3() -> Result<()> { assert!(stdout.contains("shoug.jpg")); // bucket get command - let output = run_s3_example().arg("get").arg("shoug.jpg").output()?; + let output = run_s3_example(component) + .arg("get") + .arg("shoug.jpg") + .arg(format!("--out={out}")) + .output()?; println!("{:?}", output); assert!(output.status.success()); - assert!(Path::new("shoug.jpg").exists()); + assert!(Path::new(out).exists()); Ok(()) }