Use the fspp test cases for cryfs

This commit is contained in:
Sebastian Meßmer 2015-03-16 02:15:51 +01:00
parent 26bdd6ff3a
commit 662c3f8e90
4 changed files with 44 additions and 0 deletions

View File

@ -1,5 +1,7 @@
INCLUDE(messmer/cmake/tools)
SETUP_GOOGLETEST()
# Actually create targets: EXEcutables and libraries.
ADD_BIICODE_TARGETS()

View File

@ -1,11 +1,13 @@
# Biicode configuration file
[requirements]
google/gtest: 10
messmer/blobstore: 0
messmer/blockstore: 1
messmer/cmake: 3
messmer/cpp-utils: 2
messmer/fspp: 0
messmer/tempfile: 4
[parent]
messmer/cryfs: 0
@ -18,6 +20,7 @@
# Manual adjust file implicit dependencies, add (+), remove (-), or overwrite (=)
# hello.h + hello_imp.cpp hello_imp2.cpp
# *.h + *.cpp
test/main.cpp + test/*.cpp
[mains]
# Manual adjust of files that define an executable
@ -39,3 +42,5 @@
# when loading from disk such data
# image.cpp + image.jpg # code should write open("user/block/image.jpg")
#[tests]
# test/*

31
test/FileSystemTest.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <messmer/blockstore/implementations/testfake/FakeBlockStore.h>
#include <messmer/fspp/fstest/FsTest.h>
#include <messmer/tempfile/src/TempFile.h>
#include "../src/CryDevice.h"
using std::unique_ptr;
using std::make_unique;
using fspp::Device;
using blockstore::testfake::FakeBlockStore;
using namespace cryfs;
class CryFsTestFixture: public FileSystemTestFixture {
public:
CryFsTestFixture()
// Don't create config tempfile yet
: configFile(false) {}
unique_ptr<Device> createDevice() override {
auto blockStore = make_unique<FakeBlockStore>();
auto config = make_unique<CryConfig>(configFile.path());
return make_unique<CryDevice>(std::move(config), std::move(blockStore));
}
tempfile::TempFile configFile;
};
INSTANTIATE_TYPED_TEST_CASE_P(CryFS, FileSystemTest, CryFsTestFixture);

6
test/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "google/gtest/gtest.h"
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}