mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-13 14:40:22 +00:00
fusefs: skip some tests when unsafe aio is disabled
MFC after: 16 days MFC-With: r350665 Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
17e49888f6
commit
c2265ae7a8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/fuse2/; revision=350955
@ -80,8 +80,17 @@ void expect_write(uint64_t ino, uint64_t size, const void *contents)
|
||||
|
||||
};
|
||||
|
||||
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";
|
||||
|
@ -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";
|
||||
|
@ -71,17 +71,10 @@ void expect_lookup(const char *relpath, uint64_t ino, uint64_t size)
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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() {
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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, uint64_t size)
|
||||
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user