Skip to content
Open
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
3 changes: 3 additions & 0 deletions aws-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ aws-smithy-wasm = "0.1.10"
wstd = "0.6.5"

[workspace]

[patch.crates-io]
wstd = { path = ".." }
2 changes: 1 addition & 1 deletion src/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ mod timer {

/// Future created by [`Timer::wait`].
#[must_use = "futures do nothing unless polled or .awaited"]
pub struct Wait(Pin<Box<dyn Future<Output = ()> + Send>>);
pub struct Wait(Pin<Box<dyn Future<Output = ()> + Send + Sync>>);

impl Future for Wait {
type Output = Instant;
Expand Down
13 changes: 4 additions & 9 deletions test-programs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

Expand Down
28 changes: 23 additions & 5 deletions test-programs/tests/aws_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -25,20 +27,36 @@ 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);
assert!(stdout.contains("fluff.jpg"));
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(())
}
1 change: 0 additions & 1 deletion test-programs/tests/axum_weather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading