libcryfs/test/fspp/fuse/openFile/testutils/FuseOpenTest.cpp

22 lines
685 B
C++
Raw Normal View History

2014-11-20 21:23:35 +01:00
#include "FuseOpenTest.h"
using cpputils::unique_ref;
using cpputils::make_unique_ref;
2014-11-20 21:23:35 +01:00
void FuseOpenTest::OpenFile(const char *filename, int flags) {
auto fs = TestFS();
auto fd = OpenFileAllowError(fs.get(), filename, flags);
EXPECT_GE(fd->fd(), 0);
}
int FuseOpenTest::OpenFileReturnError(const char *filename, int flags) {
2014-11-20 21:23:35 +01:00
auto fs = TestFS();
auto fd = OpenFileAllowError(fs.get(), filename, flags);
return fd->errorcode();
}
2014-11-20 21:23:35 +01:00
unique_ref<OpenFileHandle> FuseOpenTest::OpenFileAllowError(const TempTestFS *fs, const char *filename, int flags) {
2014-11-20 21:23:35 +01:00
auto realpath = fs->mountDir() / filename;
return make_unique_ref<OpenFileHandle>(realpath.string().c_str(), flags);
2014-11-20 21:23:35 +01:00
}