fusefs: prefer FUSE_ROOT_ID to literal 1 in the tests
Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
a4856c96d0
commit
a34cdd26d0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/fuse2/; revision=348469
@ -62,7 +62,7 @@ TEST_F(Access, eaccess)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
mode_t access_mode = X_OK;
|
mode_t access_mode = X_OK;
|
||||||
|
|
||||||
expect_access(1, X_OK, 0);
|
expect_access(FUSE_ROOT_ID, X_OK, 0);
|
||||||
expect_lookup(RELPATH, ino);
|
expect_lookup(RELPATH, ino);
|
||||||
expect_access(ino, access_mode, EACCES);
|
expect_access(ino, access_mode, EACCES);
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ TEST_F(Access, enosys)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
mode_t access_mode = R_OK;
|
mode_t access_mode = R_OK;
|
||||||
|
|
||||||
expect_access(1, X_OK, ENOSYS);
|
expect_access(FUSE_ROOT_ID, X_OK, ENOSYS);
|
||||||
FuseTest::expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 2);
|
FuseTest::expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 2);
|
||||||
|
|
||||||
ASSERT_EQ(0, access(FULLPATH, access_mode)) << strerror(errno);
|
ASSERT_EQ(0, access(FULLPATH, access_mode)) << strerror(errno);
|
||||||
@ -96,7 +96,7 @@ TEST_F(RofsAccess, erofs)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
mode_t access_mode = W_OK;
|
mode_t access_mode = W_OK;
|
||||||
|
|
||||||
expect_access(1, X_OK, 0);
|
expect_access(FUSE_ROOT_ID, X_OK, 0);
|
||||||
expect_lookup(RELPATH, ino);
|
expect_lookup(RELPATH, ino);
|
||||||
|
|
||||||
ASSERT_NE(0, access(FULLPATH, access_mode));
|
ASSERT_NE(0, access(FULLPATH, access_mode));
|
||||||
@ -111,7 +111,7 @@ TEST_F(Access, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
mode_t access_mode = R_OK;
|
mode_t access_mode = R_OK;
|
||||||
|
|
||||||
expect_access(1, X_OK, 0);
|
expect_access(FUSE_ROOT_ID, X_OK, 0);
|
||||||
expect_lookup(RELPATH, ino);
|
expect_lookup(RELPATH, ino);
|
||||||
expect_access(ino, access_mode, 0);
|
expect_access(ino, access_mode, 0);
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ TEST_F(NoAllowOther, setextattr)
|
|||||||
int ino = 42, status;
|
int ino = 42, status;
|
||||||
|
|
||||||
fork(true, &status, [&] {
|
fork(true, &status, [&] {
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(
|
.WillOnce(Invoke(
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
|
@ -121,7 +121,8 @@ TEST_F(Create, attr_cache)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode,
|
expect_create(RELPATH, mode,
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, create);
|
SET_OUT_HEADER_LEN(out, create);
|
||||||
@ -154,17 +155,18 @@ TEST_F(Create, clear_attr_cache)
|
|||||||
int fd;
|
int fd;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
return (in.header.opcode == FUSE_GETATTR &&
|
return (in.header.opcode == FUSE_GETATTR &&
|
||||||
in.header.nodeid == 1);
|
in.header.nodeid == FUSE_ROOT_ID);
|
||||||
}, Eq(true)),
|
}, Eq(true)),
|
||||||
_)
|
_)
|
||||||
).Times(2)
|
).Times(2)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, attr);
|
SET_OUT_HEADER_LEN(out, attr);
|
||||||
out.body.attr.attr.ino = 1;
|
out.body.attr.attr.ino = FUSE_ROOT_ID;
|
||||||
out.body.attr.attr.mode = S_IFDIR | 0755;
|
out.body.attr.attr.mode = S_IFDIR | 0755;
|
||||||
out.body.attr.attr_valid = UINT64_MAX;
|
out.body.attr.attr_valid = UINT64_MAX;
|
||||||
})));
|
})));
|
||||||
@ -197,7 +199,8 @@ TEST_F(Create, eexist)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
mode_t mode = S_IFREG | 0755;
|
mode_t mode = S_IFREG | 0755;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode, ReturnErrno(EEXIST));
|
expect_create(RELPATH, mode, ReturnErrno(EEXIST));
|
||||||
EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
|
EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
|
||||||
EXPECT_EQ(EEXIST, errno);
|
EXPECT_EQ(EEXIST, errno);
|
||||||
@ -215,7 +218,8 @@ TEST_F(Create, Enosys)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode, ReturnErrno(ENOSYS));
|
expect_create(RELPATH, mode, ReturnErrno(ENOSYS));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
@ -270,7 +274,8 @@ TEST_F(Create, entry_cache_negative)
|
|||||||
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = 0};
|
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = 0};
|
||||||
|
|
||||||
/* create will first do a LOOKUP, adding a negative cache entry */
|
/* create will first do a LOOKUP, adding a negative cache entry */
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(ReturnNegativeCache(&entry_valid));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(ReturnNegativeCache(&entry_valid));
|
||||||
expect_create(RELPATH, mode,
|
expect_create(RELPATH, mode,
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, create);
|
SET_OUT_HEADER_LEN(out, create);
|
||||||
@ -298,8 +303,8 @@ TEST_F(Create, entry_cache_negative_purge)
|
|||||||
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
||||||
|
|
||||||
/* create will first do a LOOKUP, adding a negative cache entry */
|
/* create will first do a LOOKUP, adding a negative cache entry */
|
||||||
EXPECT_LOOKUP(1, RELPATH).Times(1)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH).Times(1)
|
||||||
.WillOnce(Invoke(ReturnNegativeCache(&entry_valid)))
|
.WillOnce(Invoke(ReturnNegativeCache(&entry_valid)))
|
||||||
.RetiresOnSaturation();
|
.RetiresOnSaturation();
|
||||||
|
|
||||||
/* Then the CREATE should purge the negative cache entry */
|
/* Then the CREATE should purge the negative cache entry */
|
||||||
@ -331,7 +336,8 @@ TEST_F(Create, eperm)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
mode_t mode = S_IFREG | 0755;
|
mode_t mode = S_IFREG | 0755;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode, ReturnErrno(EPERM));
|
expect_create(RELPATH, mode, ReturnErrno(EPERM));
|
||||||
|
|
||||||
EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
|
EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
|
||||||
@ -346,7 +352,8 @@ TEST_F(Create, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode,
|
expect_create(RELPATH, mode,
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, create);
|
SET_OUT_HEADER_LEN(out, create);
|
||||||
@ -377,7 +384,8 @@ TEST_F(Create, wronly_0444)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode,
|
expect_create(RELPATH, mode,
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, create);
|
SET_OUT_HEADER_LEN(out, create);
|
||||||
@ -400,7 +408,8 @@ TEST_F(Create_7_8, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode,
|
expect_create(RELPATH, mode,
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, create_7_8);
|
SET_OUT_HEADER_LEN(out, create_7_8);
|
||||||
@ -423,7 +432,8 @@ TEST_F(Create_7_11, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, mode,
|
expect_create(RELPATH, mode,
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, create);
|
SET_OUT_HEADER_LEN(out, create);
|
||||||
|
@ -252,7 +252,7 @@ TEST_F(Access, eacces)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
mode_t access_mode = X_OK;
|
mode_t access_mode = X_OK;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
|
|
||||||
ASSERT_NE(0, access(FULLPATH, access_mode));
|
ASSERT_NE(0, access(FULLPATH, access_mode));
|
||||||
@ -266,7 +266,7 @@ TEST_F(Access, eacces_no_cached_attrs)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
mode_t access_mode = X_OK;
|
mode_t access_mode = X_OK;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, 0, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, 0, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, 0);
|
||||||
expect_getattr(ino, S_IFREG | 0644, 0, 1);
|
expect_getattr(ino, S_IFREG | 0644, 0, 1);
|
||||||
/*
|
/*
|
||||||
@ -286,7 +286,7 @@ TEST_F(Access, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
mode_t access_mode = R_OK;
|
mode_t access_mode = R_OK;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
/*
|
/*
|
||||||
* Once default_permissions is properly implemented, there might be
|
* Once default_permissions is properly implemented, there might be
|
||||||
@ -307,7 +307,7 @@ TEST_F(Chown, chown_to_self)
|
|||||||
|
|
||||||
uid = geteuid();
|
uid = geteuid();
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1, uid);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1, uid);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid);
|
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid);
|
||||||
/* The OS may optimize chown by omitting the redundant setattr */
|
/* The OS may optimize chown by omitting the redundant setattr */
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
@ -338,7 +338,7 @@ TEST_F(Chown, clear_suid)
|
|||||||
uid_t uid = geteuid();
|
uid_t uid = geteuid();
|
||||||
uint32_t valid = FATTR_UID | FATTR_MODE;
|
uint32_t valid = FATTR_UID | FATTR_MODE;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1, uid);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1, uid);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, uid);
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, uid);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -367,7 +367,7 @@ TEST_F(Chown, eperm)
|
|||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
const mode_t mode = 0755;
|
const mode_t mode = 0755;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1, geteuid());
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1, geteuid());
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, geteuid());
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -395,7 +395,7 @@ TEST_F(Chgrp, clear_suid)
|
|||||||
gid_t gid = getegid();
|
gid_t gid = getegid();
|
||||||
uint32_t valid = FATTR_GID | FATTR_MODE;
|
uint32_t valid = FATTR_GID | FATTR_MODE;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1, uid);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1, uid);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, uid, gid);
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, uid, gid);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -429,7 +429,7 @@ TEST_F(Chgrp, eperm)
|
|||||||
gid = getegid();
|
gid = getegid();
|
||||||
newgid = excluded_group();
|
newgid = excluded_group();
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1, uid, gid);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1, uid, gid);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid, gid);
|
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid, gid);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -455,7 +455,7 @@ TEST_F(Chgrp, ok)
|
|||||||
gid = 0;
|
gid = 0;
|
||||||
newgid = getegid();
|
newgid = getegid();
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1, uid, gid);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1, uid, gid);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid, gid);
|
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid, gid);
|
||||||
/* The OS may optimize chgrp by omitting the redundant setattr */
|
/* The OS may optimize chgrp by omitting the redundant setattr */
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
@ -481,8 +481,9 @@ TEST_F(Create, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, ino);
|
expect_create(RELPATH, ino);
|
||||||
|
|
||||||
fd = open(FULLPATH, O_CREAT | O_EXCL, 0644);
|
fd = open(FULLPATH, O_CREAT | O_EXCL, 0644);
|
||||||
@ -495,8 +496,9 @@ TEST_F(Create, eacces)
|
|||||||
const char FULLPATH[] = "mountpoint/some_file.txt";
|
const char FULLPATH[] = "mountpoint/some_file.txt";
|
||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, 0644));
|
EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, 0644));
|
||||||
EXPECT_EQ(EACCES, errno);
|
EXPECT_EQ(EACCES, errno);
|
||||||
@ -509,7 +511,7 @@ TEST_F(Deleteextattr, eacces)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
||||||
|
|
||||||
ASSERT_EQ(-1, extattr_delete_file(FULLPATH, ns, "foo"));
|
ASSERT_EQ(-1, extattr_delete_file(FULLPATH, ns, "foo"));
|
||||||
@ -523,7 +525,7 @@ TEST_F(Deleteextattr, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
||||||
expect_removexattr();
|
expect_removexattr();
|
||||||
|
|
||||||
@ -539,7 +541,7 @@ TEST_F(Deleteextattr, system)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, geteuid());
|
||||||
|
|
||||||
ASSERT_EQ(-1, extattr_delete_file(FULLPATH, ns, "foo"));
|
ASSERT_EQ(-1, extattr_delete_file(FULLPATH, ns, "foo"));
|
||||||
@ -560,7 +562,7 @@ TEST_F(Utimensat, utime_now)
|
|||||||
{.tv_sec = 0, .tv_nsec = UTIME_NOW},
|
{.tv_sec = 0, .tv_nsec = UTIME_NOW},
|
||||||
};
|
};
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, owner);
|
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, owner);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -593,7 +595,7 @@ TEST_F(Utimensat, utime_omit)
|
|||||||
{.tv_sec = 0, .tv_nsec = UTIME_OMIT},
|
{.tv_sec = 0, .tv_nsec = UTIME_OMIT},
|
||||||
};
|
};
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, owner);
|
expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, owner);
|
||||||
|
|
||||||
ASSERT_EQ(0, utimensat(AT_FDCWD, FULLPATH, ×[0], 0))
|
ASSERT_EQ(0, utimensat(AT_FDCWD, FULLPATH, ×[0], 0))
|
||||||
@ -608,7 +610,7 @@ TEST_F(Deleteextattr, user)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, 0);
|
||||||
expect_removexattr();
|
expect_removexattr();
|
||||||
|
|
||||||
@ -624,7 +626,7 @@ TEST_F(Getextattr, eacces)
|
|||||||
char data[80];
|
char data[80];
|
||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0600, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0600, UINT64_MAX, 0);
|
||||||
|
|
||||||
ASSERT_EQ(-1,
|
ASSERT_EQ(-1,
|
||||||
@ -643,7 +645,7 @@ TEST_F(Getextattr, ok)
|
|||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
/* Getting user attributes only requires read access */
|
/* Getting user attributes only requires read access */
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0444, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0444, UINT64_MAX, 0);
|
||||||
expect_getxattr(
|
expect_getxattr(
|
||||||
@ -667,7 +669,7 @@ TEST_F(Getextattr, system)
|
|||||||
char data[80];
|
char data[80];
|
||||||
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, geteuid());
|
||||||
|
|
||||||
ASSERT_EQ(-1,
|
ASSERT_EQ(-1,
|
||||||
@ -682,7 +684,7 @@ TEST_F(Listextattr, eacces)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0600, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0600, UINT64_MAX, 0);
|
||||||
|
|
||||||
ASSERT_EQ(-1, extattr_list_file(FULLPATH, ns, NULL, 0));
|
ASSERT_EQ(-1, extattr_list_file(FULLPATH, ns, NULL, 0));
|
||||||
@ -696,7 +698,7 @@ TEST_F(Listextattr, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
|
||||||
/* Listing user extended attributes merely requires read access */
|
/* Listing user extended attributes merely requires read access */
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
||||||
expect_listxattr();
|
expect_listxattr();
|
||||||
@ -713,7 +715,7 @@ TEST_F(Listextattr, system)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
|
||||||
/* Listing user extended attributes merely requires read access */
|
/* Listing user extended attributes merely requires read access */
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
||||||
|
|
||||||
@ -728,7 +730,7 @@ TEST_F(Lookup, eacces)
|
|||||||
const char RELDIRPATH[] = "some_dir";
|
const char RELDIRPATH[] = "some_dir";
|
||||||
uint64_t dir_ino = 42;
|
uint64_t dir_ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELDIRPATH, dir_ino, S_IFDIR | 0700, UINT64_MAX, 0);
|
expect_lookup(RELDIRPATH, dir_ino, S_IFDIR | 0700, UINT64_MAX, 0);
|
||||||
|
|
||||||
EXPECT_EQ(-1, access(FULLPATH, F_OK));
|
EXPECT_EQ(-1, access(FULLPATH, F_OK));
|
||||||
@ -741,7 +743,7 @@ TEST_F(Open, eacces)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
|
|
||||||
EXPECT_NE(0, open(FULLPATH, O_RDWR));
|
EXPECT_NE(0, open(FULLPATH, O_RDWR));
|
||||||
@ -755,7 +757,7 @@ TEST_F(Open, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
expect_open(ino, 0, 1);
|
expect_open(ino, 0, 1);
|
||||||
|
|
||||||
@ -772,9 +774,9 @@ TEST_F(Rename, eacces_on_srcdir)
|
|||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
EXPECT_LOOKUP(1, RELDST)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
.Times(AnyNumber())
|
.Times(AnyNumber())
|
||||||
.WillRepeatedly(Invoke(ReturnErrno(ENOENT)));
|
.WillRepeatedly(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
@ -792,7 +794,7 @@ TEST_F(Rename, eacces_on_dstdir_for_creating)
|
|||||||
uint64_t src_ino = 42;
|
uint64_t src_ino = 42;
|
||||||
uint64_t dstdir_ino = 43;
|
uint64_t dstdir_ino = 43;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, src_ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELSRC, src_ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 0755, UINT64_MAX);
|
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 0755, UINT64_MAX);
|
||||||
EXPECT_LOOKUP(dstdir_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(dstdir_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
@ -811,7 +813,7 @@ TEST_F(Rename, eacces_on_dstdir_for_removing)
|
|||||||
uint64_t src_ino = 42;
|
uint64_t src_ino = 42;
|
||||||
uint64_t dstdir_ino = 43;
|
uint64_t dstdir_ino = 43;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, src_ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELSRC, src_ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 0755, UINT64_MAX);
|
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 0755, UINT64_MAX);
|
||||||
EXPECT_LOOKUP(dstdir_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(dstdir_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
@ -827,7 +829,7 @@ TEST_F(Rename, eperm_on_sticky_srcdir)
|
|||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 01777, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 01777, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
|
|
||||||
ASSERT_EQ(-1, rename(FULLSRC, FULLDST));
|
ASSERT_EQ(-1, rename(FULLSRC, FULLDST));
|
||||||
@ -848,7 +850,7 @@ TEST_F(Rename, eperm_for_subdirectory)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
uint64_t dstdir_ino = 43;
|
uint64_t dstdir_ino = 43;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, ino, S_IFDIR | 0755, UINT64_MAX, 0);
|
expect_lookup(RELSRC, ino, S_IFDIR | 0755, UINT64_MAX, 0);
|
||||||
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 0777, UINT64_MAX, 0);
|
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 0777, UINT64_MAX, 0);
|
||||||
EXPECT_LOOKUP(dstdir_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(dstdir_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
@ -869,9 +871,10 @@ TEST_F(Rename, subdirectory_to_same_dir)
|
|||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, ino, S_IFDIR | 0755, UINT64_MAX, 0);
|
expect_lookup(RELSRC, ino, S_IFDIR | 0755, UINT64_MAX, 0);
|
||||||
EXPECT_LOOKUP(1, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_rename(0);
|
expect_rename(0);
|
||||||
|
|
||||||
ASSERT_EQ(0, rename(FULLSRC, FULLDST)) << strerror(errno);
|
ASSERT_EQ(0, rename(FULLSRC, FULLDST)) << strerror(errno);
|
||||||
@ -888,7 +891,7 @@ TEST_F(Rename, eperm_on_sticky_dstdir)
|
|||||||
uint64_t dstdir_ino = 43;
|
uint64_t dstdir_ino = 43;
|
||||||
uint64_t dst_ino = 44;
|
uint64_t dst_ino = 44;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, src_ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELSRC, src_ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 01777, UINT64_MAX);
|
expect_lookup(RELDSTDIR, dstdir_ino, S_IFDIR | 01777, UINT64_MAX);
|
||||||
EXPECT_LOOKUP(dstdir_ino, RELDST)
|
EXPECT_LOOKUP(dstdir_ino, RELDST)
|
||||||
@ -916,7 +919,7 @@ TEST_F(Rename, ok)
|
|||||||
uint64_t dst_ino = 2;
|
uint64_t dst_ino = 2;
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1, geteuid());
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1, geteuid());
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
expect_lookup(RELDST, dst_ino, S_IFREG | 0644, UINT64_MAX);
|
expect_lookup(RELDST, dst_ino, S_IFREG | 0644, UINT64_MAX);
|
||||||
expect_rename(0);
|
expect_rename(0);
|
||||||
@ -932,9 +935,10 @@ TEST_F(Rename, ok_to_remove_src_because_of_stickiness)
|
|||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 01777, UINT64_MAX, 1, 0);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 01777, UINT64_MAX, 1, 0);
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
||||||
EXPECT_LOOKUP(1, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_rename(0);
|
expect_rename(0);
|
||||||
|
|
||||||
ASSERT_EQ(0, rename(FULLSRC, FULLDST)) << strerror(errno);
|
ASSERT_EQ(0, rename(FULLSRC, FULLDST)) << strerror(errno);
|
||||||
@ -948,7 +952,7 @@ TEST_F(Setattr, ok)
|
|||||||
const mode_t oldmode = 0755;
|
const mode_t oldmode = 0755;
|
||||||
const mode_t newmode = 0644;
|
const mode_t newmode = 0644;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, geteuid());
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -973,7 +977,7 @@ TEST_F(Setattr, eacces)
|
|||||||
const mode_t oldmode = 0755;
|
const mode_t oldmode = 0755;
|
||||||
const mode_t newmode = 0644;
|
const mode_t newmode = 0644;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, 0);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -999,8 +1003,9 @@ TEST_F(Setattr, ftruncate_of_newly_created_file)
|
|||||||
const mode_t mode = 0000;
|
const mode_t mode = 0000;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_create(RELPATH, ino);
|
expect_create(RELPATH, ino);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -1036,7 +1041,7 @@ TEST_F(Setattr, sgid_by_non_group_member)
|
|||||||
uid_t uid = geteuid();
|
uid_t uid = geteuid();
|
||||||
gid_t gid = excluded_group();
|
gid_t gid = excluded_group();
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, uid, gid);
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, uid, gid);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -1058,7 +1063,7 @@ TEST_F(Setattr, sticky_regular_file)
|
|||||||
const mode_t oldmode = 0644;
|
const mode_t oldmode = 0644;
|
||||||
const mode_t newmode = 01644;
|
const mode_t newmode = 01644;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX, geteuid());
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([](auto in) {
|
ResultOf([](auto in) {
|
||||||
@ -1081,7 +1086,7 @@ TEST_F(Setextattr, ok)
|
|||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
||||||
expect_setxattr(0);
|
expect_setxattr(0);
|
||||||
|
|
||||||
@ -1098,7 +1103,7 @@ TEST_F(Setextattr, eacces)
|
|||||||
ssize_t value_len = strlen(value) + 1;
|
ssize_t value_len = strlen(value) + 1;
|
||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
||||||
|
|
||||||
ASSERT_EQ(-1,
|
ASSERT_EQ(-1,
|
||||||
@ -1116,7 +1121,7 @@ TEST_F(Setextattr, system)
|
|||||||
ssize_t value_len = strlen(value) + 1;
|
ssize_t value_len = strlen(value) + 1;
|
||||||
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
int ns = EXTATTR_NAMESPACE_SYSTEM;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, geteuid());
|
||||||
|
|
||||||
ASSERT_EQ(-1,
|
ASSERT_EQ(-1,
|
||||||
@ -1135,7 +1140,7 @@ TEST_F(Setextattr, user)
|
|||||||
int ns = EXTATTR_NAMESPACE_USER;
|
int ns = EXTATTR_NAMESPACE_USER;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, 0);
|
||||||
expect_setxattr(0);
|
expect_setxattr(0);
|
||||||
|
|
||||||
@ -1149,9 +1154,9 @@ TEST_F(Unlink, ok)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0777, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
||||||
expect_unlink(1, RELPATH, 0);
|
expect_unlink(FUSE_ROOT_ID, RELPATH, 0);
|
||||||
|
|
||||||
ASSERT_EQ(0, unlink(FULLPATH)) << strerror(errno);
|
ASSERT_EQ(0, unlink(FULLPATH)) << strerror(errno);
|
||||||
}
|
}
|
||||||
@ -1169,8 +1174,8 @@ TEST_F(Unlink, cached_unwritable_directory)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.Times(AnyNumber())
|
.Times(AnyNumber())
|
||||||
.WillRepeatedly(Invoke(
|
.WillRepeatedly(Invoke(
|
||||||
ReturnImmediate([=](auto i __unused, auto& out) {
|
ReturnImmediate([=](auto i __unused, auto& out) {
|
||||||
@ -1194,7 +1199,7 @@ TEST_F(Unlink, unwritable_directory)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
|
||||||
|
|
||||||
ASSERT_EQ(-1, unlink(FULLPATH));
|
ASSERT_EQ(-1, unlink(FULLPATH));
|
||||||
@ -1207,7 +1212,7 @@ TEST_F(Unlink, sticky_directory)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 01777, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 01777, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0);
|
||||||
|
|
||||||
ASSERT_EQ(-1, unlink(FULLPATH));
|
ASSERT_EQ(-1, unlink(FULLPATH));
|
||||||
@ -1226,7 +1231,7 @@ TEST_F(Write, clear_suid)
|
|||||||
char wbuf[1] = {'x'};
|
char wbuf[1] = {'x'};
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX);
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX);
|
||||||
expect_open(ino, 0, 1);
|
expect_open(ino, 0, 1);
|
||||||
expect_write(ino, 0, sizeof(wbuf), sizeof(wbuf), 0, 0, wbuf);
|
expect_write(ino, 0, sizeof(wbuf), sizeof(wbuf), 0, 0, wbuf);
|
||||||
@ -1252,7 +1257,7 @@ TEST_F(Write, clear_sgid)
|
|||||||
char wbuf[1] = {'x'};
|
char wbuf[1] = {'x'};
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX);
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX);
|
||||||
expect_open(ino, 0, 1);
|
expect_open(ino, 0, 1);
|
||||||
expect_write(ino, 0, sizeof(wbuf), sizeof(wbuf), 0, 0, wbuf);
|
expect_write(ino, 0, sizeof(wbuf), sizeof(wbuf), 0, 0, wbuf);
|
||||||
@ -1282,7 +1287,7 @@ TEST_F(Write, recursion_panic_while_clearing_suid)
|
|||||||
char wbuf[1] = {'x'};
|
char wbuf[1] = {'x'};
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755, UINT64_MAX, 1);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX);
|
expect_lookup(RELPATH, ino, S_IFREG | oldmode, UINT64_MAX);
|
||||||
expect_open(ino, 0, 1);
|
expect_open(ino, 0, 1);
|
||||||
expect_write(ino, 0, sizeof(wbuf), sizeof(wbuf), 0, 0, wbuf);
|
expect_write(ino, 0, sizeof(wbuf), sizeof(wbuf), 0, 0, wbuf);
|
||||||
|
@ -48,7 +48,7 @@ TEST_F(Destroy, ok)
|
|||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 2);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 2);
|
||||||
expect_forget(1, 1);
|
expect_forget(FUSE_ROOT_ID, 1);
|
||||||
expect_forget(ino, 2);
|
expect_forget(ino, 2);
|
||||||
expect_destroy(0);
|
expect_destroy(0);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class Kqueue: public FuseTest {
|
|||||||
|
|
||||||
TEST_P(DevFusePoll, access)
|
TEST_P(DevFusePoll, access)
|
||||||
{
|
{
|
||||||
expect_access(1, X_OK, 0);
|
expect_access(FUSE_ROOT_ID, X_OK, 0);
|
||||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1);
|
expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1);
|
||||||
expect_access(ino, access_mode, 0);
|
expect_access(ino, access_mode, 0);
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ TEST_P(DevFusePoll, access)
|
|||||||
/* Ensure that we wake up pollers during unmount */
|
/* Ensure that we wake up pollers during unmount */
|
||||||
TEST_P(DevFusePoll, destroy)
|
TEST_P(DevFusePoll, destroy)
|
||||||
{
|
{
|
||||||
expect_forget(1, 1);
|
expect_forget(FUSE_ROOT_ID, 1);
|
||||||
expect_destroy(0);
|
expect_destroy(0);
|
||||||
|
|
||||||
m_mock->unmount();
|
m_mock->unmount();
|
||||||
@ -126,21 +126,21 @@ TEST_F(Kqueue, data)
|
|||||||
ASSERT_EQ(0, sem_init(&sem0, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem0, 0, 0)) << strerror(errno);
|
||||||
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, "foo")
|
EXPECT_LOOKUP(FUSE_ROOT_ID, "foo")
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.entry_valid = UINT64_MAX;
|
out.body.entry.entry_valid = UINT64_MAX;
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
out.body.entry.nodeid = foo_ino;
|
out.body.entry.nodeid = foo_ino;
|
||||||
})));
|
})));
|
||||||
EXPECT_LOOKUP(1, "bar")
|
EXPECT_LOOKUP(FUSE_ROOT_ID, "bar")
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.entry_valid = UINT64_MAX;
|
out.body.entry.entry_valid = UINT64_MAX;
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
out.body.entry.nodeid = bar_ino;
|
out.body.entry.nodeid = bar_ino;
|
||||||
})));
|
})));
|
||||||
EXPECT_LOOKUP(1, "baz")
|
EXPECT_LOOKUP(FUSE_ROOT_ID, "baz")
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.entry_valid = UINT64_MAX;
|
out.body.entry.entry_valid = UINT64_MAX;
|
||||||
|
@ -156,7 +156,8 @@ TEST_F(Socket, read_write)
|
|||||||
int fd, connected;
|
int fd, connected;
|
||||||
Sequence seq;
|
Sequence seq;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
return (in.header.opcode == FUSE_MKNOD);
|
return (in.header.opcode == FUSE_MKNOD);
|
||||||
@ -171,7 +172,7 @@ TEST_F(Socket, read_write)
|
|||||||
out.body.entry.attr_valid = UINT64_MAX;
|
out.body.entry.attr_valid = UINT64_MAX;
|
||||||
})));
|
})));
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.InSequence(seq)
|
.InSequence(seq)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
void expect_lookup(const char *relpath, uint64_t ino, mode_t mode,
|
void expect_lookup(const char *relpath, uint64_t ino, mode_t mode,
|
||||||
uint64_t size, int times, uint64_t attr_valid, uint32_t attr_valid_nsec)
|
uint64_t size, int times, uint64_t attr_valid, uint32_t attr_valid_nsec)
|
||||||
{
|
{
|
||||||
EXPECT_LOOKUP(1, relpath)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, relpath)
|
||||||
.Times(times)
|
.Times(times)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
@ -76,7 +76,7 @@ TEST_F(Getattr, attr_cache)
|
|||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -247,7 +247,7 @@ TEST_F(Getattr_7_8, ok)
|
|||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry_7_8);
|
SET_OUT_HEADER_LEN(out, entry_7_8);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
|
@ -222,7 +222,7 @@ TEST_F(Interrupt, already_complete)
|
|||||||
|
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
.InSequence(seq)
|
.InSequence(seq)
|
||||||
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_mkdir(&mkdir_unique);
|
expect_mkdir(&mkdir_unique);
|
||||||
@ -248,7 +248,7 @@ TEST_F(Interrupt, already_complete)
|
|||||||
out1->header.len = sizeof(out1->header);
|
out1->header.len = sizeof(out1->header);
|
||||||
out.push_back(std::move(out1));
|
out.push_back(std::move(out1));
|
||||||
}));
|
}));
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
.InSequence(seq)
|
.InSequence(seq)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
@ -284,8 +284,10 @@ TEST_F(Interrupt, enosys)
|
|||||||
ASSERT_EQ(0, sem_init(&sem0, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem0, 0, 0)) << strerror(errno);
|
||||||
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH1).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH1)
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_mkdir(&mkdir_unique);
|
expect_mkdir(&mkdir_unique);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([&](auto in) {
|
ResultOf([&](auto in) {
|
||||||
@ -363,7 +365,8 @@ TEST_F(Interrupt, fatal_signal)
|
|||||||
ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno);
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_mkdir(&mkdir_unique);
|
expect_mkdir(&mkdir_unique);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([&](auto in) {
|
ResultOf([&](auto in) {
|
||||||
@ -420,7 +423,8 @@ TEST_F(Interrupt, ignore)
|
|||||||
|
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_mkdir(&mkdir_unique);
|
expect_mkdir(&mkdir_unique);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([&](auto in) {
|
ResultOf([&](auto in) {
|
||||||
@ -461,7 +465,8 @@ TEST_F(Interrupt, in_kernel_restartable)
|
|||||||
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_lookup(RELPATH1, ino1);
|
expect_lookup(RELPATH1, ino1);
|
||||||
expect_open(ino1, 0, 1);
|
expect_open(ino1, 0, 1);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
@ -534,7 +539,8 @@ TEST_F(Interrupt, in_kernel_nonrestartable)
|
|||||||
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_lookup(RELPATH1, ino1);
|
expect_lookup(RELPATH1, ino1);
|
||||||
expect_open(ino1, 0, 1);
|
expect_open(ino1, 0, 1);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
@ -593,7 +599,8 @@ TEST_F(Interrupt, in_progress)
|
|||||||
|
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_mkdir(&mkdir_unique);
|
expect_mkdir(&mkdir_unique);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([&](auto in) {
|
ResultOf([&](auto in) {
|
||||||
@ -666,8 +673,10 @@ TEST_F(Interrupt, priority)
|
|||||||
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno);
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH1).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH1)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
return (in.header.opcode == FUSE_MKDIR);
|
return (in.header.opcode == FUSE_MKDIR);
|
||||||
@ -746,7 +755,8 @@ TEST_F(Interrupt, too_soon)
|
|||||||
|
|
||||||
self = pthread_self();
|
self = pthread_self();
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_mkdir(&mkdir_unique);
|
expect_mkdir(&mkdir_unique);
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
|
@ -114,22 +114,24 @@ TEST_F(Link, clear_attr_cache)
|
|||||||
mode_t mode = S_IFREG | 0644;
|
mode_t mode = S_IFREG | 0644;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
return (in.header.opcode == FUSE_GETATTR &&
|
return (in.header.opcode == FUSE_GETATTR &&
|
||||||
in.header.nodeid == 1);
|
in.header.nodeid == FUSE_ROOT_ID);
|
||||||
}, Eq(true)),
|
}, Eq(true)),
|
||||||
_)
|
_)
|
||||||
).Times(2)
|
).Times(2)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, attr);
|
SET_OUT_HEADER_LEN(out, attr);
|
||||||
out.body.attr.attr.ino = 1;
|
out.body.attr.attr.ino = FUSE_ROOT_ID;
|
||||||
out.body.attr.attr.mode = S_IFDIR | 0755;
|
out.body.attr.attr.mode = S_IFDIR | 0755;
|
||||||
out.body.attr.attr_valid = UINT64_MAX;
|
out.body.attr.attr_valid = UINT64_MAX;
|
||||||
})));
|
})));
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDST)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
|
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = mode;
|
out.body.entry.attr.mode = mode;
|
||||||
@ -153,7 +155,8 @@ TEST_F(Link, emlink)
|
|||||||
const char RELDST[] = "dst";
|
const char RELDST[] = "dst";
|
||||||
uint64_t dst_ino = 42;
|
uint64_t dst_ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_lookup(RELDST, dst_ino);
|
expect_lookup(RELDST, dst_ino);
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
@ -181,8 +184,9 @@ TEST_F(Link, ok)
|
|||||||
mode_t mode = S_IFREG | 0644;
|
mode_t mode = S_IFREG | 0644;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
EXPECT_LOOKUP(1, RELDST)
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = mode;
|
out.body.entry.attr.mode = mode;
|
||||||
@ -209,8 +213,9 @@ TEST_F(Link_7_8, ok)
|
|||||||
mode_t mode = S_IFREG | 0644;
|
mode_t mode = S_IFREG | 0644;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
EXPECT_LOOKUP(1, RELDST)
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry_7_8);
|
SET_OUT_HEADER_LEN(out, entry_7_8);
|
||||||
out.body.entry.attr.mode = mode;
|
out.body.entry.attr.mode = mode;
|
||||||
|
@ -58,7 +58,7 @@ TEST_F(Lookup, attr_cache)
|
|||||||
const uint64_t generation = 13;
|
const uint64_t generation = 13;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.nodeid = ino;
|
out.body.entry.nodeid = ino;
|
||||||
@ -118,7 +118,7 @@ TEST_F(Lookup, attr_cache_timeout)
|
|||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.Times(2)
|
.Times(2)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
@ -142,7 +142,7 @@ TEST_F(Lookup, dot)
|
|||||||
const char RELDIRPATH[] = "some_dir";
|
const char RELDIRPATH[] = "some_dir";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFDIR | 0755;
|
out.body.entry.attr.mode = S_IFDIR | 0755;
|
||||||
@ -163,7 +163,7 @@ TEST_F(Lookup, dotdot)
|
|||||||
const char FULLPATH[] = "mountpoint/some_dir/..";
|
const char FULLPATH[] = "mountpoint/some_dir/..";
|
||||||
const char RELDIRPATH[] = "some_dir";
|
const char RELDIRPATH[] = "some_dir";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFDIR | 0755;
|
out.body.entry.attr.mode = S_IFDIR | 0755;
|
||||||
@ -184,7 +184,8 @@ TEST_F(Lookup, enoent)
|
|||||||
const char FULLPATH[] = "mountpoint/does_not_exist";
|
const char FULLPATH[] = "mountpoint/does_not_exist";
|
||||||
const char RELPATH[] = "does_not_exist";
|
const char RELPATH[] = "does_not_exist";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
EXPECT_NE(0, access(FULLPATH, F_OK));
|
EXPECT_NE(0, access(FULLPATH, F_OK));
|
||||||
EXPECT_EQ(ENOENT, errno);
|
EXPECT_EQ(ENOENT, errno);
|
||||||
}
|
}
|
||||||
@ -194,7 +195,7 @@ TEST_F(Lookup, enotdir)
|
|||||||
const char FULLPATH[] = "mountpoint/not_a_dir/some_file.txt";
|
const char FULLPATH[] = "mountpoint/not_a_dir/some_file.txt";
|
||||||
const char RELPATH[] = "not_a_dir";
|
const char RELPATH[] = "not_a_dir";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.entry_valid = UINT64_MAX;
|
out.body.entry.entry_valid = UINT64_MAX;
|
||||||
@ -215,7 +216,7 @@ TEST_F(Lookup, entry_cache)
|
|||||||
const char FULLPATH[] = "mountpoint/some_file.txt";
|
const char FULLPATH[] = "mountpoint/some_file.txt";
|
||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.entry_valid = UINT64_MAX;
|
out.body.entry.entry_valid = UINT64_MAX;
|
||||||
@ -235,7 +236,8 @@ TEST_F(Lookup, entry_cache_negative)
|
|||||||
{
|
{
|
||||||
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, "does_not_exist").Times(1)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, "does_not_exist")
|
||||||
|
.Times(1)
|
||||||
.WillOnce(Invoke(ReturnNegativeCache(&entry_valid)));
|
.WillOnce(Invoke(ReturnNegativeCache(&entry_valid)));
|
||||||
|
|
||||||
EXPECT_NE(0, access("mountpoint/does_not_exist", F_OK));
|
EXPECT_NE(0, access("mountpoint/does_not_exist", F_OK));
|
||||||
@ -251,7 +253,8 @@ TEST_F(Lookup, entry_cache_negative_timeout)
|
|||||||
const char *FULLPATH = "mountpoint/does_not_exist";
|
const char *FULLPATH = "mountpoint/does_not_exist";
|
||||||
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = NAP_NS / 2};
|
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = NAP_NS / 2};
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).Times(2)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.Times(2)
|
||||||
.WillRepeatedly(Invoke(ReturnNegativeCache(&entry_valid)));
|
.WillRepeatedly(Invoke(ReturnNegativeCache(&entry_valid)));
|
||||||
|
|
||||||
EXPECT_NE(0, access(FULLPATH, F_OK));
|
EXPECT_NE(0, access(FULLPATH, F_OK));
|
||||||
@ -273,7 +276,7 @@ TEST_F(Lookup, entry_cache_timeout)
|
|||||||
const char FULLPATH[] = "mountpoint/some_file.txt";
|
const char FULLPATH[] = "mountpoint/some_file.txt";
|
||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.Times(2)
|
.Times(2)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
@ -296,7 +299,7 @@ TEST_F(Lookup, ok)
|
|||||||
const char FULLPATH[] = "mountpoint/some_file.txt";
|
const char FULLPATH[] = "mountpoint/some_file.txt";
|
||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -318,7 +321,7 @@ TEST_F(Lookup, subdir)
|
|||||||
uint64_t dir_ino = 2;
|
uint64_t dir_ino = 2;
|
||||||
uint64_t file_ino = 3;
|
uint64_t file_ino = 3;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, DIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, DIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFDIR | 0755;
|
out.body.entry.attr.mode = S_IFDIR | 0755;
|
||||||
@ -362,7 +365,7 @@ TEST_F(Lookup_7_8, ok)
|
|||||||
const char FULLPATH[] = "mountpoint/some_file.txt";
|
const char FULLPATH[] = "mountpoint/some_file.txt";
|
||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry_7_8);
|
SET_OUT_HEADER_LEN(out, entry_7_8);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
|
@ -56,7 +56,8 @@ TEST_F(Mkdir, emlink)
|
|||||||
const char RELPATH[] = "some_dir";
|
const char RELPATH[] = "some_dir";
|
||||||
mode_t mode = 0755;
|
mode_t mode = 0755;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -90,7 +91,8 @@ TEST_F(Mkdir, entry_cache_negative)
|
|||||||
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = 0};
|
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = 0};
|
||||||
|
|
||||||
/* mkdir will first do a LOOKUP, adding a negative cache entry */
|
/* mkdir will first do a LOOKUP, adding a negative cache entry */
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(ReturnNegativeCache(&entry_valid));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(ReturnNegativeCache(&entry_valid));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -124,7 +126,8 @@ TEST_F(Mkdir, entry_cache_negative_purge)
|
|||||||
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
||||||
|
|
||||||
/* mkdir will first do a LOOKUP, adding a negative cache entry */
|
/* mkdir will first do a LOOKUP, adding a negative cache entry */
|
||||||
EXPECT_LOOKUP(1, RELPATH).Times(1)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.Times(1)
|
||||||
.WillOnce(Invoke(ReturnNegativeCache(&entry_valid)))
|
.WillOnce(Invoke(ReturnNegativeCache(&entry_valid)))
|
||||||
.RetiresOnSaturation();
|
.RetiresOnSaturation();
|
||||||
|
|
||||||
@ -164,7 +167,8 @@ TEST_F(Mkdir, ok)
|
|||||||
mask = umask(0);
|
mask = umask(0);
|
||||||
(void)umask(mask);
|
(void)umask(mask);
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -194,7 +198,8 @@ TEST_F(Mkdir_7_8, ok)
|
|||||||
mode_t mode = 0755;
|
mode_t mode = 0755;
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
|
@ -71,7 +71,8 @@ virtual void TearDown() {
|
|||||||
void expect_mknod(mode_t mode, dev_t dev) {
|
void expect_mknod(mode_t mode, dev_t dev) {
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -115,7 +116,8 @@ void expect_lookup(const char *relpath, uint64_t ino, uint64_t size)
|
|||||||
void expect_mknod(mode_t mode, dev_t dev) {
|
void expect_mknod(mode_t mode, dev_t dev) {
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -168,7 +170,8 @@ TEST_F(Mknod, eperm)
|
|||||||
{
|
{
|
||||||
mode_t mode = S_IFIFO | 0755;
|
mode_t mode = S_IFIFO | 0755;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
|
@ -78,7 +78,7 @@ TEST_F(Fhstat, estale)
|
|||||||
const mode_t mode = S_IFDIR | 0755;
|
const mode_t mode = S_IFDIR | 0755;
|
||||||
Sequence seq;
|
Sequence seq;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.InSequence(seq)
|
.InSequence(seq)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
@ -116,7 +116,7 @@ TEST_F(Fhstat, lookup_dot)
|
|||||||
const mode_t mode = S_IFDIR | 0755;
|
const mode_t mode = S_IFDIR | 0755;
|
||||||
const uid_t uid = 12345;
|
const uid_t uid = 12345;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = mode;
|
out.body.entry.attr.mode = mode;
|
||||||
@ -159,7 +159,7 @@ TEST_F(Fhstat, DISABLED_cached)
|
|||||||
const mode_t mode = S_IFDIR | 0755;
|
const mode_t mode = S_IFDIR | 0755;
|
||||||
const uid_t uid = 12345;
|
const uid_t uid = 12345;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = mode;
|
out.body.entry.attr.mode = mode;
|
||||||
@ -188,7 +188,7 @@ TEST_F(FhstatNotExportable, lookup_dot)
|
|||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
const mode_t mode = S_IFDIR | 0755;
|
const mode_t mode = S_IFDIR | 0755;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = mode;
|
out.body.entry.attr.mode = mode;
|
||||||
@ -210,7 +210,7 @@ TEST_F(Getfh, eoverflow)
|
|||||||
fhandle_t fhp;
|
fhandle_t fhp;
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFDIR | 0755;
|
out.body.entry.attr.mode = S_IFDIR | 0755;
|
||||||
@ -232,7 +232,7 @@ TEST_F(Getfh, ok)
|
|||||||
fhandle_t fhp;
|
fhandle_t fhp;
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELDIRPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFDIR | 0755;
|
out.body.entry.attr.mode = S_IFDIR | 0755;
|
||||||
@ -263,7 +263,7 @@ TEST_F(Readdir, getdirentries)
|
|||||||
char buf[8192];
|
char buf[8192];
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = mode;
|
out.body.entry.attr.mode = mode;
|
||||||
|
@ -79,7 +79,7 @@ TEST_F(Open, chr)
|
|||||||
const char RELPATH[] = "zero";
|
const char RELPATH[] = "zero";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFCHR | 0644;
|
out.body.entry.attr.mode = S_IFCHR | 0644;
|
||||||
|
@ -80,7 +80,7 @@ TEST_F(Rename, einval)
|
|||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
uint64_t src_ino = 42;
|
uint64_t src_ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELSRC, src_ino, S_IFDIR | 0755, 0, 2);
|
expect_lookup(RELSRC, src_ino, S_IFDIR | 0755, 0, 2);
|
||||||
EXPECT_LOOKUP(src_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(src_ino, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
@ -96,7 +96,8 @@ TEST_F(Rename, enoent)
|
|||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
// FUSE hardcodes the mountpoint to inode 1
|
// FUSE hardcodes the mountpoint to inode 1
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELSRC).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELSRC)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
ASSERT_NE(0, rename(FULLSRC, FULLDST));
|
ASSERT_NE(0, rename(FULLSRC, FULLDST));
|
||||||
ASSERT_EQ(ENOENT, errno);
|
ASSERT_EQ(ENOENT, errno);
|
||||||
@ -111,8 +112,7 @@ TEST_F(Rename, entry_cache_negative)
|
|||||||
const char RELDST[] = "dst";
|
const char RELDST[] = "dst";
|
||||||
const char FULLSRC[] = "mountpoint/src";
|
const char FULLSRC[] = "mountpoint/src";
|
||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
// FUSE hardcodes the mountpoint to inode 1
|
uint64_t dst_dir_ino = FUSE_ROOT_ID;
|
||||||
uint64_t dst_dir_ino = 1;
|
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
/*
|
/*
|
||||||
* Set entry_valid = 0 because this test isn't concerned with whether
|
* Set entry_valid = 0 because this test isn't concerned with whether
|
||||||
@ -121,10 +121,11 @@ TEST_F(Rename, entry_cache_negative)
|
|||||||
*/
|
*/
|
||||||
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = 0};
|
struct timespec entry_valid = {.tv_sec = 0, .tv_nsec = 0};
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
||||||
/* LOOKUP returns a negative cache entry for dst */
|
/* LOOKUP returns a negative cache entry for dst */
|
||||||
EXPECT_LOOKUP(1, RELDST).WillOnce(ReturnNegativeCache(&entry_valid));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
|
.WillOnce(ReturnNegativeCache(&entry_valid));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -151,15 +152,15 @@ TEST_F(Rename, entry_cache_negative_purge)
|
|||||||
const char RELDST[] = "dst";
|
const char RELDST[] = "dst";
|
||||||
const char FULLSRC[] = "mountpoint/src";
|
const char FULLSRC[] = "mountpoint/src";
|
||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
// FUSE hardcodes the mountpoint to inode 1
|
uint64_t dst_dir_ino = FUSE_ROOT_ID;
|
||||||
uint64_t dst_dir_ino = 1;
|
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
struct timespec entry_valid = {.tv_sec = TIME_T_MAX, .tv_nsec = 0};
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
||||||
/* LOOKUP returns a negative cache entry for dst */
|
/* LOOKUP returns a negative cache entry for dst */
|
||||||
EXPECT_LOOKUP(1, RELDST).WillOnce(ReturnNegativeCache(&entry_valid))
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
|
.WillOnce(ReturnNegativeCache(&entry_valid))
|
||||||
.RetiresOnSaturation();
|
.RetiresOnSaturation();
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
@ -193,7 +194,7 @@ TEST_F(Rename, exdev)
|
|||||||
tmpfd = mkstemp(tmpfile);
|
tmpfd = mkstemp(tmpfile);
|
||||||
ASSERT_LE(0, tmpfd) << strerror(errno);
|
ASSERT_LE(0, tmpfd) << strerror(errno);
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELB, b_ino, S_IFREG | 0644, 0, 2);
|
expect_lookup(RELB, b_ino, S_IFREG | 0644, 0, 2);
|
||||||
|
|
||||||
ASSERT_NE(0, rename(tmpfile, FULLB));
|
ASSERT_NE(0, rename(tmpfile, FULLB));
|
||||||
@ -209,13 +210,13 @@ TEST_F(Rename, ok)
|
|||||||
const char RELDST[] = "dst";
|
const char RELDST[] = "dst";
|
||||||
const char FULLSRC[] = "mountpoint/src";
|
const char FULLSRC[] = "mountpoint/src";
|
||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
// FUSE hardcodes the mountpoint to inode 1
|
uint64_t dst_dir_ino = FUSE_ROOT_ID;
|
||||||
uint64_t dst_dir_ino = 1;
|
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
||||||
EXPECT_LOOKUP(1, RELDST).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDST)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -248,8 +249,8 @@ TEST_F(Rename, parent)
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
expect_lookup(RELSRC, ino, S_IFDIR | 0755, 0, 1);
|
expect_lookup(RELSRC, ino, S_IFDIR | 0755, 0, 1);
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
EXPECT_LOOKUP(1, RELDSTDIR)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELDSTDIR)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.nodeid = dst_dir_ino;
|
out.body.entry.nodeid = dst_dir_ino;
|
||||||
@ -297,11 +298,10 @@ TEST_F(Rename, overwrite)
|
|||||||
const char RELSRC[] = "src";
|
const char RELSRC[] = "src";
|
||||||
// The inode of the already-existing destination file
|
// The inode of the already-existing destination file
|
||||||
uint64_t dst_ino = 2;
|
uint64_t dst_ino = 2;
|
||||||
// FUSE hardcodes the mountpoint to inode 1
|
uint64_t dst_dir_ino = FUSE_ROOT_ID;
|
||||||
uint64_t dst_dir_ino = 1;
|
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
expect_lookup(RELSRC, ino, S_IFREG | 0644, 0, 1);
|
||||||
expect_lookup(RELDST, dst_ino, S_IFREG | 0644, 0, 1);
|
expect_lookup(RELDST, dst_ino, S_IFREG | 0644, 0, 1);
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
|
@ -57,7 +57,7 @@ void expect_getattr(uint64_t ino, mode_t mode)
|
|||||||
|
|
||||||
void expect_lookup(const char *relpath, uint64_t ino)
|
void expect_lookup(const char *relpath, uint64_t ino)
|
||||||
{
|
{
|
||||||
EXPECT_LOOKUP(1, relpath)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, relpath)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFDIR | 0755;
|
out.body.entry.attr.mode = S_IFDIR | 0755;
|
||||||
@ -93,7 +93,7 @@ TEST_F(Rmdir, clear_attr_cache)
|
|||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
return (in.header.opcode == FUSE_GETATTR &&
|
return (in.header.opcode == FUSE_GETATTR &&
|
||||||
in.header.nodeid == 1);
|
in.header.nodeid == FUSE_ROOT_ID);
|
||||||
}, Eq(true)),
|
}, Eq(true)),
|
||||||
_)
|
_)
|
||||||
).Times(2)
|
).Times(2)
|
||||||
@ -104,7 +104,7 @@ TEST_F(Rmdir, clear_attr_cache)
|
|||||||
out.body.attr.attr_valid = UINT64_MAX;
|
out.body.attr.attr_valid = UINT64_MAX;
|
||||||
})));
|
})));
|
||||||
expect_lookup(RELPATH, ino);
|
expect_lookup(RELPATH, ino);
|
||||||
expect_rmdir(1, RELPATH, 0);
|
expect_rmdir(FUSE_ROOT_ID, RELPATH, 0);
|
||||||
|
|
||||||
ASSERT_EQ(0, rmdir(FULLPATH)) << strerror(errno);
|
ASSERT_EQ(0, rmdir(FULLPATH)) << strerror(errno);
|
||||||
EXPECT_EQ(0, stat("mountpoint", &sb)) << strerror(errno);
|
EXPECT_EQ(0, stat("mountpoint", &sb)) << strerror(errno);
|
||||||
@ -116,9 +116,9 @@ TEST_F(Rmdir, enotempty)
|
|||||||
const char RELPATH[] = "some_dir";
|
const char RELPATH[] = "some_dir";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELPATH, ino);
|
expect_lookup(RELPATH, ino);
|
||||||
expect_rmdir(1, RELPATH, ENOTEMPTY);
|
expect_rmdir(FUSE_ROOT_ID, RELPATH, ENOTEMPTY);
|
||||||
|
|
||||||
ASSERT_NE(0, rmdir(FULLPATH));
|
ASSERT_NE(0, rmdir(FULLPATH));
|
||||||
ASSERT_EQ(ENOTEMPTY, errno);
|
ASSERT_EQ(ENOTEMPTY, errno);
|
||||||
@ -130,9 +130,9 @@ TEST_F(Rmdir, ok)
|
|||||||
const char RELPATH[] = "some_dir";
|
const char RELPATH[] = "some_dir";
|
||||||
uint64_t ino = 42;
|
uint64_t ino = 42;
|
||||||
|
|
||||||
expect_getattr(1, S_IFDIR | 0755);
|
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755);
|
||||||
expect_lookup(RELPATH, ino);
|
expect_lookup(RELPATH, ino);
|
||||||
expect_rmdir(1, RELPATH, 0);
|
expect_rmdir(FUSE_ROOT_ID, RELPATH, 0);
|
||||||
|
|
||||||
ASSERT_EQ(0, rmdir(FULLPATH)) << strerror(errno);
|
ASSERT_EQ(0, rmdir(FULLPATH)) << strerror(errno);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ TEST_F(Setattr, attr_cache)
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
const mode_t newmode = 0644;
|
const mode_t newmode = 0644;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -114,7 +114,7 @@ TEST_F(Setattr, chmod)
|
|||||||
const mode_t oldmode = 0755;
|
const mode_t oldmode = 0755;
|
||||||
const mode_t newmode = 0644;
|
const mode_t newmode = 0644;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | oldmode;
|
out.body.entry.attr.mode = S_IFREG | oldmode;
|
||||||
@ -154,7 +154,7 @@ TEST_F(Setattr, chmod_multiply_linked)
|
|||||||
const mode_t oldmode = 0777;
|
const mode_t oldmode = 0777;
|
||||||
const mode_t newmode = 0666;
|
const mode_t newmode = 0666;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH0)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH0)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | oldmode;
|
out.body.entry.attr.mode = S_IFREG | oldmode;
|
||||||
@ -164,7 +164,7 @@ TEST_F(Setattr, chmod_multiply_linked)
|
|||||||
out.body.entry.entry_valid = UINT64_MAX;
|
out.body.entry.entry_valid = UINT64_MAX;
|
||||||
})));
|
})));
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH1)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH1)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | oldmode;
|
out.body.entry.attr.mode = S_IFREG | oldmode;
|
||||||
@ -214,7 +214,7 @@ TEST_F(Setattr, chown)
|
|||||||
const uid_t olduser = 33;
|
const uid_t olduser = 33;
|
||||||
const uid_t newuser = 44;
|
const uid_t newuser = 44;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -257,7 +257,7 @@ TEST_F(Setattr, eperm)
|
|||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0777;
|
out.body.entry.attr.mode = S_IFREG | 0777;
|
||||||
@ -287,7 +287,7 @@ TEST_F(Setattr, fchmod)
|
|||||||
const mode_t oldmode = 0755;
|
const mode_t oldmode = 0755;
|
||||||
const mode_t newmode = 0644;
|
const mode_t newmode = 0644;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | oldmode;
|
out.body.entry.attr.mode = S_IFREG | oldmode;
|
||||||
@ -339,7 +339,7 @@ TEST_F(Setattr, ftruncate)
|
|||||||
const off_t oldsize = 99;
|
const off_t oldsize = 99;
|
||||||
const off_t newsize = 12345;
|
const off_t newsize = 12345;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0755;
|
out.body.entry.attr.mode = S_IFREG | 0755;
|
||||||
@ -391,7 +391,7 @@ TEST_F(Setattr, truncate) {
|
|||||||
const uint64_t oldsize = 100'000'000;
|
const uint64_t oldsize = 100'000'000;
|
||||||
const uint64_t newsize = 20'000'000;
|
const uint64_t newsize = 20'000'000;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -574,7 +574,7 @@ TEST_F(Setattr, utimensat) {
|
|||||||
{.tv_sec = 7, .tv_nsec = 8},
|
{.tv_sec = 7, .tv_nsec = 8},
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -628,7 +628,7 @@ TEST_F(Setattr, utimensat_mtime_only) {
|
|||||||
{.tv_sec = 7, .tv_nsec = 8},
|
{.tv_sec = 7, .tv_nsec = 8},
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -690,7 +690,7 @@ TEST_F(Setattr, utimensat_utime_now) {
|
|||||||
};
|
};
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | 0644;
|
out.body.entry.attr.mode = S_IFREG | 0644;
|
||||||
@ -741,7 +741,7 @@ TEST_F(RofsSetattr, erofs)
|
|||||||
const mode_t oldmode = 0755;
|
const mode_t oldmode = 0755;
|
||||||
const mode_t newmode = 0644;
|
const mode_t newmode = 0644;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry);
|
SET_OUT_HEADER_LEN(out, entry);
|
||||||
out.body.entry.attr.mode = S_IFREG | oldmode;
|
out.body.entry.attr.mode = S_IFREG | oldmode;
|
||||||
@ -761,7 +761,7 @@ TEST_F(Setattr_7_8, chmod)
|
|||||||
const mode_t oldmode = 0755;
|
const mode_t oldmode = 0755;
|
||||||
const mode_t newmode = 0644;
|
const mode_t newmode = 0644;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, entry_7_8);
|
SET_OUT_HEADER_LEN(out, entry_7_8);
|
||||||
out.body.entry.attr.mode = S_IFREG | oldmode;
|
out.body.entry.attr.mode = S_IFREG | oldmode;
|
||||||
|
@ -103,17 +103,18 @@ TEST_F(Symlink, clear_attr_cache)
|
|||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
return (in.header.opcode == FUSE_GETATTR &&
|
return (in.header.opcode == FUSE_GETATTR &&
|
||||||
in.header.nodeid == 1);
|
in.header.nodeid == FUSE_ROOT_ID);
|
||||||
}, Eq(true)),
|
}, Eq(true)),
|
||||||
_)
|
_)
|
||||||
).Times(2)
|
).Times(2)
|
||||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
|
||||||
SET_OUT_HEADER_LEN(out, attr);
|
SET_OUT_HEADER_LEN(out, attr);
|
||||||
out.body.attr.attr.ino = 1;
|
out.body.attr.attr.ino = FUSE_ROOT_ID;
|
||||||
out.body.attr.attr.mode = S_IFDIR | 0755;
|
out.body.attr.attr.mode = S_IFDIR | 0755;
|
||||||
out.body.attr.attr_valid = UINT64_MAX;
|
out.body.attr.attr_valid = UINT64_MAX;
|
||||||
})));
|
})));
|
||||||
@ -130,7 +131,8 @@ TEST_F(Symlink, enospc)
|
|||||||
const char RELPATH[] = "lnk";
|
const char RELPATH[] = "lnk";
|
||||||
const char dst[] = "dst";
|
const char dst[] = "dst";
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
|
|
||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
@ -154,7 +156,8 @@ TEST_F(Symlink, ok)
|
|||||||
const char dst[] = "dst";
|
const char dst[] = "dst";
|
||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_symlink(ino, dst, RELPATH);
|
expect_symlink(ino, dst, RELPATH);
|
||||||
|
|
||||||
EXPECT_EQ(0, symlink(dst, FULLPATH)) << strerror(errno);
|
EXPECT_EQ(0, symlink(dst, FULLPATH)) << strerror(errno);
|
||||||
@ -167,7 +170,8 @@ TEST_F(Symlink_7_8, ok)
|
|||||||
const char dst[] = "dst";
|
const char dst[] = "dst";
|
||||||
const uint64_t ino = 42;
|
const uint64_t ino = 42;
|
||||||
|
|
||||||
EXPECT_LOOKUP(1, RELPATH).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
|
||||||
|
.WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||||
expect_symlink(ino, dst, RELPATH);
|
expect_symlink(ino, dst, RELPATH);
|
||||||
|
|
||||||
EXPECT_EQ(0, symlink(dst, FULLPATH)) << strerror(errno);
|
EXPECT_EQ(0, symlink(dst, FULLPATH)) << strerror(errno);
|
||||||
|
@ -75,7 +75,7 @@ TEST_F(Unlink, clear_attr_cache)
|
|||||||
EXPECT_CALL(*m_mock, process(
|
EXPECT_CALL(*m_mock, process(
|
||||||
ResultOf([=](auto in) {
|
ResultOf([=](auto in) {
|
||||||
return (in.header.opcode == FUSE_GETATTR &&
|
return (in.header.opcode == FUSE_GETATTR &&
|
||||||
in.header.nodeid == 1);
|
in.header.nodeid == FUSE_ROOT_ID);
|
||||||
}, Eq(true)),
|
}, Eq(true)),
|
||||||
_)
|
_)
|
||||||
).Times(2)
|
).Times(2)
|
||||||
|
@ -196,7 +196,7 @@ void FuseTest::expect_getattr(uint64_t ino, uint64_t size)
|
|||||||
void FuseTest::expect_lookup(const char *relpath, uint64_t ino, mode_t mode,
|
void FuseTest::expect_lookup(const char *relpath, uint64_t ino, mode_t mode,
|
||||||
uint64_t size, int times, uint64_t attr_valid, uid_t uid, gid_t gid)
|
uint64_t size, int times, uint64_t attr_valid, uid_t uid, gid_t gid)
|
||||||
{
|
{
|
||||||
EXPECT_LOOKUP(1, relpath)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, relpath)
|
||||||
.Times(times)
|
.Times(times)
|
||||||
.WillRepeatedly(Invoke(
|
.WillRepeatedly(Invoke(
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
@ -214,7 +214,7 @@ void FuseTest::expect_lookup(const char *relpath, uint64_t ino, mode_t mode,
|
|||||||
void FuseTest::expect_lookup_7_8(const char *relpath, uint64_t ino, mode_t mode,
|
void FuseTest::expect_lookup_7_8(const char *relpath, uint64_t ino, mode_t mode,
|
||||||
uint64_t size, int times, uint64_t attr_valid, uid_t uid, gid_t gid)
|
uint64_t size, int times, uint64_t attr_valid, uid_t uid, gid_t gid)
|
||||||
{
|
{
|
||||||
EXPECT_LOOKUP(1, relpath)
|
EXPECT_LOOKUP(FUSE_ROOT_ID, relpath)
|
||||||
.Times(times)
|
.Times(times)
|
||||||
.WillRepeatedly(Invoke(
|
.WillRepeatedly(Invoke(
|
||||||
ReturnImmediate([=](auto in __unused, auto& out) {
|
ReturnImmediate([=](auto in __unused, auto& out) {
|
||||||
|
Loading…
Reference in New Issue
Block a user