2014-11-17 21:13:58 +01:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "gmock/gmock.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <thread>
|
|
|
|
#include <csignal>
|
2014-11-19 00:15:37 +01:00
|
|
|
#include <fcntl.h>
|
2014-11-17 21:13:58 +01:00
|
|
|
|
2014-11-18 00:14:33 +01:00
|
|
|
#include "cryfs_lib/CryDevice.h"
|
|
|
|
#include "test/testutils/FuseThread.h"
|
|
|
|
|
2014-11-17 21:13:58 +01:00
|
|
|
#include "fspp/fuse/Fuse.h"
|
2014-11-19 00:25:57 +01:00
|
|
|
#include "test/testutils/FuseTest.h"
|
2014-11-17 21:13:58 +01:00
|
|
|
|
|
|
|
using namespace fspp;
|
|
|
|
using namespace fspp::fuse;
|
|
|
|
using std::string;
|
|
|
|
using std::unique_ptr;
|
2014-11-19 00:15:37 +01:00
|
|
|
using std::make_unique;
|
2014-11-17 21:13:58 +01:00
|
|
|
using std::vector;
|
2014-11-17 21:29:23 +01:00
|
|
|
using ::testing::Return;
|
2014-11-19 00:15:37 +01:00
|
|
|
using ::testing::_;
|
|
|
|
using ::testing::Invoke;
|
|
|
|
using ::testing::Throw;
|
|
|
|
using ::testing::NiceMock;
|
|
|
|
using ::testing::StrictMock;
|
|
|
|
using ::testing::AtMost;
|
|
|
|
using ::testing::Mock;
|
|
|
|
using ::testing::StrEq;
|
2014-11-17 21:13:58 +01:00
|
|
|
|
2014-11-17 21:29:23 +01:00
|
|
|
TEST_F(FuseTest, setupAndTearDown) {
|
|
|
|
//This test case simply checks whether a filesystem can be setup and teardown without crashing.
|
2014-11-19 00:15:37 +01:00
|
|
|
auto fs = TestFS();
|
2014-11-17 21:29:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseTest, openFile) {
|
2014-11-19 00:15:37 +01:00
|
|
|
const char *filename = "/myfile";
|
2014-11-19 00:38:41 +01:00
|
|
|
EXPECT_CALL(fsimpl, lstat(StrEq(filename), _)).WillOnce(ReturnIsFileStat);
|
2014-11-19 00:31:47 +01:00
|
|
|
EXPECT_CALL(fsimpl, openFile(StrEq(filename), OpenFlagsEq(O_RDWR)))
|
|
|
|
.Times(1);
|
2014-11-19 00:15:37 +01:00
|
|
|
|
|
|
|
auto fs = TestFS();
|
|
|
|
|
|
|
|
auto realpath = fs->mountDir() / filename;
|
|
|
|
::open(realpath.c_str(), O_RDWR);
|
2014-11-17 21:13:58 +01:00
|
|
|
}
|