mirror of
https://github.com/vgough/encfs.git
synced 2024-11-21 23:43:26 +01:00
move unit tests and integration tests to separate dirs
This commit is contained in:
parent
93dc3183d7
commit
6d130cda8b
@ -280,25 +280,18 @@ endif (POD2MAN)
|
||||
if (BUILD_UNIT_TESTS)
|
||||
enable_testing()
|
||||
|
||||
message("-- Including vendored googletest")
|
||||
set(GOOGLETEST_DIR vendor/github.com/google/googletest)
|
||||
add_subdirectory(${GOOGLETEST_DIR})
|
||||
link_directories(${CMAKE_BINARY_DIR}/${GOOGLETEST_DIR}/googletest)
|
||||
|
||||
message("-- Including vendored benchmark library")
|
||||
set(GOOGLEBENCH_DIR vendor/github.com/google/benchmark)
|
||||
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "benchmark tests")
|
||||
add_subdirectory(${GOOGLEBENCH_DIR})
|
||||
link_directories(${CMAKE_BINARY_DIR}/${GOOGLEBENCH_DIR})
|
||||
|
||||
file(GLOB_RECURSE TEST_SOURCES "encfs/*_test.cpp")
|
||||
add_executable (unittests ${TEST_SOURCES})
|
||||
target_link_libraries(unittests gtest gtest_main encfs)
|
||||
add_test(unit unittests)
|
||||
# Unit tests.
|
||||
add_subdirectory(test)
|
||||
|
||||
file(GLOB_RECURSE BENCH_SOURCES "encfs/*_bench.cpp")
|
||||
add_executable (benchmarks ${BENCH_SOURCES})
|
||||
target_link_libraries(benchmarks benchmark encfs)
|
||||
# Integration test target - runs against built encfs.
|
||||
add_custom_target(integration COMMAND ${CMAKE_CURRENT_LIST_DIR}/integration.sh)
|
||||
endif ()
|
||||
|
||||
add_custom_target(tests COMMAND ${CMAKE_CURRENT_LIST_DIR}/test.sh)
|
||||
|
6
integration.sh
Executable file
6
integration.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash -eux
|
||||
|
||||
# Make sure we are in the directory this script is in.
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
perl -MTest::Harness -e '$$Test::Harness::debug=1; runtests @ARGV;' integration/*.t.pl
|
@ -5,7 +5,7 @@
|
||||
use File::Temp;
|
||||
use warnings;
|
||||
|
||||
require("tests/common.pl");
|
||||
require("integration/common.pl");
|
||||
|
||||
sub mount_encfs_reverse {
|
||||
my $p = shift;
|
@ -5,7 +5,7 @@
|
||||
use File::Temp;
|
||||
use warnings;
|
||||
|
||||
require("tests/common.pl");
|
||||
require("integration/common.pl");
|
||||
|
||||
# Create a new empty working directory
|
||||
sub newWorkingDir {
|
||||
@ -58,7 +58,7 @@ sub mount_ecryptfs {
|
||||
mkdir($c);
|
||||
mkdir($p);
|
||||
|
||||
system("expect -c \"spawn mount -t ecryptfs $c $p\" ./tests/mount-ecryptfs.expect > /dev/null") == 0
|
||||
system("expect -c \"spawn mount -t ecryptfs $c $p\" ./integration/mount-ecryptfs.expect > /dev/null") == 0
|
||||
or die("ecryptfs mount failed - are you root?");
|
||||
|
||||
print "# ecryptfs mounted on $p\n";
|
@ -8,7 +8,7 @@ use File::Copy;
|
||||
use File::Temp;
|
||||
use IO::Handle;
|
||||
|
||||
require("tests/common.pl");
|
||||
require("integration/common.pl");
|
||||
|
||||
my $tempDir = $ENV{'TMPDIR'} || "/tmp";
|
||||
|
@ -9,7 +9,7 @@ use File::Temp;
|
||||
use IO::Handle;
|
||||
use Errno qw(EROFS);
|
||||
|
||||
require("tests/common.pl");
|
||||
require("integration/common.pl");
|
||||
|
||||
my $tempDir = $ENV{'TMPDIR'} || "/tmp";
|
||||
|
10
test.sh
10
test.sh
@ -1,10 +0,0 @@
|
||||
#!/bin/bash -eux
|
||||
|
||||
# Make sure we are in the directory this script is in.
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# This is very noisy so run it silently at first. Run it again with
|
||||
# output if the first run fails.
|
||||
./build/checkops &> /dev/null || ./build/checkops
|
||||
|
||||
perl -MTest::Harness -e '$$Test::Harness::debug=1; runtests @ARGV;' tests/*.t.pl
|
10
test/CMakeLists.txt
Normal file
10
test/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
file(GLOB_RECURSE TEST_SOURCES "*_test.cpp")
|
||||
add_executable (unittests ${TEST_SOURCES})
|
||||
target_link_libraries(unittests gtest gtest_main encfs)
|
||||
add_test(unit unittests)
|
||||
|
||||
file(GLOB_RECURSE BENCH_SOURCES "*_bench.cpp")
|
||||
add_executable (benchmarks ${BENCH_SOURCES})
|
||||
target_link_libraries(benchmarks benchmark encfs)
|
||||
|
||||
add_custom_target(integration COMMAND ${CMAKE_CURRENT_LIST_DIR}/integration.sh)
|
@ -1,12 +1,12 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "BlockNameIO.h"
|
||||
#include "Cipher.h"
|
||||
#include "CipherKey.h"
|
||||
#include "DirNode.h"
|
||||
#include "FSConfig.h"
|
||||
#include "FileUtils.h"
|
||||
#include "StreamNameIO.h"
|
||||
#include "encfs/BlockNameIO.h"
|
||||
#include "encfs/Cipher.h"
|
||||
#include "encfs/CipherKey.h"
|
||||
#include "encfs/DirNode.h"
|
||||
#include "encfs/FSConfig.h"
|
||||
#include "encfs/FileUtils.h"
|
||||
#include "encfs/StreamNameIO.h"
|
||||
|
||||
using namespace encfs;
|
||||
using namespace testing;
|
@ -1,6 +1,6 @@
|
||||
#include "benchmark/benchmark.h"
|
||||
|
||||
#include "MemoryPool.h"
|
||||
#include "encfs/MemoryPool.h"
|
||||
|
||||
using namespace encfs;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "MemoryPool.h"
|
||||
#include "encfs/MemoryPool.h"
|
||||
|
||||
using namespace encfs;
|
||||
|
Loading…
Reference in New Issue
Block a user