From 28a33465c0b6890a8e0e61c8c45ab3feac04b0f7 Mon Sep 17 00:00:00 2001 From: Chinmay Shringi <31031919+ChinmayShringi@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:45:51 -0400 Subject: [PATCH] Fix EEXIST Error in `ut_lind_fs_dir_multiple` Test by Removing Existing Directories Before Creation (#32) * fix: test case ut_lind_fs_dir_multiple * feat: updated to rmdir --------- Co-authored-by: lind --- src/tests/fs_tests.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tests/fs_tests.rs b/src/tests/fs_tests.rs index d8b0109..1e8e420 100644 --- a/src/tests/fs_tests.rs +++ b/src/tests/fs_tests.rs @@ -900,7 +900,6 @@ pub mod fs_tests { let _thelock = setup::lock_and_init(); let cage = interface::cagetable_getref(1); - assert_eq!(cage.mkdir_syscall("/subdirMultiple1", S_IRWXA), 0); assert_eq!( cage.mkdir_syscall("/subdirMultiple1/subdirMultiple2", S_IRWXA), @@ -928,7 +927,10 @@ pub mod fs_tests { 0 ); assert_eq!(statdata.st_mode, S_IFDIR as u32); - + // Cleanup: Remove the directories + assert_eq!(cage.rmdir_syscall("/subdirMultiple1/subdirMultiple2/subdirMultiple3"), 0); + assert_eq!(cage.rmdir_syscall("/subdirMultiple1/subdirMultiple2"), 0); + assert_eq!(cage.rmdir_syscall("/subdirMultiple1"), 0); assert_eq!(cage.exit_syscall(libc::EXIT_SUCCESS), libc::EXIT_SUCCESS); lindrustfinalize(); }