2014-11-28 14:13:51 +01:00
|
|
|
#include "FuseAccessTest.h"
|
|
|
|
|
|
|
|
void FuseAccessTest::AccessFile(const char *filename, int mode) {
|
2014-12-06 15:33:01 +01:00
|
|
|
int error = AccessFileReturnError(filename, mode);
|
|
|
|
EXPECT_EQ(0, error);
|
2014-11-28 14:13:51 +01:00
|
|
|
}
|
|
|
|
|
2014-12-06 15:33:01 +01:00
|
|
|
int FuseAccessTest::AccessFileReturnError(const char *filename, int mode) {
|
2014-11-28 14:13:51 +01:00
|
|
|
auto fs = TestFS();
|
|
|
|
|
|
|
|
auto realpath = fs->mountDir() / filename;
|
2018-05-21 01:20:38 +02:00
|
|
|
int retval = ::access(realpath.string().c_str(), mode);
|
2014-12-06 15:33:01 +01:00
|
|
|
if (retval == 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return errno;
|
|
|
|
}
|
2014-11-28 14:13:51 +01:00
|
|
|
}
|