Fix some more fuse tests

This commit is contained in:
Sebastian Messmer 2016-02-14 02:23:54 +01:00
parent 190d465cf3
commit 80b113f0f1
3 changed files with 6 additions and 4 deletions

View File

@ -42,7 +42,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
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)
target_link_libraries(${PROJECT_NAME} PUBLIC ${CryptoPP} scrypt spdlog)

View File

@ -7,6 +7,7 @@ using ::testing::StrEq;
using ::testing::Throw;
using ::testing::WithParamInterface;
using ::testing::Values;
using ::testing::AtLeast;
using namespace fspp::fuse;
@ -17,7 +18,7 @@ INSTANTIATE_TEST_CASE_P(FuseAccessErrorTest, FuseAccessErrorTest, Values(EACCES,
TEST_P(FuseAccessErrorTest, ReturnedErrorIsCorrect) {
ReturnIsFileOnLstat(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);
EXPECT_EQ(GetParam(), error);

View File

@ -19,7 +19,6 @@ MockFilesystem::~MockFilesystem() {}
FuseTest::FuseTest(): fsimpl() {
auto defaultAction = Throw(FuseErrnoException(EIO));
auto successAction = Return();
ON_CALL(fsimpl, openFile(_,_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, closeFile(_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, lstat(_,_)).WillByDefault(Throw(FuseErrnoException(ENOENT)));
@ -30,7 +29,7 @@ FuseTest::FuseTest(): fsimpl() {
ON_CALL(fsimpl, write(_,_,_,_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, fsync(_)).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, mkdir(_,_,_,_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, rmdir(_)).WillByDefault(defaultAction);
@ -45,6 +44,8 @@ FuseTest::FuseTest(): fsimpl() {
ON_CALL(fsimpl, chown(_,_,_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, createSymlink(_,_,_,_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, readSymlink(_,_,_)).WillByDefault(defaultAction);
EXPECT_CALL(fsimpl, access(_,_)).WillRepeatedly(Return());
ReturnIsDirOnLstat("/");
}