dangling directories are a windows thing
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use more_asserts::assert_gt;
|
||||
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) {
|
||||
// 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();
|
||||
wasi::fd_close(fd).unwrap();
|
||||
|
||||
// Now, repeat the same process but for a directory
|
||||
wasi::path_create_directory(dir_fd, "subdir").expect("failed to create dir");
|
||||
let subdir_fd = wasi::path_open(dir_fd, 0, "subdir", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||
.expect("failed to open dir");
|
||||
assert_gt!(
|
||||
subdir_fd,
|
||||
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");
|
||||
if TESTCONFIG.support_dangling_directory() {
|
||||
// Now, repeat the same process but for a directory
|
||||
wasi::path_create_directory(dir_fd, "subdir").expect("failed to create dir");
|
||||
let subdir_fd = wasi::path_open(dir_fd, 0, "subdir", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||
.expect("failed to open dir");
|
||||
assert_gt!(
|
||||
subdir_fd,
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
Reference in New Issue
Block a user