Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jun 2024 18:59:41 GMT
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: af64741bba63 - stable/13 - fusefs: make the tests more robust to changes to maxphys
Message-ID:  <202406281859.45SIxfMl053479@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by asomers:

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

commit af64741bba6391a765294a41fe43030d4f242e4b
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-05-09 14:40:21 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-06-28 18:54:00 +0000

    fusefs: make the tests more robust to changes to maxphys
    
    Remove assumptions in two test cases that maxphys won't be huge.
    
    Reported by:    kib
    Sponsored by:   Axcient
    
    (cherry picked from commit b2792a300ddb8d8334b234fe7744f5141cc96103)
---
 tests/sys/fs/fusefs/bmap.cc  | 17 +++++++++++++----
 tests/sys/fs/fusefs/write.cc |  2 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/sys/fs/fusefs/bmap.cc b/tests/sys/fs/fusefs/bmap.cc
index 06342e7cc23b..8e9268058e96 100644
--- a/tests/sys/fs/fusefs/bmap.cc
+++ b/tests/sys/fs/fusefs/bmap.cc
@@ -77,8 +77,6 @@ class BmapEof: public Bmap, public WithParamInterface<int> {};
 
 /*
  * Test FUSE_BMAP
- * XXX The FUSE protocol does not include the runp and runb variables, so those
- * must be guessed in-kernel.
  */
 TEST_F(Bmap, bmap)
 {
@@ -105,8 +103,19 @@ TEST_F(Bmap, bmap)
 	arg.runb = -1;
 	ASSERT_EQ(0, ioctl(fd, FIOBMAP2, &arg)) << strerror(errno);
 	EXPECT_EQ(arg.bn, pbn);
-	EXPECT_EQ((unsigned long)arg.runp, m_maxphys / m_maxbcachebuf - 1);
-	EXPECT_EQ((unsigned long)arg.runb, m_maxphys / m_maxbcachebuf - 1);
+       /*
+	* XXX The FUSE protocol does not include the runp and runb variables,
+	* so those must be guessed in-kernel.  There's no "right" answer, so
+	* just check that they're within reasonable limits.
+	*/
+	EXPECT_LE(arg.runb, lbn);
+	EXPECT_LE((unsigned long)arg.runb, m_maxreadahead / m_maxbcachebuf);
+	EXPECT_LE((unsigned long)arg.runb, m_maxphys / m_maxbcachebuf);
+	EXPECT_GT(arg.runb, 0);
+	EXPECT_LE(arg.runp, filesize / m_maxbcachebuf - lbn);
+	EXPECT_LE((unsigned long)arg.runp, m_maxreadahead / m_maxbcachebuf);
+	EXPECT_LE((unsigned long)arg.runp, m_maxphys / m_maxbcachebuf);
+	EXPECT_GT(arg.runp, 0);
 
 	leak(fd);
 }
diff --git a/tests/sys/fs/fusefs/write.cc b/tests/sys/fs/fusefs/write.cc
index 9d152aeb0617..0b93369ad66d 100644
--- a/tests/sys/fs/fusefs/write.cc
+++ b/tests/sys/fs/fusefs/write.cc
@@ -179,7 +179,7 @@ class WriteCluster: public WriteBack {
 public:
 virtual void SetUp() {
 	m_async = true;
-	m_maxwrite = 1 << 25;	// Anything larger than MAXPHYS will suffice
+	m_maxwrite = UINT32_MAX; // Anything larger than MAXPHYS will suffice
 	WriteBack::SetUp();
 	if (m_maxphys < 2 * DFLTPHYS)
 		GTEST_SKIP() << "MAXPHYS must be at least twice DFLTPHYS"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406281859.45SIxfMl053479>