2014-11-28 16:06:28 +01:00
|
|
|
#include "FuseRmdirTest.h"
|
|
|
|
|
|
|
|
using ::testing::Action;
|
|
|
|
using ::testing::Invoke;
|
|
|
|
|
|
|
|
void FuseRmdirTest::Rmdir(const char *dirname) {
|
2014-12-06 15:33:01 +01:00
|
|
|
int error = RmdirReturnError(dirname);
|
|
|
|
EXPECT_EQ(0, error);
|
2014-11-28 16:06:28 +01:00
|
|
|
}
|
|
|
|
|
2014-12-06 15:33:01 +01:00
|
|
|
int FuseRmdirTest::RmdirReturnError(const char *dirname) {
|
2014-11-28 16:06:28 +01:00
|
|
|
auto fs = TestFS();
|
|
|
|
|
|
|
|
auto realpath = fs->mountDir() / dirname;
|
2018-05-21 01:20:38 +02:00
|
|
|
int retval = ::rmdir(realpath.string().c_str());
|
2014-12-06 15:33:01 +01:00
|
|
|
if (retval == 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return errno;
|
|
|
|
}
|
2014-11-28 16:06:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Action<void(const char*)> FuseRmdirTest::FromNowOnReturnDoesntExistOnLstat() {
|
|
|
|
return Invoke([this](const char *dirname) {
|
|
|
|
ReturnDoesntExistOnLstat(dirname);
|
|
|
|
});
|
|
|
|
}
|