dangling directories are a windows thing
This commit is contained in:
@@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
* fd_readdir
|
* fd_readdir
|
||||||
- DirEntry metadata ino panics on windows: https://github.com/bytecodealliance/cap-std/issues/142
|
- DirEntry metadata ino panics on windows: https://github.com/bytecodealliance/cap-std/issues/142
|
||||||
* file_allocate
|
|
||||||
- call to fd_allocate(10,10) reduces size from 100 to 20
|
|
||||||
- fix upstream: fd_allocate is impossible on windows, so dont even try
|
|
||||||
- the test should be modified to accept this fd_allocate always failing on windows.
|
|
||||||
* nofollow_errors
|
* nofollow_errors
|
||||||
- I loosened up some errno acceptance but windows requires rmdir to delete
|
- I loosened up some errno acceptance but windows requires rmdir to delete
|
||||||
a symlink to a directory, rather than unlink_file
|
a symlink to a directory, rather than unlink_file
|
||||||
@@ -25,10 +21,6 @@
|
|||||||
* symlink_create
|
* symlink_create
|
||||||
- narrowed down the symlink delete issue that only shows up on linux
|
- narrowed down the symlink delete issue that only shows up on linux
|
||||||
- dan is doing the upstream fix rn
|
- dan is doing the upstream fix rn
|
||||||
* path_rename
|
|
||||||
- permission denied on windows to rename a dir to an existing empty dir
|
|
||||||
* path_link
|
|
||||||
- passes everything except dangling symlinks
|
|
||||||
* fd_flags_set
|
* fd_flags_set
|
||||||
- same metadata panic as fd_readdir
|
- same metadata panic as fd_readdir
|
||||||
* path_filestat
|
* path_filestat
|
||||||
@@ -41,17 +33,11 @@
|
|||||||
- on windows, opening a directory with a trailing slash fails.
|
- on windows, opening a directory with a trailing slash fails.
|
||||||
* path_rename_file_trailing_slashes
|
* path_rename_file_trailing_slashes
|
||||||
- same incorrect behavior as linux
|
- same incorrect behavior as linux
|
||||||
* path_symlink_trailing_slashes
|
|
||||||
- dangling symlinks are not supported, different errnos in four spots
|
|
||||||
|
* dangling_fd
|
||||||
|
* dangling_symlink
|
||||||
|
* path_rename_trailing_slashes
|
||||||
* remove_directory_trailing_slashes
|
* remove_directory_trailing_slashes
|
||||||
- different errno in one case
|
* symlink_filestat
|
||||||
* unlink_file_trailing_slashes
|
* symlink_loop
|
||||||
- different errnos in three spots
|
|
||||||
|
|
||||||
|
|
||||||
# Test Divergences
|
|
||||||
|
|
||||||
* fd_allocate supported or not
|
|
||||||
* dangling symlinks supported or not
|
|
||||||
* errno: windows or linux mode?
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ pub fn instantiate(data: &[u8], bin_name: &str, workspace: Option<&Path>) -> any
|
|||||||
.env("ERRNO_MODE_WINDOWS", "1")?
|
.env("ERRNO_MODE_WINDOWS", "1")?
|
||||||
.env("NO_DANGLING_SYMLINKS", "1")?
|
.env("NO_DANGLING_SYMLINKS", "1")?
|
||||||
.env("NO_FD_ALLOCATE", "1")?
|
.env("NO_FD_ALLOCATE", "1")?
|
||||||
.env("NO_RENAME_DIR_TO_EMPTY_DIR", "1")?;
|
.env("NO_RENAME_DIR_TO_EMPTY_DIR", "1")?
|
||||||
|
.env("NO_DANGLING_DIRECTORY", "1")?;
|
||||||
}
|
}
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use more_asserts::assert_gt;
|
use more_asserts::assert_gt;
|
||||||
use std::{env, process};
|
use std::{env, process};
|
||||||
use wasi_tests::open_scratch_directory;
|
use wasi_tests::{open_scratch_directory, TESTCONFIG};
|
||||||
|
|
||||||
unsafe fn test_dangling_fd(dir_fd: wasi::Fd) {
|
unsafe fn test_dangling_fd(dir_fd: wasi::Fd) {
|
||||||
// Create a file, open it, delete it without closing the handle,
|
// Create a file, open it, delete it without closing the handle,
|
||||||
@@ -17,17 +17,19 @@ unsafe fn test_dangling_fd(dir_fd: wasi::Fd) {
|
|||||||
let fd = wasi::path_open(dir_fd, 0, "file", wasi::OFLAGS_CREAT, 0, 0, 0).unwrap();
|
let fd = wasi::path_open(dir_fd, 0, "file", wasi::OFLAGS_CREAT, 0, 0, 0).unwrap();
|
||||||
wasi::fd_close(fd).unwrap();
|
wasi::fd_close(fd).unwrap();
|
||||||
|
|
||||||
// Now, repeat the same process but for a directory
|
if TESTCONFIG.support_dangling_directory() {
|
||||||
wasi::path_create_directory(dir_fd, "subdir").expect("failed to create dir");
|
// Now, repeat the same process but for a directory
|
||||||
let subdir_fd = wasi::path_open(dir_fd, 0, "subdir", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
wasi::path_create_directory(dir_fd, "subdir").expect("failed to create dir");
|
||||||
.expect("failed to open dir");
|
let subdir_fd = wasi::path_open(dir_fd, 0, "subdir", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||||
assert_gt!(
|
.expect("failed to open dir");
|
||||||
subdir_fd,
|
assert_gt!(
|
||||||
libc::STDERR_FILENO as wasi::Fd,
|
subdir_fd,
|
||||||
"file descriptor range check",
|
libc::STDERR_FILENO as wasi::Fd,
|
||||||
);
|
"file descriptor range check",
|
||||||
wasi::path_remove_directory(dir_fd, "subdir").expect("failed to remove dir 2");
|
);
|
||||||
wasi::path_create_directory(dir_fd, "subdir").expect("failed to create dir 2");
|
wasi::path_remove_directory(dir_fd, "subdir").expect("failed to remove dir 2");
|
||||||
|
wasi::path_create_directory(dir_fd, "subdir").expect("failed to create dir 2");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|||||||
@@ -11,11 +11,9 @@ unsafe fn test_remove_directory_trailing_slashes(dir_fd: wasi::Fd) {
|
|||||||
|
|
||||||
wasi::path_create_directory(dir_fd, "dir").expect("creating a directory");
|
wasi::path_create_directory(dir_fd, "dir").expect("creating a directory");
|
||||||
|
|
||||||
/* XXX disabled: this fails presently on windows and linux
|
|
||||||
// Test that removing it with a trailing slash succeeds.
|
// Test that removing it with a trailing slash succeeds.
|
||||||
wasi::path_remove_directory(dir_fd, "dir/")
|
wasi::path_remove_directory(dir_fd, "dir/")
|
||||||
.expect("remove_directory with a trailing slash on a directory should succeed");
|
.expect("remove_directory with a trailing slash on a directory should succeed");
|
||||||
*/
|
|
||||||
|
|
||||||
// Create a temporary file.
|
// Create a temporary file.
|
||||||
create_file(dir_fd, "file");
|
create_file(dir_fd, "file");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ pub struct TestConfig {
|
|||||||
no_dangling_symlinks: bool,
|
no_dangling_symlinks: bool,
|
||||||
no_fd_allocate: bool,
|
no_fd_allocate: bool,
|
||||||
no_rename_dir_to_empty_dir: bool,
|
no_rename_dir_to_empty_dir: bool,
|
||||||
|
no_dangling_directory: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ErrnoMode {
|
enum ErrnoMode {
|
||||||
@@ -23,11 +24,13 @@ impl TestConfig {
|
|||||||
let no_dangling_symlinks = std::env::var("NO_DANGLING_SYMLINKS").is_ok();
|
let no_dangling_symlinks = std::env::var("NO_DANGLING_SYMLINKS").is_ok();
|
||||||
let no_fd_allocate = std::env::var("NO_FD_ALLOCATE").is_ok();
|
let no_fd_allocate = std::env::var("NO_FD_ALLOCATE").is_ok();
|
||||||
let no_rename_dir_to_empty_dir = std::env::var("NO_RENAME_DIR_TO_EMPTY_DIR").is_ok();
|
let no_rename_dir_to_empty_dir = std::env::var("NO_RENAME_DIR_TO_EMPTY_DIR").is_ok();
|
||||||
|
let no_dangling_directory = std::env::var("NO_DANGLING_DIRECTORY").is_ok();
|
||||||
TestConfig {
|
TestConfig {
|
||||||
errno_mode,
|
errno_mode,
|
||||||
no_dangling_symlinks,
|
no_dangling_symlinks,
|
||||||
no_fd_allocate,
|
no_fd_allocate,
|
||||||
no_rename_dir_to_empty_dir,
|
no_rename_dir_to_empty_dir,
|
||||||
|
no_dangling_directory,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn errno_expect_unix(&self) -> bool {
|
pub fn errno_expect_unix(&self) -> bool {
|
||||||
@@ -51,4 +54,7 @@ impl TestConfig {
|
|||||||
pub fn support_rename_dir_to_empty_dir(&self) -> bool {
|
pub fn support_rename_dir_to_empty_dir(&self) -> bool {
|
||||||
!self.no_rename_dir_to_empty_dir
|
!self.no_rename_dir_to_empty_dir
|
||||||
}
|
}
|
||||||
|
pub fn support_dangling_directory(&self) -> bool {
|
||||||
|
!self.no_dangling_directory
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user