wasi:[email protected]: Add tests for unlink errors#137
wasi:[email protected]: Add tests for unlink errors#137wingo wants to merge 1 commit intoWebAssembly:mainfrom
Conversation
89c4f76 to
a6d9fc9
Compare
a6d9fc9 to
344e0ee
Compare
| assert_eq!(rm("/etc/passwd").await, Err(ErrorCode::NotPermitted)); | ||
| assert_eq!(rm("/etc/passwd").await, Err(ErrorCode::NotPermitted)); | ||
| assert_eq!(rm("z.txt").await, Err(ErrorCode::NoEntry)); | ||
| assert_eq!(rm("parent/z.txt").await, Err(ErrorCode::NotPermitted)); |
There was a problem hiding this comment.
All of these errors follow POSIX, and I think that if Windows diverges, there should be some adapter code. WDYT @alexcrichton ?
There was a problem hiding this comment.
In theory that seems reasonable to me yeah. Given how tricky this can be though I wouldn't be confident in saying it's the best solution until there's an implementation. For example a simple "map this code to that code" is totally fine, but if it otherwise requires a lot of other contextual information or flags-on-files or something then that's less reasonable. I'm not sure which bucket this would fall into.
08b09f1 to
fc772af
Compare
| async fn test_unlink_errors(dir: &Descriptor) { | ||
| let rm = |path: &str| dir.unlink_file_at(path.to_string()); | ||
| assert_eq!(rm("").await, Err(ErrorCode::NoEntry)); | ||
| assert_eq!(rm(".").await, Err(ErrorCode::IsDirectory)); |
There was a problem hiding this comment.
Windows Wasmtime error:
Test filesystem-unlink-errors failed
[exit_code] 0 == 3
STDOUT:
STDERR:
thread '' (1) panicked at src/bin/filesystem-unlink-errors.rs:25:5:
assertion left == right failed
left: Err(ErrorCode { code: 0, name: "access", message: "Permission denied, similar to EACCES in POSIX." })
right: Err(ErrorCode { code: 13, name: "is-directory", message: "Is a directory, similar to EISDIR in POSIX." })
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Error: failed to run main module tests\rust\testsuite\wasm32-wasip3\filesystem-unlink-errors.wasm
| async fn test_unlink_errors(dir: &Descriptor) { | ||
| let rm = |path: &str| dir.unlink_file_at(path.to_string()); | ||
| assert_eq!(rm("").await, Err(ErrorCode::NoEntry)); | ||
| assert_eq!(rm(".").await, Err(ErrorCode::IsDirectory)); |
There was a problem hiding this comment.
MacOS error:
Test filesystem-unlink-errors failed
[exit_code] 0 == 134
STDOUT:
STDERR:
thread '' (1) panicked at src/bin/filesystem-unlink-errors.rs:25:5:
assertion left == right failed
left: Err(ErrorCode { code: 30, name: "not-permitted", message: "Operation not permitted, similar to EPERM in POSIX." })
right: Err(ErrorCode { code: 13, name: "is-directory", message: "Is a directory, similar to EISDIR in POSIX." })
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Error: failed to run main module tests/rust/testsuite/wasm32-wasip3/filesystem-unlink-errors.wasm
fc772af to
3fc450f
Compare
3fc450f to
08cc520
Compare
|
Rebased just to re-run ci... |
When attempting to unlink a directory, POSIX specifies the result should be EPERM, but only MacOS implements that behavior. Paper over the differences. Also turn EACCESS into EPERM, to paper over Windows differences. Related to WebAssembly/WASI#852 and WebAssembly/wasi-testsuite#137. POSIX 2008 reference: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
08cc520 to
bc0bdad
Compare
When attempting to unlink a directory, POSIX specifies the result should be EPERM, but only MacOS implements that behavior. Paper over the differences. Also turn EACCESS into EPERM, to paper over Windows differences. Related to WebAssembly/WASI#852 and WebAssembly/wasi-testsuite#137. POSIX 2008 reference: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
When attempting to unlink a directory, POSIX specifies the result should be EPERM, but only MacOS implements that behavior. Paper over the differences. Also turn EACCESS into EPERM, to paper over Windows differences. Related to WebAssembly/WASI#852 and WebAssembly/wasi-testsuite#137. POSIX 2008 reference: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
When attempting to unlink a directory, POSIX specifies the result should be EPERM, but only MacOS implements that behavior. Paper over the differences. Also turn EACCESS into EPERM, to paper over Windows differences. Related to WebAssembly/WASI#852 and WebAssembly/wasi-testsuite#137. POSIX 2008 reference: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
|
This one is currently blocked on the resolution of bytecodealliance/wasmtime#12169. |
No description provided.