[Unit Test] Complete FUSE unit tests #22
This commit is contained in:
parent
9eb3e7a22d
commit
96c2f8ee1e
@ -184,17 +184,23 @@ TYPED_TEST(fuse_test, rdrw_can_append_to_file) {
|
|||||||
|
|
||||||
handle = open(file_path.c_str(), O_WRONLY | O_APPEND);
|
handle = open(file_path.c_str(), O_WRONLY | O_APPEND);
|
||||||
ASSERT_GT(handle, -1);
|
ASSERT_GT(handle, -1);
|
||||||
bytes_written = write(handle, "cow", 3U);
|
bytes_written = write(handle, "cow_", 4U);
|
||||||
|
EXPECT_EQ(3U, bytes_written);
|
||||||
|
close(handle);
|
||||||
|
|
||||||
|
handle = open(file_path.c_str(), O_WRONLY | O_APPEND);
|
||||||
|
ASSERT_GT(handle, -1);
|
||||||
|
bytes_written = write(handle, "dog", 3U);
|
||||||
EXPECT_EQ(3U, bytes_written);
|
EXPECT_EQ(3U, bytes_written);
|
||||||
close(handle);
|
close(handle);
|
||||||
|
|
||||||
handle = open(file_path.c_str(), O_RDONLY);
|
handle = open(file_path.c_str(), O_RDONLY);
|
||||||
ASSERT_GT(handle, -1);
|
ASSERT_GT(handle, -1);
|
||||||
std::string read_buffer;
|
std::string read_buffer;
|
||||||
read_buffer.resize(8U);
|
read_buffer.resize(12U);
|
||||||
auto bytes_read = pread64(handle, read_buffer.data(), read_buffer.size(), 0);
|
auto bytes_read = pread64(handle, read_buffer.data(), read_buffer.size(), 0);
|
||||||
EXPECT_EQ(8U, bytes_read);
|
EXPECT_EQ(12U, bytes_read);
|
||||||
EXPECT_STREQ("test_cow", read_buffer.c_str());
|
EXPECT_STREQ("test_cow_dog", read_buffer.c_str());
|
||||||
close(handle);
|
close(handle);
|
||||||
|
|
||||||
this->unlink_file_and_test(file_path);
|
this->unlink_file_and_test(file_path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user