2014-11-28 22:11:26 +01:00
|
|
|
#include "testutils/FuseStatfsTest.h"
|
|
|
|
|
2018-05-21 08:18:34 +02:00
|
|
|
#include "fspp/fs_interface/FuseErrnoException.h"
|
2014-11-28 22:11:26 +01:00
|
|
|
|
|
|
|
using ::testing::_;
|
|
|
|
using ::testing::Throw;
|
|
|
|
using ::testing::Return;
|
|
|
|
using ::testing::WithParamInterface;
|
|
|
|
using ::testing::Values;
|
|
|
|
|
|
|
|
using fspp::fuse::FuseErrnoException;
|
|
|
|
|
|
|
|
class FuseStatfsErrorTest: public FuseStatfsTest, public WithParamInterface<int> {
|
|
|
|
public:
|
|
|
|
};
|
2019-10-13 14:16:06 +02:00
|
|
|
INSTANTIATE_TEST_SUITE_P(FuseStatfsErrorTest, FuseStatfsErrorTest, Values(EACCES, EBADF, EFAULT, EINTR, EIO, ELOOP, ENAMETOOLONG, ENOENT, ENOMEM, ENOSYS, ENOTDIR, EOVERFLOW));
|
2014-11-28 22:11:26 +01:00
|
|
|
|
|
|
|
TEST_F(FuseStatfsErrorTest, ReturnNoError) {
|
|
|
|
ReturnIsFileOnLstat(FILENAME);
|
2018-12-03 07:57:21 +01:00
|
|
|
EXPECT_CALL(*fsimpl, statfs(_)).Times(1).WillOnce(Return());
|
2014-12-06 15:33:01 +01:00
|
|
|
int error = StatfsReturnError(FILENAME);
|
|
|
|
EXPECT_EQ(0, error);
|
2014-11-28 22:11:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_P(FuseStatfsErrorTest, ReturnError) {
|
|
|
|
ReturnIsFileOnLstat(FILENAME);
|
2018-12-03 07:57:21 +01:00
|
|
|
EXPECT_CALL(*fsimpl, statfs( _)).Times(1).WillOnce(Throw(FuseErrnoException(GetParam())));
|
2014-12-06 15:33:01 +01:00
|
|
|
int error = StatfsReturnError(FILENAME);
|
|
|
|
EXPECT_EQ(GetParam(), error);
|
2014-11-28 22:11:26 +01:00
|
|
|
}
|