Skip to content

Commit

Permalink
Fix EEXIST Error in ut_lind_fs_dir_mode Test by Removing Existing D…
Browse files Browse the repository at this point in the history
…irectories Before Creation (#30)

* fix: test case ut_lind_fs_dir_mode

* fix: cleanup the enviornment

---------

Co-authored-by: lind <[email protected]>
  • Loading branch information
ChinmayShringi and lind authored Sep 27, 2024
1 parent 28a3346 commit 215463e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tests/fs_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,15 +880,16 @@ pub mod fs_tests {
let filepath2 = "/subdirDirMode2";

let mut statdata = StatData::default();

assert_eq!(cage.mkdir_syscall(filepath1, S_IRWXA), 0);
assert_eq!(cage.stat_syscall(filepath1, &mut statdata), 0);
assert_eq!(statdata.st_mode, 0o755 | S_IFDIR as u32);

assert_eq!(cage.mkdir_syscall(filepath2, 0), 0);
assert_eq!(cage.stat_syscall(filepath2, &mut statdata), 0);
assert_eq!(statdata.st_mode, S_IFDIR as u32);

// Cleanup: Remove the directories
assert_eq!(cage.rmdir_syscall(filepath1), 0);
assert_eq!(cage.rmdir_syscall(filepath2), 0);
assert_eq!(cage.exit_syscall(libc::EXIT_SUCCESS), libc::EXIT_SUCCESS);
lindrustfinalize();
}
Expand Down

0 comments on commit 215463e

Please sign in to comment.