summary refs log tree commit diff
path: root/pkgs/tools/filesystems/cryfs
diff options
context:
space:
mode:
authoradisbladis <adis@blad.is>2017-10-13 23:29:20 +0800
committeradisbladis <adis@blad.is>2017-10-13 23:29:20 +0800
commit7a86e4cf0d15cd33cd742b1e15b329367ed8362d (patch)
treed39e72934aa5a5961d02f2d459b584d144f4b7a1 /pkgs/tools/filesystems/cryfs
parent8efe90a3f45d0b3be2fa266c51875c1fd1dc0998 (diff)
downloadnixlib-7a86e4cf0d15cd33cd742b1e15b329367ed8362d.tar
nixlib-7a86e4cf0d15cd33cd742b1e15b329367ed8362d.tar.gz
nixlib-7a86e4cf0d15cd33cd742b1e15b329367ed8362d.tar.bz2
nixlib-7a86e4cf0d15cd33cd742b1e15b329367ed8362d.tar.lz
nixlib-7a86e4cf0d15cd33cd742b1e15b329367ed8362d.tar.xz
nixlib-7a86e4cf0d15cd33cd742b1e15b329367ed8362d.tar.zst
nixlib-7a86e4cf0d15cd33cd742b1e15b329367ed8362d.zip
cryfs: Enable tests
Diffstat (limited to 'pkgs/tools/filesystems/cryfs')
-rw-r--r--pkgs/tools/filesystems/cryfs/default.nix25
-rw-r--r--pkgs/tools/filesystems/cryfs/skip-failing-test-large-malloc.patch34
-rw-r--r--pkgs/tools/filesystems/cryfs/test-no-network.patch24
3 files changed, 82 insertions, 1 deletions
diff --git a/pkgs/tools/filesystems/cryfs/default.nix b/pkgs/tools/filesystems/cryfs/default.nix
index 5d5d23d4ed3e..0469ad54eb13 100644
--- a/pkgs/tools/filesystems/cryfs/default.nix
+++ b/pkgs/tools/filesystems/cryfs/default.nix
@@ -35,6 +35,11 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ boost cryptopp curl fuse openssl python spdlog ];
 
+  patches = [
+    ./test-no-network.patch  # Disable tests using external networking
+    ./skip-failing-test-large-malloc.patch
+  ];
+
   # coreutils is needed for the vendored scrypt
   nativeBuildInputs = [ cmake coreutils pkgconfig ];
 
@@ -43,9 +48,27 @@ stdenv.mkDerivation rec {
   cmakeFlags = [
     "-DCRYFS_UPDATE_CHECKS=OFF"
     "-DBoost_USE_STATIC_LIBS=OFF" # this option is case sensitive
-    "-DBUILD_TESTING=OFF"
+    "-DBUILD_TESTING=ON"
   ];
 
+  doCheck = true;
+
+  # Cryfs tests are broken on darwin
+  checkPhase = stdenv.lib.optionalString (!stdenv.isDarwin) ''
+    # Skip CMakeFiles directory and tests depending on fuse (does not work well with sandboxing)
+    SKIP_IMPURE_TESTS="CMakeFiles|fspp|cryfs-cli"
+
+    for test in `ls -d test/*/ | egrep -v "$SKIP_IMPURE_TESTS"`; do
+      "./$test`basename $test`-test"
+    done
+  '';
+
+  installPhase = ''
+    # Building with BUILD_TESTING=ON is missing the install target
+    mkdir -p $out/bin
+    install -m 755 ./src/cryfs-cli/cryfs $out/bin/cryfs
+  '';
+
   meta = with stdenv.lib; {
     description = "Cryptographic filesystem for the cloud";
     homepage    = https://www.cryfs.org;
diff --git a/pkgs/tools/filesystems/cryfs/skip-failing-test-large-malloc.patch b/pkgs/tools/filesystems/cryfs/skip-failing-test-large-malloc.patch
new file mode 100644
index 000000000000..feb0ed9cfbb9
--- /dev/null
+++ b/pkgs/tools/filesystems/cryfs/skip-failing-test-large-malloc.patch
@@ -0,0 +1,34 @@
+From ad3f7e9fa2dececfaab43963887a2f03de52d659 Mon Sep 17 00:00:00 2001
+From: adisbladis <adis@blad.is>
+Date: Thu, 12 Oct 2017 21:45:26 +0800
+Subject: [PATCH] Skip failing test: large malloc
+
+---
+ test/cpp-utils/data/DataTest.cpp | 11 -----------
+ 1 file changed, 11 deletions(-)
+
+diff --git a/test/cpp-utils/data/DataTest.cpp b/test/cpp-utils/data/DataTest.cpp
+index 6f9df070..bd426e62 100644
+--- a/test/cpp-utils/data/DataTest.cpp
++++ b/test/cpp-utils/data/DataTest.cpp
+@@ -191,17 +191,6 @@ TEST_F(DataTest, Inequality_DifferentLastByte) {
+   EXPECT_TRUE(data1 != data2);
+ }
+ 
+-#ifdef __x86_64__
+-TEST_F(DataTest, LargesizeSize) {
+-  //Needs 64bit for representation. This value isn't in the size param list, because the list is also used for read/write checks.
+-  uint64_t size = 4.5L*1024*1024*1024;
+-  Data data(size);
+-  EXPECT_EQ(size, data.size());
+-}
+-#else
+-#warning This is not a 64bit architecture. Large size data tests are disabled.
+-#endif
+-
+ TEST_F(DataTest, LoadingNonexistingFile) {
+   TempFile file(false); // Pass false to constructor, so the tempfile is not created
+   EXPECT_FALSE(Data::LoadFromFile(file.path()));
+-- 
+2.14.2
+
diff --git a/pkgs/tools/filesystems/cryfs/test-no-network.patch b/pkgs/tools/filesystems/cryfs/test-no-network.patch
new file mode 100644
index 000000000000..3392d3f855ec
--- /dev/null
+++ b/pkgs/tools/filesystems/cryfs/test-no-network.patch
@@ -0,0 +1,24 @@
+From 8b1808e1278d2cb0dc56a4e98781eceeadfb9718 Mon Sep 17 00:00:00 2001
+From: adisbladis <adis@blad.is>
+Date: Thu, 12 Oct 2017 18:13:28 +0800
+Subject: [PATCH] Disable tests using external networking
+
+---
+ test/cpp-utils/CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/test/cpp-utils/CMakeLists.txt b/test/cpp-utils/CMakeLists.txt
+index 5a2bc9f8..d838edba 100644
+--- a/test/cpp-utils/CMakeLists.txt
++++ b/test/cpp-utils/CMakeLists.txt
+@@ -20,7 +20,6 @@ set(SOURCES
+     tempfile/TempFileIncludeTest.cpp
+     tempfile/TempDirIncludeTest.cpp
+     tempfile/TempDirTest.cpp
+-    network/CurlHttpClientTest.cpp
+     network/FakeHttpClientTest.cpp
+     io/ConsoleIncludeTest.cpp
+     io/ConsoleTest_AskYesNo.cpp
+-- 
+2.14.2
+