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) {
|
2014-12-06 15:33:01 +01:00
|
|
|
int error = MkdirReturnError(dirname, mode);
|
|
|
|
EXPECT_EQ(0, error);
|
2014-11-28 15:54:18 +01:00
|
|
|
}
|
|
|
|
|
2014-12-06 15:33:01 +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;
|
2018-05-21 01:20:38 +02:00
|
|
|
int retval = ::mkdir(realpath.string().c_str(), mode);
|
2014-12-06 15:33:01 +01:00
|
|
|
if (retval == 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return errno;
|
|
|
|
}
|
2014-11-28 15:54:18 +01:00
|
|
|
}
|
|
|
|
|
2019-10-13 17:49:57 +02:00
|
|
|
Action<void(const boost::filesystem::path&, mode_t, uid_t, gid_t)> FuseMkdirTest::FromNowOnReturnIsDirOnLstat() {
|
|
|
|
return Invoke([this](const boost::filesystem::path& 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
|
|
|
});
|
|
|
|
}
|