libcryfs/test/fspp/fuse/mkdir/testutils/FuseMkdirTest.cpp

28 lines
676 B
C++
Raw Normal View History

2015-02-17 00:48:49 +01:00
#include "FuseMkdirTest.h"
2014-11-28 15:54:18 +01:00
using ::testing::Action;
using ::testing::Invoke;
void FuseMkdirTest::Mkdir(const char *dirname, mode_t mode) {
int error = MkdirReturnError(dirname, mode);
EXPECT_EQ(0, error);
2014-11-28 15:54:18 +01:00
}
int FuseMkdirTest::MkdirReturnError(const char *dirname, mode_t mode) {
2014-11-28 15:54:18 +01:00
auto fs = TestFS();
auto realpath = fs->mountDir() / dirname;
int retval = ::mkdir(realpath.c_str(), mode);
if (retval == 0) {
return 0;
} else {
return errno;
}
2014-11-28 15:54:18 +01:00
}
Action<void(const char*, mode_t, uid_t, gid_t)> FuseMkdirTest::FromNowOnReturnIsDirOnLstat() {
return Invoke([this](const char *dirname, mode_t, uid_t, gid_t) {
2014-11-28 16:06:28 +01:00
ReturnIsDirOnLstat(dirname);
2014-11-28 15:54:18 +01:00
});
}