Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/fs/fusefs/lookup.cc
Show First 20 Lines • Show All 424 Lines • ▼ Show 20 Lines | TEST_F(Lookup, ok) | ||||
}))); | }))); | ||||
/* | /* | ||||
* access(2) is one of the few syscalls that will not (always) follow | * access(2) is one of the few syscalls that will not (always) follow | ||||
* up a successful VOP_LOOKUP with another VOP. | * up a successful VOP_LOOKUP with another VOP. | ||||
*/ | */ | ||||
ASSERT_EQ(0, access(FULLPATH, F_OK)) << strerror(errno); | ASSERT_EQ(0, access(FULLPATH, F_OK)) << strerror(errno); | ||||
} | } | ||||
/* | |||||
* Lookup in a subdirectory of the fuse mount. The naughty server returns the | |||||
* same inode for the child as for the parent. | |||||
*/ | |||||
TEST_F(Lookup, parent_inode) | |||||
{ | |||||
const char FULLPATH[] = "mountpoint/some_dir/some_file.txt"; | |||||
const char DIRPATH[] = "some_dir"; | |||||
const char RELPATH[] = "some_file.txt"; | |||||
uint64_t dir_ino = 2; | |||||
EXPECT_LOOKUP(FUSE_ROOT_ID, DIRPATH) | |||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { | |||||
SET_OUT_HEADER_LEN(out, entry); | |||||
out.body.entry.attr.mode = S_IFDIR | 0755; | |||||
out.body.entry.nodeid = dir_ino; | |||||
}))); | |||||
EXPECT_LOOKUP(dir_ino, RELPATH) | |||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { | |||||
SET_OUT_HEADER_LEN(out, entry); | |||||
out.body.entry.attr.mode = S_IFREG | 0644; | |||||
out.body.entry.nodeid = dir_ino; | |||||
}))); | |||||
/* | |||||
* access(2) is one of the few syscalls that will not (always) follow | |||||
* up a successful VOP_LOOKUP with another VOP. | |||||
*/ | |||||
ASSERT_EQ(-1, access(FULLPATH, F_OK)); | |||||
ASSERT_EQ(EIO, errno); | |||||
} | |||||
// Lookup in a subdirectory of the fuse mount | // Lookup in a subdirectory of the fuse mount | ||||
TEST_F(Lookup, subdir) | TEST_F(Lookup, subdir) | ||||
{ | { | ||||
const char FULLPATH[] = "mountpoint/some_dir/some_file.txt"; | const char FULLPATH[] = "mountpoint/some_dir/some_file.txt"; | ||||
const char DIRPATH[] = "some_dir"; | const char DIRPATH[] = "some_dir"; | ||||
const char RELPATH[] = "some_file.txt"; | const char RELPATH[] = "some_file.txt"; | ||||
uint64_t dir_ino = 2; | uint64_t dir_ino = 2; | ||||
uint64_t file_ino = 3; | uint64_t file_ino = 3; | ||||
▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines |