libcryfs/test/fspp/fuse/statfs/FuseStatfsPathParameterTest.cpp
2018-09-22 12:25:43 -07:00

48 lines
1.5 KiB
C++

#include "testutils/FuseStatfsTest.h"
using ::testing::_;
using ::testing::StrEq;
using ::testing::Return;
class FuseStatfsPathParameterTest: public FuseStatfsTest {
};
// osxfuse doesn't handle path parameters correctly
// see https://github.com/osxfuse/osxfuse/issues/538
#if !defined(__APPLE__)
TEST_F(FuseStatfsPathParameterTest, PathParameterIsCorrectRoot) {
EXPECT_CALL(fsimpl, statfs(StrEq("/"), _)).Times(1).WillOnce(Return());
Statfs("/");
}
TEST_F(FuseStatfsPathParameterTest, PathParameterIsCorrectSimpleFile) {
ReturnIsFileOnLstat("/myfile");
EXPECT_CALL(fsimpl, statfs(StrEq("/myfile"), _)).Times(1).WillOnce(Return());
Statfs("/myfile");
}
TEST_F(FuseStatfsPathParameterTest, PathParameterIsCorrectSimpleDir) {
ReturnIsDirOnLstat("/mydir");
EXPECT_CALL(fsimpl, statfs(StrEq("/mydir"), _)).Times(1).WillOnce(Return());
Statfs("/mydir");
}
TEST_F(FuseStatfsPathParameterTest, PathParameterIsCorrectNestedFile) {
ReturnIsDirOnLstat("/mydir");
ReturnIsDirOnLstat("/mydir/mydir2");
ReturnIsFileOnLstat("/mydir/mydir2/myfile");
EXPECT_CALL(fsimpl, statfs(StrEq("/mydir/mydir2/myfile"), _)).Times(1).WillOnce(Return());
Statfs("/mydir/mydir2/myfile");
}
TEST_F(FuseStatfsPathParameterTest, PathParameterIsCorrectNestedDir) {
ReturnIsDirOnLstat("/mydir");
ReturnIsDirOnLstat("/mydir/mydir2");
ReturnIsDirOnLstat("/mydir/mydir2/mydir3");
EXPECT_CALL(fsimpl, statfs(StrEq("/mydir/mydir2/mydir3"), _)).Times(1).WillOnce(Return());
Statfs("/mydir/mydir2/mydir3");
}
#endif