svn commit: r350992 - head/tests/sys/fs/fusefs
Alan Somers
asomers at FreeBSD.org
Tue Aug 13 15:52:30 UTC 2019
Author: asomers
Date: Tue Aug 13 15:52:28 2019
New Revision: 350992
URL: https://svnweb.freebsd.org/changeset/base/350992
Log:
fusefs: skip some tests when unsafe aio is disabled
MFC after: 15 days
MFC-With: r350665
Sponsored by: The FreeBSD Foundation
Modified:
head/tests/sys/fs/fusefs/fsync.cc
head/tests/sys/fs/fusefs/fsyncdir.cc
head/tests/sys/fs/fusefs/read.cc
head/tests/sys/fs/fusefs/utils.cc
head/tests/sys/fs/fusefs/utils.hh
head/tests/sys/fs/fusefs/write.cc
Directory Properties:
head/ (props changed)
Modified: head/tests/sys/fs/fusefs/fsync.cc
==============================================================================
--- head/tests/sys/fs/fusefs/fsync.cc Tue Aug 13 15:50:47 2019 (r350991)
+++ head/tests/sys/fs/fusefs/fsync.cc Tue Aug 13 15:52:28 2019 (r350992)
@@ -82,8 +82,17 @@ void expect_write(uint64_t ino, uint64_t size, const v
};
+class AioFsync: public Fsync {
+virtual void SetUp() {
+ if (!is_unsafe_aio_enabled())
+ GTEST_SKIP() <<
+ "vfs.aio.enable_unsafe must be set for this test";
+ FuseTest::SetUp();
+}
+};
+
/* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236379 */
-TEST_F(Fsync, aio_fsync)
+TEST_F(AioFsync, aio_fsync)
{
const char FULLPATH[] = "mountpoint/some_file.txt";
const char RELPATH[] = "some_file.txt";
Modified: head/tests/sys/fs/fusefs/fsyncdir.cc
==============================================================================
--- head/tests/sys/fs/fusefs/fsyncdir.cc Tue Aug 13 15:50:47 2019 (r350991)
+++ head/tests/sys/fs/fusefs/fsyncdir.cc Tue Aug 13 15:52:28 2019 (r350992)
@@ -77,8 +77,17 @@ void expect_lookup(const char *relpath, uint64_t ino)
};
+class AioFsyncDir: public FsyncDir {
+virtual void SetUp() {
+ if (!is_unsafe_aio_enabled())
+ GTEST_SKIP() <<
+ "vfs.aio.enable_unsafe must be set for this test";
+ FuseTest::SetUp();
+}
+};
+
/* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236379 */
-TEST_F(FsyncDir, aio_fsync)
+TEST_F(AioFsyncDir, aio_fsync)
{
const char FULLPATH[] = "mountpoint/some_file.txt";
const char RELPATH[] = "some_file.txt";
Modified: head/tests/sys/fs/fusefs/read.cc
==============================================================================
--- head/tests/sys/fs/fusefs/read.cc Tue Aug 13 15:50:47 2019 (r350991)
+++ head/tests/sys/fs/fusefs/read.cc Tue Aug 13 15:52:28 2019 (r350992)
@@ -73,17 +73,10 @@ void expect_lookup(const char *relpath, uint64_t ino,
class AioRead: public Read {
public:
virtual void SetUp() {
- const char *node = "vfs.aio.enable_unsafe";
- int val = 0;
- size_t size = sizeof(val);
-
- FuseTest::SetUp();
-
- ASSERT_EQ(0, sysctlbyname(node, &val, &size, NULL, 0))
- << strerror(errno);
- if (!val)
+ if (!is_unsafe_aio_enabled())
GTEST_SKIP() <<
"vfs.aio.enable_unsafe must be set for this test";
+ FuseTest::SetUp();
}
};
Modified: head/tests/sys/fs/fusefs/utils.cc
==============================================================================
--- head/tests/sys/fs/fusefs/utils.cc Tue Aug 13 15:50:47 2019 (r350991)
+++ head/tests/sys/fs/fusefs/utils.cc Tue Aug 13 15:52:28 2019 (r350992)
@@ -89,6 +89,18 @@ void check_environment()
GTEST_SKIP() << "current user is not allowed to mount";
}
+bool is_unsafe_aio_enabled(void) {
+ const char *node = "vfs.aio.enable_unsafe";
+ int val = 0;
+ size_t size = sizeof(val);
+
+ if (sysctlbyname(node, &val, &size, NULL, 0)) {
+ perror("sysctlbyname");
+ return (false);
+ }
+ return (val != 0);
+}
+
class FuseEnv: public Environment {
virtual void SetUp() {
}
Modified: head/tests/sys/fs/fusefs/utils.hh
==============================================================================
--- head/tests/sys/fs/fusefs/utils.hh Tue Aug 13 15:50:47 2019 (r350991)
+++ head/tests/sys/fs/fusefs/utils.hh Tue Aug 13 15:52:28 2019 (r350992)
@@ -44,6 +44,8 @@ inline void nap()
usleep(NAP_NS / 1000);
}
+bool is_unsafe_aio_enabled(void);
+
extern const uint32_t libfuse_max_write;
extern const uint32_t default_max_write;
class FuseTest : public ::testing::Test {
Modified: head/tests/sys/fs/fusefs/write.cc
==============================================================================
--- head/tests/sys/fs/fusefs/write.cc Tue Aug 13 15:50:47 2019 (r350991)
+++ head/tests/sys/fs/fusefs/write.cc Tue Aug 13 15:52:28 2019 (r350992)
@@ -35,7 +35,6 @@ extern "C" {
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
-#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/uio.h>
@@ -138,17 +137,10 @@ void expect_lookup(const char *relpath, uint64_t ino,
class AioWrite: public Write {
virtual void SetUp() {
- const char *node = "vfs.aio.enable_unsafe";
- int val = 0;
- size_t size = sizeof(val);
-
- FuseTest::SetUp();
-
- ASSERT_EQ(0, sysctlbyname(node, &val, &size, NULL, 0))
- << strerror(errno);
- if (!val)
+ if (!is_unsafe_aio_enabled())
GTEST_SKIP() <<
"vfs.aio.enable_unsafe must be set for this test";
+ FuseTest::SetUp();
}
};
More information about the svn-src-head
mailing list