libcryfs/test/fuse/mkdir/testutils/FuseMkdirTest.cpp
2015-02-17 00:48:49 +01:00

28 lines
648 B
C++

#include "FuseMkdirTest.h"
using ::testing::Action;
using ::testing::Invoke;
void FuseMkdirTest::Mkdir(const char *dirname, mode_t mode) {
int error = MkdirReturnError(dirname, mode);
EXPECT_EQ(0, error);
}
int FuseMkdirTest::MkdirReturnError(const char *dirname, mode_t mode) {
auto fs = TestFS();
auto realpath = fs->mountDir() / dirname;
int retval = ::mkdir(realpath.c_str(), mode);
if (retval == 0) {
return 0;
} else {
return errno;
}
}
Action<void(const char*, mode_t)> FuseMkdirTest::FromNowOnReturnIsDirOnLstat() {
return Invoke([this](const char *dirname, mode_t) {
ReturnIsDirOnLstat(dirname);
});
}