diff --git a/tests/rust/src/bin/dangling_fd.rs b/tests/rust/src/bin/dangling_fd.rs index 3d29c4fc..fbadc595 100644 --- a/tests/rust/src/bin/dangling_fd.rs +++ b/tests/rust/src/bin/dangling_fd.rs @@ -5,27 +5,29 @@ unsafe fn test_dangling_fd(dir_fd: wasi::Fd) { if TESTCONFIG.support_dangling_filesystem() { // Create a file, open it, delete it without closing the handle, // and then try creating it again - 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.cleanup", wasi::OFLAGS_CREAT, 0, 0, 0).unwrap(); wasi::fd_close(fd).unwrap(); - let file_fd = wasi::path_open(dir_fd, 0, "file", 0, 0, 0, 0).expect("failed to open"); + let file_fd = + wasi::path_open(dir_fd, 0, "file.cleanup", 0, 0, 0, 0).expect("failed to open"); assert!( file_fd > libc::STDERR_FILENO as wasi::Fd, "file descriptor range check", ); - wasi::path_unlink_file(dir_fd, "file").expect("failed to unlink"); - let fd = wasi::path_open(dir_fd, 0, "file", wasi::OFLAGS_CREAT, 0, 0, 0).unwrap(); + wasi::path_unlink_file(dir_fd, "file.cleanup").expect("failed to unlink"); + let fd = wasi::path_open(dir_fd, 0, "file.cleanup", 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"); + wasi::path_create_directory(dir_fd, "subdir.cleanup").expect("failed to create dir"); + let subdir_fd = + wasi::path_open(dir_fd, 0, "subdir.cleanup", wasi::OFLAGS_DIRECTORY, 0, 0, 0) + .expect("failed to open dir"); assert!( 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"); + wasi::path_remove_directory(dir_fd, "subdir.cleanup").expect("failed to remove dir 2"); + wasi::path_create_directory(dir_fd, "subdir.cleanup").expect("failed to create dir 2"); } } diff --git a/tests/rust/src/bin/dangling_symlink.rs b/tests/rust/src/bin/dangling_symlink.rs index bfc9095d..771078f5 100644 --- a/tests/rust/src/bin/dangling_symlink.rs +++ b/tests/rust/src/bin/dangling_symlink.rs @@ -4,11 +4,11 @@ use wasi_tests::{assert_errno, open_scratch_directory, TESTCONFIG}; unsafe fn test_dangling_symlink(dir_fd: wasi::Fd) { if TESTCONFIG.support_dangling_filesystem() { // First create a dangling symlink. - wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink"); + wasi::path_symlink("target", dir_fd, "symlink.cleanup").expect("creating a symlink"); // Try to open it as a directory with O_NOFOLLOW. assert_errno!( - wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0) + wasi::path_open(dir_fd, 0, "symlink.cleanup", wasi::OFLAGS_DIRECTORY, 0, 0, 0) .expect_err("opening a dangling symlink as a directory") .raw_error(), wasi::ERRNO_NOTDIR, @@ -17,14 +17,14 @@ unsafe fn test_dangling_symlink(dir_fd: wasi::Fd) { // Try to open it as a file with O_NOFOLLOW. assert_errno!( - wasi::path_open(dir_fd, 0, "symlink", 0, 0, 0, 0) + wasi::path_open(dir_fd, 0, "symlink.cleanup", 0, 0, 0, 0) .expect_err("opening a dangling symlink as a file") .raw_error(), wasi::ERRNO_LOOP ); // Clean up. - wasi::path_unlink_file(dir_fd, "symlink").expect("failed to remove file"); + wasi::path_unlink_file(dir_fd, "symlink.cleanup").expect("failed to remove file"); } }