From af0995c854712020f14bc82cd4243800c429e52b Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Sun, 15 Sep 2024 19:06:03 +0330 Subject: [PATCH 1/3] add the right to fetch stats on pipes --- lib/wasix/src/syscalls/wasix/fd_pipe.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/wasix/src/syscalls/wasix/fd_pipe.rs b/lib/wasix/src/syscalls/wasix/fd_pipe.rs index 7faf4518707..2ca80e2fd27 100644 --- a/lib/wasix/src/syscalls/wasix/fd_pipe.rs +++ b/lib/wasix/src/syscalls/wasix/fd_pipe.rs @@ -66,7 +66,8 @@ pub fn fd_pipe_internal( | Rights::FD_DATASYNC | Rights::POLL_FD_READWRITE | Rights::SOCK_SEND - | Rights::FD_FDSTAT_SET_FLAGS; + | Rights::FD_FDSTAT_SET_FLAGS + | Rights::FD_FILESTAT_GET; let fd1 = if let Some(fd) = with_fd1 { state From 20c29a68c7903dcf182bb2721184fdf404f6704e Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Mon, 16 Sep 2024 19:06:41 +0330 Subject: [PATCH 2/3] update webc dep --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3849b3ec7b3..63753b4cd4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7411,9 +7411,9 @@ dependencies = [ [[package]] name = "webc" -version = "6.0.0" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6cf1915e27168c1ed82f7f0d03f60317648f257fecaf4256a1904428d8e4ccd" +checksum = "c48441419be082f8d2537c84d8b1f502624d77bc08fbbd09ab17cadfe7f0ac53" dependencies = [ "anyhow", "base64 0.22.1", diff --git a/Cargo.toml b/Cargo.toml index bff17a4d1dd..e1d8742bb82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,7 +92,7 @@ wasmer-config = { path = "./lib/config" } wasmer-wasix = { path = "./lib/wasix" } # Wasmer-owned crates -webc = { version = "6.0.0", default-features = false, features = ["package"] } +webc = { version = "6.0.1", default-features = false, features = ["package"] } edge-schema = { version = "=0.1.0" } shared-buffer = "0.1.4" From 75c23073443ca1d57bce6f2323efcb7e37b673ed Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Tue, 17 Sep 2024 02:48:39 +0330 Subject: [PATCH 3/3] add test for aio-http --- tests/integration/cli/Cargo.toml | 2 +- tests/integration/cli/tests/run.rs | 43 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index 76fa9dcf3f3..e96cab8350a 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -17,7 +17,7 @@ hex = "0.4.3" pretty_assertions.workspace = true object = "0.30.0" reqwest = { workspace = true, default-features = false, features = ["json", "blocking", "rustls-tls"] } -tokio = { workspace = true, features = [ "rt", "rt-multi-thread", "macros" ] } +tokio = { workspace = true, features = [ "rt", "rt-multi-thread", "macros", "process" ] } assert_cmd = "2.0.8" predicates = "2.1.5" once_cell = "1.17.1" diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index b43f9d3750f..baa0bd00f9d 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -47,6 +47,49 @@ static CACHE_RUST_LOG: Lazy = Lazy::new(|| { .join(",") }); +#[tokio::test] +async fn aio_http() { + let status = tokio::process::Command::new(get_wasmer_path()) + .kill_on_drop(true) + .arg("package") + .arg("download") + .arg("wasmer-integration-tests/aio-http-hello-world") + .arg("-o") + .arg("aio-http-hello-world.webc") + .arg("--quiet") + .spawn() + .unwrap() + .wait() + .await + .unwrap(); + + assert!(status.success()); + + let mut wasmer = tokio::process::Command::new(get_wasmer_path()) + .kill_on_drop(true) + .arg("run") + .arg("aio-http-hello-world.webc") + .arg("--net") + .stdout(Stdio::null()) + .spawn() + .unwrap(); + + tokio::time::sleep(std::time::Duration::from_secs(5)).await; + + let rsp = reqwest::Client::new() + .get("http://localhost:34343") + .send() + .await + .unwrap(); + + let body = rsp.text().await.unwrap(); + + assert_eq!(body, "Hello, World!"); + + wasmer.kill().await.unwrap(); + wasmer.wait().await.unwrap(); +} + #[test] fn list_cwd() { let package = packages().join("list-cwd");