fuse(4): combine common code in the tests
Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
9ae9282e95
commit
9038479127
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/fuse2/; revision=345191
@ -62,8 +62,7 @@ TEST_F(Create, DISABLED_attr_cache)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, create);
|
||||
out->body.create.entry.attr.mode = S_IFREG | mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
@ -145,8 +144,7 @@ TEST_F(Create, DISABLED_Enosys)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, create);
|
||||
out->body.create.entry.attr.mode = S_IFREG | mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
@ -160,8 +158,7 @@ TEST_F(Create, DISABLED_Enosys)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(out->header);
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
})));
|
||||
@ -173,8 +170,7 @@ TEST_F(Create, DISABLED_Enosys)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -214,8 +210,7 @@ TEST_F(Create, DISABLED_entry_cache_negative)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, create);
|
||||
out->body.create.entry.attr.mode = S_IFREG | mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
@ -230,8 +225,7 @@ TEST_F(Create, DISABLED_entry_cache_negative)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -269,8 +263,7 @@ TEST_F(Create, DISABLED_entry_cache_negative_purge)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, create);
|
||||
out->body.create.entry.attr.mode = S_IFREG | mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
@ -284,8 +277,7 @@ TEST_F(Create, DISABLED_entry_cache_negative_purge)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -344,8 +336,7 @@ TEST_F(Create, ok)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, create);
|
||||
out->body.create.entry.attr.mode = S_IFREG | mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
@ -360,8 +351,7 @@ TEST_F(Create, ok)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
|
@ -181,7 +181,6 @@ TEST_F(FlushWithLocks, DISABLED_unlock_on_close)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, setlk);
|
||||
out->body.setlk.lk = in->body.setlk.lk;
|
||||
})));
|
||||
|
@ -132,8 +132,7 @@ TEST_F(Fsync, close)
|
||||
return (in->header.opcode == FUSE_SETATTR);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
})));
|
||||
@ -244,8 +243,7 @@ TEST_F(Fsync, DISABLED_fsync_metadata_only)
|
||||
return (in->header.opcode == FUSE_SETATTR);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | mode;
|
||||
|
@ -47,8 +47,8 @@ TEST_F(Getattr, DISABLED_attr_cache)
|
||||
const uint64_t ino = 42;
|
||||
struct stat sb;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -59,8 +59,7 @@ TEST_F(Getattr, DISABLED_attr_cache)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr_valid = UINT64_MAX;
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
@ -97,8 +96,7 @@ TEST_F(Getattr, attr_cache_timeout)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).Times(2)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr_valid_nsec = timeout_ns;
|
||||
out->body.attr.attr_valid = UINT64_MAX;
|
||||
@ -144,8 +142,7 @@ TEST_F(Getattr, ok)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
|
@ -92,8 +92,7 @@ TEST_F(Link, ok)
|
||||
(0 == strcmp(name, RELPATH)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = ino;
|
||||
|
@ -124,7 +124,6 @@ TEST_F(Getlk, DISABLED_no_locks)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, getlk);
|
||||
out->body.getlk.lk = in->body.getlk.lk;
|
||||
out->body.getlk.lk.type = F_UNLCK;
|
||||
@ -170,8 +169,7 @@ TEST_F(Getlk, DISABLED_lock_exists)
|
||||
in->body.getlk.lk.pid == (uint64_t)pid);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, getlk);
|
||||
out->body.getlk.lk.start = 100;
|
||||
out->body.getlk.lk.end = 199;
|
||||
@ -252,7 +250,6 @@ TEST_F(Setlk, DISABLED_set)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, setlk);
|
||||
out->body.setlk.lk = in->body.setlk.lk;
|
||||
})));
|
||||
@ -296,7 +293,6 @@ TEST_F(Setlk, DISABLED_set_eof)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, setlk);
|
||||
out->body.setlk.lk = in->body.setlk.lk;
|
||||
})));
|
||||
@ -413,7 +409,6 @@ TEST_F(Setlkw, DISABLED_set)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, setlkw);
|
||||
out->body.setlkw.lk = in->body.setlkw.lk;
|
||||
})));
|
||||
|
@ -53,8 +53,7 @@ TEST_F(Lookup, DISABLED_attr_cache)
|
||||
struct stat sb;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.nodeid = ino;
|
||||
out->body.entry.attr_valid = UINT64_MAX;
|
||||
@ -120,8 +119,7 @@ TEST_F(Lookup, attr_cache_timeout)
|
||||
long timeout_ns = 250'000'000;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.nodeid = ino;
|
||||
out->body.entry.attr_valid_nsec = timeout_ns;
|
||||
@ -157,8 +155,7 @@ TEST_F(Lookup, entry_cache)
|
||||
const char RELPATH[] = "some_file.txt";
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.entry_valid = UINT64_MAX;
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
@ -227,8 +224,7 @@ TEST_F(Lookup, DISABLED_entry_cache_timeout)
|
||||
long timeout_ns = 250'000'000;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH).Times(2)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.entry_valid_nsec = timeout_ns;
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
@ -252,8 +248,7 @@ TEST_F(Lookup, ok)
|
||||
const char RELPATH[] = "some_file.txt";
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = 14;
|
||||
@ -275,15 +270,13 @@ TEST_F(Lookup, subdir)
|
||||
uint64_t file_ino = 3;
|
||||
|
||||
EXPECT_LOOKUP(1, DIRPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFDIR | 0755;
|
||||
out->body.entry.nodeid = dir_ino;
|
||||
})));
|
||||
EXPECT_LOOKUP(dir_ino, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = file_ino;
|
||||
|
@ -95,8 +95,7 @@ TEST_F(Mkdir, DISABLED_entry_cache_negative)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.create.entry.attr.mode = S_IFDIR | mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
@ -134,8 +133,7 @@ TEST_F(Mkdir, DISABLED_entry_cache_negative_purge)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFDIR | mode;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -168,8 +166,7 @@ TEST_F(Mkdir, ok)
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.create.entry.attr.mode = S_IFDIR | mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
|
@ -67,8 +67,7 @@ void test_ok(mode_t mode, dev_t dev) {
|
||||
(0 == strcmp(RELPATH, name)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, create);
|
||||
out->body.create.entry.attr.mode = mode;
|
||||
out->body.create.entry.nodeid = ino;
|
||||
|
@ -140,6 +140,7 @@ ReturnImmediate(std::function<void(const struct mockfs_buf_in *in,
|
||||
{
|
||||
return([=](auto in, auto &out) {
|
||||
auto out0 = new mockfs_buf_out;
|
||||
out0->header.unique = in->header.unique;
|
||||
f(in, out0);
|
||||
out.push_back(out0);
|
||||
});
|
||||
|
@ -56,8 +56,7 @@ void test_ok(int os_flags, int fuse_flags) {
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(out->header);
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
})));
|
||||
@ -69,8 +68,7 @@ void test_ok(int os_flags, int fuse_flags) {
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
|
@ -109,8 +109,7 @@ TEST_F(Opendir, open)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
})));
|
||||
|
||||
@ -129,8 +128,7 @@ TEST_F(Opendir, opendir)
|
||||
return (in->header.opcode == FUSE_STATFS);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, statfs);
|
||||
})));
|
||||
|
||||
@ -140,8 +138,7 @@ TEST_F(Opendir, opendir)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
})));
|
||||
|
||||
|
@ -242,8 +242,7 @@ TEST_F(Read, mmap)
|
||||
in->body.read.size >= bufsize);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(struct fuse_out_header) + bufsize;
|
||||
memmove(out->body.bytes, CONTENTS, bufsize);
|
||||
})));
|
||||
@ -411,8 +410,7 @@ TEST_F(Read, sendfile)
|
||||
in->body.read.size >= bufsize);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(struct fuse_out_header) + bufsize;
|
||||
memmove(out->body.bytes, CONTENTS, bufsize);
|
||||
})));
|
||||
|
@ -59,7 +59,6 @@ void expect_readdir(uint64_t ino, uint64_t off, vector<struct dirent> &ents)
|
||||
struct fuse_dirent *fde = (struct fuse_dirent*)out->body.bytes;
|
||||
int i = 0;
|
||||
|
||||
out->header.unique = in->header.unique;
|
||||
out->header.error = 0;
|
||||
out->header.len = 0;
|
||||
|
||||
@ -208,8 +207,7 @@ TEST_F(Readdir, nodots)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.error = 0;
|
||||
out->header.len = sizeof(out->header);
|
||||
})));
|
||||
|
@ -82,8 +82,7 @@ TEST_F(Readlink, ok)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
strlcpy(out->body.str, dst, sizeof(out->body.str));
|
||||
out->header.len = sizeof(out->header) + strlen(dst) + 1;
|
||||
})));
|
||||
|
@ -170,7 +170,6 @@ TEST_F(ReleaseWithLocks, DISABLED_unlock_on_close)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, setlk);
|
||||
out->body.setlk.lk = in->body.setlk.lk;
|
||||
})));
|
||||
|
@ -75,8 +75,7 @@ TEST_F(ReleaseDir, dup)
|
||||
in->body.readdir.offset == 0);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.error = 0;
|
||||
out->header.len = sizeof(out->header);
|
||||
})));
|
||||
|
@ -42,8 +42,7 @@ public:
|
||||
void expect_lookup(const char *relpath, uint64_t ino)
|
||||
{
|
||||
EXPECT_LOOKUP(1, relpath)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFDIR | 0755;
|
||||
out->body.entry.nodeid = ino;
|
||||
|
@ -56,8 +56,7 @@ TEST_F(Setattr, DISABLED_attr_cache)
|
||||
const mode_t newmode = 0644;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -70,8 +69,7 @@ TEST_F(Setattr, DISABLED_attr_cache)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | newmode;
|
||||
@ -101,8 +99,7 @@ TEST_F(Setattr, chmod)
|
||||
const mode_t newmode = 0644;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | oldmode;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -119,8 +116,7 @@ TEST_F(Setattr, chmod)
|
||||
in->body.setattr.mode == newmode);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | newmode;
|
||||
@ -140,8 +136,7 @@ TEST_F(Setattr, chown)
|
||||
const uid_t newuser = 44;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -160,8 +155,7 @@ TEST_F(Setattr, chown)
|
||||
in->body.setattr.gid == newgroup);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -186,7 +180,6 @@ TEST_F(Setattr, eperm)
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0777;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -216,8 +209,7 @@ TEST_F(Setattr, fchmod)
|
||||
const mode_t newmode = 0644;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | oldmode;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -230,8 +222,7 @@ TEST_F(Setattr, fchmod)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(out->header);
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
})));
|
||||
@ -243,8 +234,7 @@ TEST_F(Setattr, fchmod)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | oldmode;
|
||||
@ -260,8 +250,7 @@ TEST_F(Setattr, fchmod)
|
||||
in->body.setattr.mode == newmode);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | newmode;
|
||||
@ -285,8 +274,7 @@ TEST_F(Setattr, ftruncate)
|
||||
const off_t newsize = 12345;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0755;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -300,8 +288,7 @@ TEST_F(Setattr, ftruncate)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(out->header);
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
out->body.open.fh = fh;
|
||||
@ -314,8 +301,7 @@ TEST_F(Setattr, ftruncate)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0755;
|
||||
@ -332,8 +318,7 @@ TEST_F(Setattr, ftruncate)
|
||||
in->body.setattr.fh == fh);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0755;
|
||||
@ -355,8 +340,7 @@ TEST_F(Setattr, truncate) {
|
||||
const uint64_t newsize = 20'000'000;
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -373,8 +357,7 @@ TEST_F(Setattr, truncate) {
|
||||
in->body.setattr.size == newsize);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -398,8 +381,7 @@ TEST_F(Setattr, utimensat) {
|
||||
};
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -420,8 +402,7 @@ TEST_F(Setattr, utimensat) {
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -446,8 +427,7 @@ TEST_F(Setattr, utimensat) {
|
||||
newtimes[1].tv_nsec);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -475,8 +455,7 @@ TEST_F(Setattr, utimensat_mtime_only) {
|
||||
};
|
||||
|
||||
EXPECT_LOOKUP(1, RELPATH)
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFREG | 0644;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -497,8 +476,7 @@ TEST_F(Setattr, utimensat_mtime_only) {
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -520,8 +498,7 @@ TEST_F(Setattr, utimensat_mtime_only) {
|
||||
newtimes[1].tv_nsec);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
|
@ -86,8 +86,7 @@ TEST_F(Statfs, ok)
|
||||
return (in->header.opcode == FUSE_STATFS);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, statfs);
|
||||
out->body.statfs.st.blocks = 1000;
|
||||
out->body.statfs.st.bfree = 100;
|
||||
|
@ -80,8 +80,7 @@ TEST_F(Symlink, ok)
|
||||
(0 == strcmp(name, RELPATH)));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = S_IFLNK | 0777;
|
||||
out->body.entry.nodeid = ino;
|
||||
|
@ -93,8 +93,7 @@ void FuseTest::expect_getattr(uint64_t ino, uint64_t size)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
@ -108,8 +107,7 @@ void FuseTest::expect_lookup(const char *relpath, uint64_t ino, mode_t mode,
|
||||
{
|
||||
EXPECT_LOOKUP(1, relpath)
|
||||
.Times(times)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, entry);
|
||||
out->body.entry.attr.mode = mode;
|
||||
out->body.entry.nodeid = ino;
|
||||
@ -127,8 +125,7 @@ void FuseTest::expect_open(uint64_t ino, uint32_t flags, int times)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).Times(times)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(out->header);
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
out->body.open.fh = FH;
|
||||
@ -143,8 +140,7 @@ void FuseTest::expect_opendir(uint64_t ino)
|
||||
return (in->header.opcode == FUSE_STATFS);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, statfs);
|
||||
})));
|
||||
|
||||
@ -154,8 +150,7 @@ void FuseTest::expect_opendir(uint64_t ino)
|
||||
in->header.nodeid == ino);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(out->header);
|
||||
SET_OUT_HEADER_LEN(out, open);
|
||||
out->body.open.fh = FH;
|
||||
@ -174,8 +169,7 @@ void FuseTest::expect_read(uint64_t ino, uint64_t offset, uint64_t isize,
|
||||
in->body.read.size == isize);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
out->header.len = sizeof(struct fuse_out_header) + osize;
|
||||
memmove(out->body.bytes, contents, osize);
|
||||
}))).RetiresOnSaturation();
|
||||
@ -219,8 +213,7 @@ void FuseTest::expect_write(uint64_t ino, uint64_t offset, uint64_t isize,
|
||||
0 == bcmp(buf, contents, isize));
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, write);
|
||||
out->body.write.size = osize;
|
||||
})));
|
||||
|
@ -503,8 +503,7 @@ TEST_F(WriteBack, close)
|
||||
return (in->header.opcode == FUSE_SETATTR);
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
).WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
})));
|
||||
@ -635,8 +634,7 @@ TEST_F(WriteThrough, DISABLED_update_file_size)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).Times(2)
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
.WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, attr);
|
||||
out->body.attr.attr.ino = ino; // Must match nodeid
|
||||
out->body.attr.attr.mode = S_IFREG | 0644;
|
||||
|
@ -166,11 +166,12 @@ TEST_F(Getxattr, size_only)
|
||||
int ns = EXTATTR_NAMESPACE_USER;
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_getxattr(ino, "user.foo", ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
SET_OUT_HEADER_LEN(out, getxattr);
|
||||
out->body.getxattr.size = 99;
|
||||
}));
|
||||
expect_getxattr(ino, "user.foo",
|
||||
ReturnImmediate([](auto in __unused, auto out) {
|
||||
SET_OUT_HEADER_LEN(out, getxattr);
|
||||
out->body.getxattr.size = 99;
|
||||
})
|
||||
);
|
||||
|
||||
ASSERT_EQ(99, extattr_get_file(FULLPATH, ns, "foo", NULL, 0))
|
||||
<< strerror(errno);;
|
||||
@ -190,8 +191,7 @@ TEST_F(Getxattr, system)
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_getxattr(ino, "system.foo",
|
||||
ReturnImmediate([&](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
ReturnImmediate([&](auto in __unused, auto out) {
|
||||
memcpy((void*)out->body.bytes, value, value_len);
|
||||
out->header.len = sizeof(out->header) + value_len;
|
||||
})
|
||||
@ -216,8 +216,7 @@ TEST_F(Getxattr, user)
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_getxattr(ino, "user.foo",
|
||||
ReturnImmediate([&](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
ReturnImmediate([&](auto in __unused, auto out) {
|
||||
memcpy((void*)out->body.bytes, value, value_len);
|
||||
out->header.len = sizeof(out->header) + value_len;
|
||||
})
|
||||
@ -277,8 +276,7 @@ TEST_F(Listxattr, size_only_empty)
|
||||
int ns = EXTATTR_NAMESPACE_USER;
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_listxattr(ino, 0, ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto out) {
|
||||
out->body.listxattr.size = 0;
|
||||
SET_OUT_HEADER_LEN(out, listxattr);
|
||||
}));
|
||||
@ -299,20 +297,21 @@ TEST_F(Listxattr, size_only_nonempty)
|
||||
int ns = EXTATTR_NAMESPACE_USER;
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_listxattr(ino, 0, ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto out) {
|
||||
out->body.listxattr.size = 45;
|
||||
SET_OUT_HEADER_LEN(out, listxattr);
|
||||
}));
|
||||
|
||||
// TODO: fix the expected size after fixing the size calculation bug in
|
||||
// fuse_vnop_listextattr. It should be exactly 45.
|
||||
expect_listxattr(ino, 53, ReturnImmediate([](auto in, auto out) {
|
||||
const char l[] = "user.foo";
|
||||
out->header.unique = in->header.unique;
|
||||
strlcpy((char*)out->body.bytes, l, sizeof(out->body.bytes));
|
||||
out->header.len = sizeof(fuse_out_header) + sizeof(l);
|
||||
}));
|
||||
expect_listxattr(ino, 53,
|
||||
ReturnImmediate([](auto in __unused, auto out) {
|
||||
const char l[] = "user.foo";
|
||||
strlcpy((char*)out->body.bytes, l,
|
||||
sizeof(out->body.bytes));
|
||||
out->header.len = sizeof(fuse_out_header) + sizeof(l);
|
||||
})
|
||||
);
|
||||
|
||||
ASSERT_EQ(4, extattr_list_file(FULLPATH, ns, NULL, 0))
|
||||
<< strerror(errno);
|
||||
@ -324,22 +323,22 @@ TEST_F(Listxattr, size_only_really_big)
|
||||
int ns = EXTATTR_NAMESPACE_USER;
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_listxattr(ino, 0, ReturnImmediate([](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto out) {
|
||||
out->body.listxattr.size = 16000;
|
||||
SET_OUT_HEADER_LEN(out, listxattr);
|
||||
}));
|
||||
|
||||
// TODO: fix the expected size after fixing the size calculation bug in
|
||||
// fuse_vnop_listextattr. It should be exactly 16000.
|
||||
expect_listxattr(ino, 16008, ReturnImmediate([](auto in, auto out) {
|
||||
const char l[16] = "user.foobarbang";
|
||||
out->header.unique = in->header.unique;
|
||||
for (int i=0; i < 1000; i++) {
|
||||
memcpy(&out->body.bytes[16 * i], l, 16);
|
||||
}
|
||||
out->header.len = sizeof(fuse_out_header) + 16000;
|
||||
}));
|
||||
expect_listxattr(ino, 16008,
|
||||
ReturnImmediate([](auto in __unused, auto out) {
|
||||
const char l[16] = "user.foobarbang";
|
||||
for (int i=0; i < 1000; i++) {
|
||||
memcpy(&out->body.bytes[16 * i], l, 16);
|
||||
}
|
||||
out->header.len = sizeof(fuse_out_header) + 16000;
|
||||
})
|
||||
);
|
||||
|
||||
ASSERT_EQ(11000, extattr_list_file(FULLPATH, ns, NULL, 0))
|
||||
<< strerror(errno);
|
||||
@ -358,17 +357,17 @@ TEST_F(Listxattr, user)
|
||||
char attrs[28] = "user.foo\0system.x\0user.bang";
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_listxattr(ino, 0, ReturnImmediate([&](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
out->body.listxattr.size = sizeof(attrs);
|
||||
SET_OUT_HEADER_LEN(out, listxattr);
|
||||
}));
|
||||
expect_listxattr(ino, 0,
|
||||
ReturnImmediate([&](auto in __unused, auto out) {
|
||||
out->body.listxattr.size = sizeof(attrs);
|
||||
SET_OUT_HEADER_LEN(out, listxattr);
|
||||
})
|
||||
);
|
||||
|
||||
// TODO: fix the expected size after fixing the size calculation bug in
|
||||
// fuse_vnop_listextattr.
|
||||
expect_listxattr(ino, sizeof(attrs) + 8,
|
||||
ReturnImmediate([&](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
ReturnImmediate([&](auto in __unused, auto out) {
|
||||
memcpy((void*)out->body.bytes, attrs, sizeof(attrs));
|
||||
out->header.len = sizeof(fuse_out_header) + sizeof(attrs);
|
||||
}));
|
||||
@ -392,17 +391,17 @@ TEST_F(Listxattr, system)
|
||||
char attrs[28] = "user.foo\0system.x\0user.bang";
|
||||
|
||||
expect_lookup(RELPATH, ino, S_IFREG | 0644, 1);
|
||||
expect_listxattr(ino, 0, ReturnImmediate([&](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
out->body.listxattr.size = sizeof(attrs);
|
||||
SET_OUT_HEADER_LEN(out, listxattr);
|
||||
}));
|
||||
expect_listxattr(ino, 0,
|
||||
ReturnImmediate([&](auto in __unused, auto out) {
|
||||
out->body.listxattr.size = sizeof(attrs);
|
||||
SET_OUT_HEADER_LEN(out, listxattr);
|
||||
})
|
||||
);
|
||||
|
||||
// TODO: fix the expected size after fixing the size calculation bug in
|
||||
// fuse_vnop_listextattr.
|
||||
expect_listxattr(ino, sizeof(attrs) + 8,
|
||||
ReturnImmediate([&](auto in, auto out) {
|
||||
out->header.unique = in->header.unique;
|
||||
ReturnImmediate([&](auto in __unused, auto out) {
|
||||
memcpy((void*)out->body.bytes, attrs, sizeof(attrs));
|
||||
out->header.len = sizeof(fuse_out_header) + sizeof(attrs);
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user