fuse unit tests and fixes
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
80d8d6f32f
commit
ee695eb738
@ -469,6 +469,139 @@ TYPED_TEST(fuse_test, create_fails_with_excl_if_path_is_directory) {
|
||||
|
||||
this->rmdir_and_test(dir_path);
|
||||
}
|
||||
|
||||
// 4. O_CREAT | O_APPEND-Failure: ENOENT (No such file or directory) if the
|
||||
// parent directory doesn’t exist.
|
||||
TYPED_TEST(fuse_test, create_fails_with_append_if_parent_does_not_exist) {
|
||||
std::string file_name{"no_dir/create_test"};
|
||||
auto file_path = this->create_file_path(file_name);
|
||||
|
||||
auto handle = open(file_path.c_str(), O_CREAT | O_APPEND, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(ENOENT, errno);
|
||||
}
|
||||
|
||||
// 4. O_CREAT | O_APPEND-Failure: EISDIR (Is a directory) if a directory exists
|
||||
// instead of a file.
|
||||
TYPED_TEST(fuse_test, create_fails_with_append_if_path_is_directory) {
|
||||
std::string dir_name{"create_test"};
|
||||
auto dir_path = this->create_directory_and_test(dir_name);
|
||||
|
||||
auto handle = open(dir_path.c_str(), O_CREAT | O_APPEND, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(EISDIR, errno);
|
||||
|
||||
this->rmdir_and_test(dir_path);
|
||||
}
|
||||
|
||||
// 5. O_CREAT | O_RDWR-Failure: ENOENT (No such file or directory) if the
|
||||
// parent directory doesn’t exist.
|
||||
TYPED_TEST(fuse_test, create_fails_with_rdrw_if_parent_does_not_exist) {
|
||||
std::string file_name{"no_dir/create_test"};
|
||||
auto file_path = this->create_file_path(file_name);
|
||||
|
||||
auto handle = open(file_path.c_str(), O_CREAT | O_RDWR, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(ENOENT, errno);
|
||||
}
|
||||
|
||||
// 5. O_CREAT | O_RDWR-Failure: EISDIR (Is a directory) if a directory exists
|
||||
// instead of a file.
|
||||
TYPED_TEST(fuse_test, create_fails_with_rdrw_if_path_is_directory) {
|
||||
std::string dir_name{"create_test"};
|
||||
auto dir_path = this->create_directory_and_test(dir_name);
|
||||
|
||||
auto handle = open(dir_path.c_str(), O_CREAT | O_RDWR, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(EISDIR, errno);
|
||||
|
||||
this->rmdir_and_test(dir_path);
|
||||
}
|
||||
|
||||
// 6. O_CREAT | O_WRONLY-Failure: ENOENT (No such file or directory) if the
|
||||
// parent directory doesn’t exist.
|
||||
TYPED_TEST(fuse_test, create_fails_with_wo_if_parent_does_not_exist) {
|
||||
std::string file_name{"no_dir/create_test"};
|
||||
auto file_path = this->create_file_path(file_name);
|
||||
|
||||
auto handle = open(file_path.c_str(), O_CREAT | O_WRONLY, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(ENOENT, errno);
|
||||
}
|
||||
|
||||
// 6. O_CREAT | O_WRONLY-Failure: EISDIR (Is a directory) if a directory exists
|
||||
// instead of a file.
|
||||
TYPED_TEST(fuse_test, create_fails_with_wo_if_path_is_directory) {
|
||||
std::string dir_name{"create_test"};
|
||||
auto dir_path = this->create_directory_and_test(dir_name);
|
||||
|
||||
auto handle = open(dir_path.c_str(), O_CREAT | O_WRONLY, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(EISDIR, errno);
|
||||
|
||||
this->rmdir_and_test(dir_path);
|
||||
}
|
||||
|
||||
// 7. O_CREAT | O_TRUNC | O_WRONLY-Failure: ENOENT (No such file or directory)
|
||||
// if the parent directory doesn’t exist.
|
||||
TYPED_TEST(fuse_test, create_fails_with_trunc_wo_if_parent_does_not_exist) {
|
||||
std::string file_name{"no_dir/create_test"};
|
||||
auto file_path = this->create_file_path(file_name);
|
||||
|
||||
auto handle =
|
||||
open(file_path.c_str(), O_CREAT | O_TRUNC | O_WRONLY, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(ENOENT, errno);
|
||||
}
|
||||
|
||||
// 7. O_CREAT | O_TRUNC | O_WRONLY-Failure: EISDIR (Is a directory) if a
|
||||
// directory exists instead of a file.
|
||||
TYPED_TEST(fuse_test, create_fails_with_trunc_wo_if_path_is_directory) {
|
||||
std::string dir_name{"create_test"};
|
||||
auto dir_path = this->create_directory_and_test(dir_name);
|
||||
|
||||
auto handle =
|
||||
open(dir_path.c_str(), O_CREAT | O_TRUNC | O_WRONLY, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(EISDIR, errno);
|
||||
|
||||
this->rmdir_and_test(dir_path);
|
||||
}
|
||||
|
||||
// 8. O_CREAT | O_TRUNC | O_RDWR-Failure: ENOENT (No such file or directory)
|
||||
// if the parent directory doesn’t exist.
|
||||
TYPED_TEST(fuse_test, create_fails_with_trunc_rw_if_parent_does_not_exist) {
|
||||
std::string file_name{"no_dir/create_test"};
|
||||
auto file_path = this->create_file_path(file_name);
|
||||
|
||||
auto handle =
|
||||
open(file_path.c_str(), O_CREAT | O_TRUNC | O_RDWR, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(ENOENT, errno);
|
||||
}
|
||||
|
||||
// 8. O_CREAT | O_TRUNC | O_RDWR-Failure: EISDIR (Is a directory) if a
|
||||
// directory exists instead of a file.
|
||||
TYPED_TEST(fuse_test, create_fails_with_trunc_rw_if_path_is_directory) {
|
||||
std::string dir_name{"create_test"};
|
||||
auto dir_path = this->create_directory_and_test(dir_name);
|
||||
|
||||
auto handle = open(dir_path.c_str(), O_CREAT | O_TRUNC | O_RDWR, ACCESSPERMS);
|
||||
EXPECT_EQ(-1, handle);
|
||||
|
||||
EXPECT_EQ(EISDIR, errno);
|
||||
|
||||
this->rmdir_and_test(dir_path);
|
||||
}
|
||||
} // namespace repertory
|
||||
|
||||
#endif // !defined(_WIN32)
|
||||
|
Loading…
x
Reference in New Issue
Block a user