Date: Mon, 12 Aug 2019 20:00:21 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r350955 - projects/fuse2/tests/sys/fs/fusefs Message-ID: <201908122000.x7CK0Lrl006426@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Mon Aug 12 20:00:21 2019 New Revision: 350955 URL: https://svnweb.freebsd.org/changeset/base/350955 Log: fusefs: skip some tests when unsafe aio is disabled MFC after: 16 days MFC-With: r350665 Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/tests/sys/fs/fusefs/fsync.cc projects/fuse2/tests/sys/fs/fusefs/fsyncdir.cc projects/fuse2/tests/sys/fs/fusefs/read.cc projects/fuse2/tests/sys/fs/fusefs/utils.cc projects/fuse2/tests/sys/fs/fusefs/utils.hh projects/fuse2/tests/sys/fs/fusefs/write.cc Modified: projects/fuse2/tests/sys/fs/fusefs/fsync.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/fsync.cc Mon Aug 12 19:44:57 2019 (r350954) +++ projects/fuse2/tests/sys/fs/fusefs/fsync.cc Mon Aug 12 20:00:21 2019 (r350955) @@ -80,8 +80,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: projects/fuse2/tests/sys/fs/fusefs/fsyncdir.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/fsyncdir.cc Mon Aug 12 19:44:57 2019 (r350954) +++ projects/fuse2/tests/sys/fs/fusefs/fsyncdir.cc Mon Aug 12 20:00:21 2019 (r350955) @@ -75,8 +75,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: projects/fuse2/tests/sys/fs/fusefs/read.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/read.cc Mon Aug 12 19:44:57 2019 (r350954) +++ projects/fuse2/tests/sys/fs/fusefs/read.cc Mon Aug 12 20:00:21 2019 (r350955) @@ -71,17 +71,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: projects/fuse2/tests/sys/fs/fusefs/utils.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/utils.cc Mon Aug 12 19:44:57 2019 (r350954) +++ projects/fuse2/tests/sys/fs/fusefs/utils.cc Mon Aug 12 20:00:21 2019 (r350955) @@ -87,6 +87,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: projects/fuse2/tests/sys/fs/fusefs/utils.hh ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/utils.hh Mon Aug 12 19:44:57 2019 (r350954) +++ projects/fuse2/tests/sys/fs/fusefs/utils.hh Mon Aug 12 20:00:21 2019 (r350955) @@ -42,6 +42,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: projects/fuse2/tests/sys/fs/fusefs/write.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/write.cc Mon Aug 12 19:44:57 2019 (r350954) +++ projects/fuse2/tests/sys/fs/fusefs/write.cc Mon Aug 12 20:00:21 2019 (r350955) @@ -33,7 +33,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> @@ -136,17 +135,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(); } };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908122000.x7CK0Lrl006426>