svn commit: r345720 - projects/fuse2/tests/sys/fs/fusefs
Alan Somers
asomers at FreeBSD.org
Sat Mar 30 00:36:00 UTC 2019
Author: asomers
Date: Sat Mar 30 00:35:59 2019
New Revision: 345720
URL: https://svnweb.freebsd.org/changeset/base/345720
Log:
fusefs: fix tests when data caching is disabled
VOP_GETPAGES is disabled when vfs.fusefs.data_cache_mode=0, causing mmap to
return success but accessing the mapped memory will subsequently segfault.
Sponsored by: The FreeBSD Foundation
Modified:
projects/fuse2/tests/sys/fs/fusefs/read.cc
Modified: projects/fuse2/tests/sys/fs/fusefs/read.cc
==============================================================================
--- projects/fuse2/tests/sys/fs/fusefs/read.cc Sat Mar 30 00:35:32 2019 (r345719)
+++ projects/fuse2/tests/sys/fs/fusefs/read.cc Sat Mar 30 00:35:59 2019 (r345720)
@@ -78,6 +78,23 @@ class AsyncRead: public AioRead {
}
};
+class ReadMmap: public Read {
+public:
+virtual void SetUp() {
+ const char *node = "vfs.fusefs.data_cache_mode";
+ int val = 0;
+ size_t size = sizeof(val);
+
+ FuseTest::SetUp();
+
+ ASSERT_EQ(0, sysctlbyname(node, &val, &size, NULL, 0))
+ << strerror(errno);
+ if (val == 0)
+ GTEST_SKIP() <<
+ "fusefs data caching must be enabled for this test";
+}
+};
+
class ReadAhead: public Read, public WithParamInterface<uint32_t> {
virtual void SetUp() {
m_maxreadahead = GetParam();
@@ -450,7 +467,7 @@ TEST_F(Read, keep_cache_disabled)
/* Deliberately leak fd0 and fd1. */
}
-TEST_F(Read, mmap)
+TEST_F(ReadMmap, mmap)
{
const char FULLPATH[] = "mountpoint/some_file.txt";
const char RELPATH[] = "some_file.txt";
@@ -621,7 +638,7 @@ TEST_F(Read, default_readahead)
}
/* Reading with sendfile should work (though it obviously won't be 0-copy) */
-TEST_F(Read, sendfile)
+TEST_F(ReadMmap, sendfile)
{
const char FULLPATH[] = "mountpoint/some_file.txt";
const char RELPATH[] = "some_file.txt";
@@ -668,7 +685,7 @@ TEST_F(Read, sendfile)
/* sendfile should fail gracefully if fuse declines the read */
/* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236466 */
-TEST_F(Read, DISABLED_sendfile_eio)
+TEST_F(ReadMmap, DISABLED_sendfile_eio)
{
const char FULLPATH[] = "mountpoint/some_file.txt";
const char RELPATH[] = "some_file.txt";
More information about the svn-src-projects
mailing list