Fix some more fuse tests
This commit is contained in:
parent
190d465cf3
commit
80b113f0f1
@ -42,7 +42,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE pthread curl)
|
target_link_libraries(${PROJECT_NAME} PRIVATE pthread curl)
|
||||||
|
|
||||||
# TODO From Crypto++ 5.7 on, it should support cmake with find_package().
|
# TODO From Crypto++ 5.7 on, it should support cmake with find_package() instead of find_library().
|
||||||
find_library(CryptoPP cryptopp)
|
find_library(CryptoPP cryptopp)
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${CryptoPP} scrypt spdlog)
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${CryptoPP} scrypt spdlog)
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using ::testing::StrEq;
|
|||||||
using ::testing::Throw;
|
using ::testing::Throw;
|
||||||
using ::testing::WithParamInterface;
|
using ::testing::WithParamInterface;
|
||||||
using ::testing::Values;
|
using ::testing::Values;
|
||||||
|
using ::testing::AtLeast;
|
||||||
|
|
||||||
using namespace fspp::fuse;
|
using namespace fspp::fuse;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ INSTANTIATE_TEST_CASE_P(FuseAccessErrorTest, FuseAccessErrorTest, Values(EACCES,
|
|||||||
TEST_P(FuseAccessErrorTest, ReturnedErrorIsCorrect) {
|
TEST_P(FuseAccessErrorTest, ReturnedErrorIsCorrect) {
|
||||||
ReturnIsFileOnLstat(FILENAME);
|
ReturnIsFileOnLstat(FILENAME);
|
||||||
EXPECT_CALL(fsimpl, access(StrEq(FILENAME), _))
|
EXPECT_CALL(fsimpl, access(StrEq(FILENAME), _))
|
||||||
.Times(1).WillOnce(Throw(FuseErrnoException(GetParam())));
|
.Times(AtLeast(1)).WillRepeatedly(Throw(FuseErrnoException(GetParam())));
|
||||||
|
|
||||||
int error = AccessFileReturnError(FILENAME, 0);
|
int error = AccessFileReturnError(FILENAME, 0);
|
||||||
EXPECT_EQ(GetParam(), error);
|
EXPECT_EQ(GetParam(), error);
|
||||||
|
@ -19,7 +19,6 @@ MockFilesystem::~MockFilesystem() {}
|
|||||||
|
|
||||||
FuseTest::FuseTest(): fsimpl() {
|
FuseTest::FuseTest(): fsimpl() {
|
||||||
auto defaultAction = Throw(FuseErrnoException(EIO));
|
auto defaultAction = Throw(FuseErrnoException(EIO));
|
||||||
auto successAction = Return();
|
|
||||||
ON_CALL(fsimpl, openFile(_,_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, openFile(_,_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, closeFile(_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, closeFile(_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, lstat(_,_)).WillByDefault(Throw(FuseErrnoException(ENOENT)));
|
ON_CALL(fsimpl, lstat(_,_)).WillByDefault(Throw(FuseErrnoException(ENOENT)));
|
||||||
@ -30,7 +29,7 @@ FuseTest::FuseTest(): fsimpl() {
|
|||||||
ON_CALL(fsimpl, write(_,_,_,_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, write(_,_,_,_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, fsync(_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, fsync(_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, fdatasync(_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, fdatasync(_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, access(_,_)).WillByDefault(successAction);
|
ON_CALL(fsimpl, access(_,_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, createAndOpenFile(_,_,_,_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, createAndOpenFile(_,_,_,_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, mkdir(_,_,_,_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, mkdir(_,_,_,_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, rmdir(_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, rmdir(_)).WillByDefault(defaultAction);
|
||||||
@ -45,6 +44,8 @@ FuseTest::FuseTest(): fsimpl() {
|
|||||||
ON_CALL(fsimpl, chown(_,_,_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, chown(_,_,_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, createSymlink(_,_,_,_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, createSymlink(_,_,_,_)).WillByDefault(defaultAction);
|
||||||
ON_CALL(fsimpl, readSymlink(_,_,_)).WillByDefault(defaultAction);
|
ON_CALL(fsimpl, readSymlink(_,_,_)).WillByDefault(defaultAction);
|
||||||
|
|
||||||
|
EXPECT_CALL(fsimpl, access(_,_)).WillRepeatedly(Return());
|
||||||
ReturnIsDirOnLstat("/");
|
ReturnIsDirOnLstat("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user