From f74b33d9dbdc1235d409ab098d71277d33b8b8e1 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 26 Jun 2019 23:10:20 +0000 Subject: [PATCH] fusefs: tighten expectations in mmap tests In r349378 I fixed mmap's habit of reading more data than was available. Sponsored by: The FreeBSD Foundation --- tests/sys/fs/fusefs/read.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/sys/fs/fusefs/read.cc b/tests/sys/fs/fusefs/read.cc index fa70949ab604..cd82c0656ebd 100644 --- a/tests/sys/fs/fusefs/read.cc +++ b/tests/sys/fs/fusefs/read.cc @@ -563,14 +563,13 @@ TEST_F(Read, mmap) expect_lookup(RELPATH, ino, bufsize); expect_open(ino, 0, 1); - /* mmap may legitimately try to read more data than is available */ EXPECT_CALL(*m_mock, process( ResultOf([=](auto in) { return (in.header.opcode == FUSE_READ && in.header.nodeid == ino && in.body.read.fh == Read::FH && in.body.read.offset == 0 && - in.body.read.size >= bufsize); + in.body.read.size == bufsize); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { @@ -608,16 +607,15 @@ TEST_F(Read, mmap_eof) len = getpagesize(); - expect_lookup(RELPATH, ino, 100000); + expect_lookup(RELPATH, ino, m_maxbcachebuf); expect_open(ino, 0, 1); - /* mmap may legitimately try to read more data than is available */ EXPECT_CALL(*m_mock, process( ResultOf([=](auto in) { return (in.header.opcode == FUSE_READ && in.header.nodeid == ino && in.body.read.fh == Read::FH && in.body.read.offset == 0 && - in.body.read.size >= bufsize); + in.body.read.size == (uint32_t)m_maxbcachebuf); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { @@ -802,14 +800,13 @@ TEST_F(Read, sendfile) expect_lookup(RELPATH, ino, bufsize); expect_open(ino, 0, 1); - /* Like mmap, sendfile may request more data than is available */ EXPECT_CALL(*m_mock, process( ResultOf([=](auto in) { return (in.header.opcode == FUSE_READ && in.header.nodeid == ino && in.body.read.fh == Read::FH && in.body.read.offset == 0 && - in.body.read.size >= bufsize); + in.body.read.size == bufsize); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {