libcryfs/test/fspp/fuse/openFile/testutils/FuseOpenTest.cpp
2018-05-20 19:22:46 -07:00

22 lines
685 B
C++

#include "FuseOpenTest.h"
using cpputils::unique_ref;
using cpputils::make_unique_ref;
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) {
auto fs = TestFS();
auto fd = OpenFileAllowError(fs.get(), filename, flags);
return fd->errorcode();
}
unique_ref<OpenFileHandle> FuseOpenTest::OpenFileAllowError(const TempTestFS *fs, const char *filename, int flags) {
auto realpath = fs->mountDir() / filename;
return make_unique_ref<OpenFileHandle>(realpath.string().c_str(), flags);
}