diff --git a/crates/test-programs/tests/wasm_tests/runtime.rs b/crates/test-programs/tests/wasm_tests/runtime/cap_std_sync.rs similarity index 100% rename from crates/test-programs/tests/wasm_tests/runtime.rs rename to crates/test-programs/tests/wasm_tests/runtime/cap_std_sync.rs diff --git a/crates/wasi-common/src/error.rs b/crates/wasi-common/src/error.rs index 7dd620a9e4..de64405087 100644 --- a/crates/wasi-common/src/error.rs +++ b/crates/wasi-common/src/error.rs @@ -6,6 +6,9 @@ pub use anyhow::Error; #[derive(Debug, thiserror::Error)] pub enum ErrorKind { + /// Errno::Noent: No such file or directory + #[error("Noent: No such file or directory")] + Noent, /// Errno::TooBig: Argument list too long #[error("TooBig: Argument list too long")] TooBig, @@ -49,6 +52,7 @@ pub enum ErrorKind { pub trait ErrorExt { fn trap(msg: impl Into) -> Self; + fn not_found() -> Self; fn too_big() -> Self; fn badf() -> Self; fn exist() -> Self; @@ -68,6 +72,9 @@ impl ErrorExt for Error { fn trap(msg: impl Into) -> Self { anyhow::anyhow!(msg.into()) } + fn not_found() -> Self { + ErrorKind::Noent.into() + } fn too_big() -> Self { ErrorKind::TooBig.into() } diff --git a/crates/wasi-common/src/snapshots/preview_1.rs b/crates/wasi-common/src/snapshots/preview_1.rs index c04967639b..ea9f90756b 100644 --- a/crates/wasi-common/src/snapshots/preview_1.rs +++ b/crates/wasi-common/src/snapshots/preview_1.rs @@ -73,6 +73,7 @@ impl From for types::Errno { fn from(e: ErrorKind) -> types::Errno { use types::Errno; match e { + ErrorKind::Noent => Errno::Noent, ErrorKind::TooBig => Errno::TooBig, ErrorKind::Badf => Errno::Badf, ErrorKind::Exist => Errno::Exist,