From 60864649c00636124db4796024ff10f26a07af65 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sun, 10 Nov 2024 17:14:19 -0600 Subject: [PATCH] fuse unit tests and fixes --- .../src/fuse_drive_create_and_open_test.cpp | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/repertory/repertory_test/src/fuse_drive_create_and_open_test.cpp b/repertory/repertory_test/src/fuse_drive_create_and_open_test.cpp index 4b16600b..983d8532 100644 --- a/repertory/repertory_test/src/fuse_drive_create_and_open_test.cpp +++ b/repertory/repertory_test/src/fuse_drive_create_and_open_test.cpp @@ -136,6 +136,39 @@ TYPED_TEST(fuse_test, create_can_open_existing_file_with_excl) { this->unlink_file_and_test(file_path); } + +TYPED_TEST(fuse_test, create_can_open_existing_file_ro) { + std::string file_name{"create_test"}; + auto file_path = this->create_file_and_test(file_name); + + auto handle = open(file_path.c_str(), O_RDONLY, ACCESSPERMS); + EXPECT_LE(1, handle); + close(handle); + + this->unlink_file_and_test(file_path); +} + +TYPED_TEST(fuse_test, create_can_open_existing_file_rw) { + std::string file_name{"create_test"}; + auto file_path = this->create_file_and_test(file_name); + + auto handle = open(file_path.c_str(), O_RDWR, ACCESSPERMS); + EXPECT_LE(1, handle); + close(handle); + + this->unlink_file_and_test(file_path); +} + +TYPED_TEST(fuse_test, create_can_open_existing_file_wo) { + std::string file_name{"create_test"}; + auto file_path = this->create_file_and_test(file_name); + + auto handle = open(file_path.c_str(), O_WRONLY, ACCESSPERMS); + EXPECT_LE(1, handle); + close(handle); + + this->unlink_file_and_test(file_path); +} } // namespace repertory #endif // !defined(_WIN32)