libcryfs/test/fspp/fuse/flush/testutils/FuseFlushTest.cpp
2016-02-11 12:53:42 +01:00

20 lines
509 B
C++

#include "FuseFlushTest.h"
void FuseFlushTest::OpenAndCloseFile(const std::string &filename) {
auto fs = TestFS();
int fd = OpenFile(fs.get(), filename);
CloseFile(fd);
}
int FuseFlushTest::OpenFile(const TempTestFS *fs, const std::string &filename) {
auto real_path = fs->mountDir() / filename;
int fd = ::open(real_path.c_str(), O_RDONLY);
EXPECT_GE(fd, 0) << "Opening file failed";
return fd;
}
void FuseFlushTest::CloseFile(int fd) {
int retval = ::close(fd);
EXPECT_EQ(0, retval);
}