git: ae39db74066a - main - fusefs: fix an expectation in one of the tests

Alan Somers asomers at FreeBSD.org
Fri Jan 1 17:20:02 UTC 2021


The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae39db74066a0ff1682c1c841be030099d9d4557

commit ae39db74066a0ff1682c1c841be030099d9d4557
Author:     Alan Somers <asomers at gmail.com>
AuthorDate: 2020-12-29 17:48:34 +0000
Commit:     Alan Somers <asomers at FreeBSD.org>
CommitDate: 2021-01-01 17:18:22 +0000

    fusefs: fix an expectation in one of the tests
    
    An order-of-operations problem caused an expectation intended for
    FUSE_READ to instead match FUSE_ACCESS.  Surprisingly, only one test
    case was affected.
    
    MFC after:      2 weeks
    Reviewed by:    cem
    Differential Revision:  https://reviews.freebsd.org/D27818
---
 tests/sys/fs/fusefs/utils.cc | 4 ++--
 tests/sys/fs/fusefs/write.cc | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/sys/fs/fusefs/utils.cc b/tests/sys/fs/fusefs/utils.cc
index 7e9b97c2f228..4b59f6e26e12 100644
--- a/tests/sys/fs/fusefs/utils.cc
+++ b/tests/sys/fs/fusefs/utils.cc
@@ -376,10 +376,10 @@ void FuseTest::expect_read(uint64_t ino, uint64_t offset, uint64_t isize,
 				in.body.read.fh == FH &&
 				in.body.read.offset == offset &&
 				in.body.read.size == isize &&
-				flags == -1 ?
+				(flags == -1 ?
 					(in.body.read.flags == O_RDONLY ||
 					 in.body.read.flags == O_RDWR)
-				: in.body.read.flags == (uint32_t)flags);
+				: in.body.read.flags == (uint32_t)flags));
 		}, Eq(true)),
 		_)
 	).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
diff --git a/tests/sys/fs/fusefs/write.cc b/tests/sys/fs/fusefs/write.cc
index 78d82805470f..7529b76847d7 100644
--- a/tests/sys/fs/fusefs/write.cc
+++ b/tests/sys/fs/fusefs/write.cc
@@ -508,7 +508,7 @@ TEST_F(Write, eof_during_rmw)
 	const char *INITIAL   = "XXXXXXXXXX";
 	uint64_t ino = 42;
 	uint64_t offset = 1;
-	ssize_t bufsize = strlen(CONTENTS);
+	ssize_t bufsize = strlen(CONTENTS) + 1;
 	off_t orig_fsize = 10;
 	off_t truncated_fsize = 5;
 	off_t final_fsize = bufsize;
@@ -517,8 +517,6 @@ TEST_F(Write, eof_during_rmw)
 	FuseTest::expect_lookup(RELPATH, ino, S_IFREG | 0644, orig_fsize, 1);
 	expect_open(ino, 0, 1);
 	expect_read(ino, 0, orig_fsize, truncated_fsize, INITIAL, O_RDWR);
-	expect_getattr(ino, truncated_fsize);
-	expect_read(ino, 0, final_fsize, final_fsize, INITIAL, O_RDWR);
 	maybe_expect_write(ino, offset, bufsize, CONTENTS);
 
 	fd = open(FULLPATH, O_RDWR);


More information about the dev-commits-src-all mailing list