From 1172c99c506ed4c3c7c8f47d3b51fb195eca5d96 Mon Sep 17 00:00:00 2001 From: Shamrock Lee <44064051+ShamrockLee@users.noreply.github.com> Date: Wed, 8 Sep 2021 02:30:30 +0800 Subject: [PATCH] nlohmann_json: enable checkPhase --- .../libraries/nlohmann_json/default.nix | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/nlohmann_json/default.nix b/pkgs/development/libraries/nlohmann_json/default.nix index e152c4fa20a8..d8ae8fcaa4ae 100644 --- a/pkgs/development/libraries/nlohmann_json/default.nix +++ b/pkgs/development/libraries/nlohmann_json/default.nix @@ -1,7 +1,16 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake +{ stdenv +, lib +, fetchFromGitHub +, cmake }: - -stdenv.mkDerivation rec { +let + testData = fetchFromGitHub { + owner = "nlohmann"; + repo = "json_test_data"; + rev = "v3.0.0"; + sha256 = "O6p2PFB7c2KE9VqWvmTaFywbW1hSzAP5V42EuemX+ls="; + }; +in stdenv.mkDerivation rec { pname = "nlohmann_json"; version = "3.10.2"; @@ -17,11 +26,14 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DBuildTests=${if doCheck then "ON" else "OFF"}" "-DJSON_MultipleHeaders=ON" - ]; + ] ++ lib.optional doCheck "-DJSON_TestDataDirectory=${testData}"; - # A test cause the build to timeout https://github.com/nlohmann/json/issues/1816 - #doCheck = stdenv.hostPlatform == stdenv.buildPlatform; - doCheck = false; + doCheck = stdenv.hostPlatform == stdenv.buildPlatform; + + # skip tests that require git or modify “installed files” + preCheck = '' + checkFlagsArray+=("ARGS=-LE 'not_reproducible|git_required'") + ''; postInstall = "rm -rf $out/lib64";