fuse unit tests and fixes

This commit is contained in:
Scott E. Graves 2024-11-10 17:21:57 -06:00
parent 60864649c0
commit 074a026d64

View File

@ -71,6 +71,50 @@ TYPED_TEST(fuse_test, create_can_create_file) {
this->unlink_file_and_test(file_path);
}
TYPED_TEST(fuse_test, create_can_create_file_ro) {
std::string file_name{"create_test"};
auto file_path = this->create_file_path(file_name);
auto handle = open(file_path.c_str(), O_CREAT | O_RDONLY, ACCESSPERMS);
EXPECT_LE(1, handle);
close(handle);
this->unlink_file_and_test(file_path);
}
TYPED_TEST(fuse_test, create_can_create_file_rw) {
std::string file_name{"create_test"};
auto file_path = this->create_file_path(file_name);
auto handle = open(file_path.c_str(), O_CREAT | O_RDWR, ACCESSPERMS);
EXPECT_LE(1, handle);
close(handle);
this->unlink_file_and_test(file_path);
}
TYPED_TEST(fuse_test, create_can_create_file_wo) {
std::string file_name{"create_test"};
auto file_path = this->create_file_path(file_name);
auto handle = open(file_path.c_str(), O_CREAT | O_WRONLY, ACCESSPERMS);
EXPECT_LE(1, handle);
close(handle);
this->unlink_file_and_test(file_path);
}
TYPED_TEST(fuse_test, create_can_create_file_for_append) {
std::string file_name{"create_test"};
auto file_path = this->create_file_path(file_name);
auto handle = open(file_path.c_str(), O_CREAT | O_APPEND, ACCESSPERMS);
EXPECT_LE(1, handle);
close(handle);
this->unlink_file_and_test(file_path);
}
TYPED_TEST(fuse_test, create_can_create_with_truncate_file) {
std::string file_name{"create_test"};
auto file_path = this->create_file_path(file_name);
@ -169,6 +213,17 @@ TYPED_TEST(fuse_test, create_can_open_existing_file_wo) {
this->unlink_file_and_test(file_path);
}
TYPED_TEST(fuse_test, create_can_open_existing_file_for_append) {
std::string file_name{"create_test"};
auto file_path = this->create_file_and_test(file_name);
auto handle = open(file_path.c_str(), O_APPEND, ACCESSPERMS);
EXPECT_LE(1, handle);
close(handle);
this->unlink_file_and_test(file_path);
}
} // namespace repertory
#endif // !defined(_WIN32)