2014-11-28 17:40:54 +01:00
|
|
|
#include "FuseRenameTest.h"
|
|
|
|
|
|
|
|
using ::testing::Action;
|
|
|
|
using ::testing::Invoke;
|
|
|
|
|
|
|
|
void FuseRenameTest::Rename(const char *from, const char *to) {
|
2014-12-06 15:33:01 +01:00
|
|
|
int error = RenameReturnError(from, to);
|
|
|
|
EXPECT_EQ(0, error);
|
2014-11-28 17:40:54 +01:00
|
|
|
}
|
|
|
|
|
2014-12-06 15:33:01 +01:00
|
|
|
int FuseRenameTest::RenameReturnError(const char *from, const char *to) {
|
2014-11-28 17:40:54 +01:00
|
|
|
auto fs = TestFS();
|
|
|
|
|
|
|
|
auto realfrom = fs->mountDir() / from;
|
|
|
|
auto realto = fs->mountDir() / to;
|
2014-12-06 15:33:01 +01:00
|
|
|
int retval = ::rename(realfrom.c_str(), realto.c_str());
|
|
|
|
if (0 == retval) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return errno;
|
|
|
|
}
|
2014-11-28 17:40:54 +01:00
|
|
|
}
|