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() {
|
||||
|
||||
@@ -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");
|
||||
|
||||
/* XXX disabled: this fails presently on windows and linux
|
||||
// Test that removing it with a trailing slash succeeds.
|
||||
wasi::path_remove_directory(dir_fd, "dir/")
|
||||
.expect("remove_directory with a trailing slash on a directory should succeed");
|
||||
*/
|
||||
|
||||
// Create a temporary file.
|
||||
create_file(dir_fd, "file");
|
||||
|
||||
Reference in New Issue
Block a user