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