Lines Matching +full:read +full:- +full:out
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 class Read: public FuseTest {
60 class RofsRead: public Read {
64 Read::SetUp();
81 class AioRead: public Read {
98 class ReadAhead: public Read,
110 Read::SetUp();
114 class ReadMaxRead: public Read {
117 Read::SetUp();
121 class ReadNoatime: public Read {
124 Read::SetUp();
128 class ReadSigbus: public Read
148 ReadSigbus::s_si_addr = info->si_addr;
155 class TimeGran: public Read, public WithParamInterface<unsigned> {
159 Read::SetUp();
197 * is at most one outstanding read operation per file handle
218 in.body.read.fh == FH &&
219 in.body.read.offset == (uint64_t)off0);
222 ).WillRepeatedly(Invoke([&](auto in __unused, auto &out __unused) {
230 in.body.read.fh == FH &&
231 in.body.read.offset == (uint64_t)off1);
234 ).WillRepeatedly(Invoke([&](auto in __unused, auto &out __unused) {
243 * Submit two AIO read requests, and respond to neither. If the
244 * filesystem ever gets the second read request, then we failed to
263 * the second read, even though the first has not yet returned
268 m_mock->kill_daemon();
277 * simultaneous read requests on the same file handle.
301 in.body.read.fh == FH &&
302 in.body.read.offset == (uint64_t)off0);
305 ).WillOnce(Invoke([&](auto in __unused, auto &out __unused) {
313 in.body.read.fh == FH &&
314 in.body.read.offset == (uint64_t)off1);
317 ).WillOnce(Invoke([&](auto in __unused, auto &out __unused) {
326 * Submit two AIO read requests, but respond to neither. Ensure that
347 m_mock->kill_daemon();
354 /* The kernel should update the cached atime attribute during a read */
355 TEST_F(Read, atime)
377 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
380 /* The kernel should automatically update atime during read */
388 /* The kernel should update the cached atime attribute during a cached read */
389 TEST_F(Read, atime_cached)
410 /* Ensure atime will be different than it was during the first read */
416 /* The kernel should automatically update atime during read */
425 TEST_F(Read, atime_during_close)
452 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
453 SET_OUT_HEADER_LEN(out, attr);
454 out.body.attr.attr.ino = ino;
455 out.body.attr.attr.mode = S_IFREG | newmode;
466 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
473 * When not using -o default_permissions, the daemon may make its own decisions
477 TEST_F(Read, atime_during_close_eacces)
508 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
514 TEST_F(Read, atime_during_setattr)
541 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
542 SET_OUT_HEADER_LEN(out, attr);
543 out.body.attr.attr.ino = ino;
544 out.body.attr.attr.mode = S_IFREG | newmode;
553 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
560 /* 0-length reads shouldn't cause any confusion */
561 TEST_F(Read, direct_io_read_nothing)
584 TEST_F(Read, direct_io_pread)
606 // get a 2nd read request.
615 * requested. fuse(4) should return a short read to userland.
617 TEST_F(Read, direct_io_short_read)
642 TEST_F(Read, eio)
664 ASSERT_EQ(-1, read(fd, buf, bufsize)) << strerror(errno);
670 * If the server returns a short read when direct io is not in use, that
671 * indicates EOF, because of a server-side truncation. We should invalidate
674 TEST_F(Read, eof)
704 /* Like Read.eof, but causes an entire buffer to be invalidated */
705 TEST_F(Read, eof_of_whole_buffer)
729 /* Try to read the 2nd block, but it's past EOF */
738 * With the keep_cache option, the kernel may keep its read cache across
741 TEST_F(Read, keep_cache)
757 ASSERT_EQ(bufsize, read(fd0, buf, bufsize)) << strerror(errno);
763 * This read should be serviced by cache, even though it's on the other
766 ASSERT_EQ(bufsize, read(fd1, buf, bufsize)) << strerror(errno);
773 * Without the keep_cache option, the kernel should drop its read caches on
776 TEST_F(Read, keep_cache_disabled)
792 ASSERT_EQ(bufsize, read(fd0, buf, bufsize)) << strerror(errno);
798 * This read should not be serviced by cache, even though it's on the
803 ASSERT_EQ(bufsize, read(fd0, buf, bufsize)) << strerror(errno);
809 TEST_F(Read, mmap)
828 in.body.read.fh == Read::FH &&
829 in.body.read.offset == 0 &&
830 in.body.read.size == bufsize);
833 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
834 out.header.len = sizeof(struct fuse_out_header) + bufsize;
835 memmove(out.body.bytes, CONTENTS, bufsize);
882 ASSERT_EQ(bufsize, read(fd, rbuf, bufsize)) << strerror(errno);
897 * The kernel should not update the cached atime attribute during a read, if
921 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
924 /* The kernel should not update atime during read */
934 * read, if MNT_NOATIME is used.
962 /* The kernel should automatically update atime during read */
970 /* Read of an mmap()ed file fails */
991 in.body.read.fh == Read::FH);
1021 * A read via mmap comes up short, indicating that the file was truncated
1022 * server-side.
1024 TEST_F(Read, mmap_eof)
1044 in.body.read.fh == Read::FH &&
1045 in.body.read.offset == 0 &&
1046 in.body.read.size == (uint32_t)m_maxbcachebuf);
1049 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
1050 out.header.len = sizeof(struct fuse_out_header) + bufsize;
1051 memmove(out.body.bytes, CONTENTS, bufsize);
1101 .WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) {
1102 SET_OUT_HEADER_LEN(out, attr);
1103 out.body.attr.attr.ino = ino;
1104 out.body.attr.attr.mode = mode;
1105 out.body.attr.attr.size = bufsize;
1106 out.body.attr.attr_valid = 0;
1151 TEST_F(Read, o_direct)
1169 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
1176 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
1182 TEST_F(Read, pread)
1191 * to read from. Without this, the read might start at a lower offset.
1209 TEST_F(Read, read)
1226 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
1232 TEST_F(Read_7_8, read)
1249 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
1256 * If cacheing is enabled, the kernel should try to read an entire cache block
1259 TEST_F(Read, cache_block)
1283 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
1286 /* A subsequent read should be serviced by cache */
1287 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
1293 /* Reading with sendfile should work (though it obviously won't be 0-copy) */
1294 TEST_F(Read, sendfile)
1312 in.body.read.fh == Read::FH &&
1313 in.body.read.offset == 0 &&
1314 in.body.read.size == bufsize);
1317 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
1318 out.header.len = sizeof(struct fuse_out_header) + bufsize;
1319 memmove(out.body.bytes, CONTENTS, bufsize);
1329 ASSERT_EQ(static_cast<ssize_t>(bufsize), read(sp[0], buf, bufsize))
1338 /* sendfile should fail gracefully if fuse declines the read */
1340 TEST_F(Read, sendfile_eio)
1397 len = std::min((size_t)clustersize, (size_t)(filesize - offs));
1407 ASSERT_EQ(bufsize, read(fd, rbuf, bufsize)) << strerror(errno);
1424 /* With read-only mounts, fuse should never update atime during close */
1453 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);
1482 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
1483 SET_OUT_HEADER_LEN(out, attr);
1484 out.body.attr.attr.ino = ino;
1485 out.body.attr.attr.mode = S_IFREG | newmode;
1491 ASSERT_EQ(bufsize, read(fd, buf, bufsize)) << strerror(errno);