From b608a17991bb36a43bc76659cf306f740fe963b2 Mon Sep 17 00:00:00 2001 From: lind Date: Thu, 24 Oct 2024 02:20:21 +0000 Subject: [PATCH] fix: test case ut_lind_fs_rmdir_nowriteperm_child_dir --- src/tests/fs_tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tests/fs_tests.rs b/src/tests/fs_tests.rs index f2eb733..40cc239 100644 --- a/src/tests/fs_tests.rs +++ b/src/tests/fs_tests.rs @@ -2237,14 +2237,18 @@ pub mod fs_tests { //because the directory cannot be removed if it does not allow //write permission let path = "/parent_dir_nwchild/dir"; + // Remove the directory if it already exists + let _ = cage.rmdir_syscall("/parent_dir_nwchild/dir"); + let _ = cage.rmdir_syscall("/parent_dir_nwchild"); assert_eq!(cage.mkdir_syscall("/parent_dir_nwchild", S_IRWXA), 0); assert_eq!(cage.mkdir_syscall(path, S_IRWXA), 0); assert_eq!( cage.chmod_syscall(path, 0o400 | 0o040 | 0o004), 0 ); + // Clean up the directories for clean environment assert_eq!(cage.rmdir_syscall(path), 0); - + assert_eq!(cage.rmdir_syscall("/parent_dir_nwchild"), 0); assert_eq!(cage.exit_syscall(libc::EXIT_SUCCESS), libc::EXIT_SUCCESS); lindrustfinalize(); }