mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
tests/fusefs: fix all tests that depend on kern.maxphys
The tests try to read kern.maxphys sysctl into int value, while
unsigned long is required. Not sure when this was broken, seems like
since cd85379104.
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D45053
(cherry picked from commit e9b411d273336647e61704213964b995952a44fd)
This commit is contained in:
parent
927bb4aa5f
commit
57a32d76f6
5 changed files with 17 additions and 17 deletions
|
|
@ -105,8 +105,8 @@ TEST_F(Bmap, bmap)
|
|||
arg.runb = -1;
|
||||
ASSERT_EQ(0, ioctl(fd, FIOBMAP2, &arg)) << strerror(errno);
|
||||
EXPECT_EQ(arg.bn, pbn);
|
||||
EXPECT_EQ(arg.runp, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ(arg.runb, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ((unsigned long)arg.runp, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ((unsigned long)arg.runb, m_maxphys / m_maxbcachebuf - 1);
|
||||
|
||||
leak(fd);
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ TEST_F(Bmap, default_)
|
|||
arg.runb = -1;
|
||||
ASSERT_EQ(0, ioctl(fd, FIOBMAP2, &arg)) << strerror(errno);
|
||||
EXPECT_EQ(arg.bn, 0);
|
||||
EXPECT_EQ(arg.runp, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ((unsigned long )arg.runp, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ(arg.runb, 0);
|
||||
|
||||
/* In the middle */
|
||||
|
|
@ -152,8 +152,8 @@ TEST_F(Bmap, default_)
|
|||
arg.runb = -1;
|
||||
ASSERT_EQ(0, ioctl(fd, FIOBMAP2, &arg)) << strerror(errno);
|
||||
EXPECT_EQ(arg.bn, lbn * m_maxbcachebuf / DEV_BSIZE);
|
||||
EXPECT_EQ(arg.runp, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ(arg.runb, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ((unsigned long )arg.runp, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ((unsigned long )arg.runb, m_maxphys / m_maxbcachebuf - 1);
|
||||
|
||||
/* Last block */
|
||||
lbn = filesize / m_maxbcachebuf - 1;
|
||||
|
|
@ -163,7 +163,7 @@ TEST_F(Bmap, default_)
|
|||
ASSERT_EQ(0, ioctl(fd, FIOBMAP2, &arg)) << strerror(errno);
|
||||
EXPECT_EQ(arg.bn, lbn * m_maxbcachebuf / DEV_BSIZE);
|
||||
EXPECT_EQ(arg.runp, 0);
|
||||
EXPECT_EQ(arg.runb, m_maxphys / m_maxbcachebuf - 1);
|
||||
EXPECT_EQ((unsigned long )arg.runb, m_maxphys / m_maxbcachebuf - 1);
|
||||
|
||||
leak(fd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1339,7 +1339,7 @@ TEST_P(ReadAhead, readahead) {
|
|||
expect_open(ino, 0, 1);
|
||||
maxcontig = m_noclusterr ? m_maxbcachebuf :
|
||||
m_maxbcachebuf + m_maxreadahead;
|
||||
clustersize = MIN(maxcontig, m_maxphys);
|
||||
clustersize = MIN((unsigned long )maxcontig, m_maxphys);
|
||||
for (offs = 0; offs < bufsize; offs += clustersize) {
|
||||
len = std::min((size_t)clustersize, (size_t)(filesize - offs));
|
||||
expect_read(ino, offs, len, len, contents + offs);
|
||||
|
|
|
|||
|
|
@ -130,8 +130,7 @@ class FuseEnv: public Environment {
|
|||
void FuseTest::SetUp() {
|
||||
const char *maxbcachebuf_node = "vfs.maxbcachebuf";
|
||||
const char *maxphys_node = "kern.maxphys";
|
||||
int val = 0;
|
||||
size_t size = sizeof(val);
|
||||
size_t size;
|
||||
|
||||
/*
|
||||
* XXX check_environment should be called from FuseEnv::SetUp, but
|
||||
|
|
@ -141,12 +140,12 @@ void FuseTest::SetUp() {
|
|||
if (IsSkipped())
|
||||
return;
|
||||
|
||||
ASSERT_EQ(0, sysctlbyname(maxbcachebuf_node, &val, &size, NULL, 0))
|
||||
size = sizeof(m_maxbcachebuf);
|
||||
ASSERT_EQ(0, sysctlbyname(maxbcachebuf_node, &m_maxbcachebuf, &size,
|
||||
NULL, 0)) << strerror(errno);
|
||||
size = sizeof(m_maxphys);
|
||||
ASSERT_EQ(0, sysctlbyname(maxphys_node, &m_maxphys, &size, NULL, 0))
|
||||
<< strerror(errno);
|
||||
m_maxbcachebuf = val;
|
||||
ASSERT_EQ(0, sysctlbyname(maxphys_node, &val, &size, NULL, 0))
|
||||
<< strerror(errno);
|
||||
m_maxphys = val;
|
||||
/*
|
||||
* Set the default max_write to a distinct value from MAXPHYS to catch
|
||||
* bugs that confuse the two.
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class FuseTest : public ::testing::Test {
|
|||
|
||||
public:
|
||||
int m_maxbcachebuf;
|
||||
int m_maxphys;
|
||||
unsigned long m_maxphys;
|
||||
|
||||
FuseTest():
|
||||
m_maxreadahead(0),
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ virtual void SetUp() {
|
|||
if (m_maxphys < 2 * DFLTPHYS)
|
||||
GTEST_SKIP() << "MAXPHYS must be at least twice DFLTPHYS"
|
||||
<< " for this test";
|
||||
if (m_maxphys < 2 * m_maxbcachebuf)
|
||||
if (m_maxphys < 2 * (unsigned long )m_maxbcachebuf)
|
||||
GTEST_SKIP() << "MAXPHYS must be at least twice maxbcachebuf"
|
||||
<< " for this test";
|
||||
}
|
||||
|
|
@ -860,7 +860,8 @@ TEST_F(WriteMaxWrite, write)
|
|||
ssize_t halfbufsize, bufsize;
|
||||
|
||||
halfbufsize = m_mock->m_maxwrite;
|
||||
if (halfbufsize >= m_maxbcachebuf || halfbufsize >= m_maxphys)
|
||||
if (halfbufsize >= m_maxbcachebuf ||
|
||||
(unsigned long )halfbufsize >= m_maxphys)
|
||||
GTEST_SKIP() << "Must lower m_maxwrite for this test";
|
||||
bufsize = halfbufsize * 2;
|
||||
contents = new int[bufsize / sizeof(int)];
|
||||
|
|
|
|||
Loading…
Reference in a new issue