diff options
-rw-r--r-- | pkgs/development/libraries/glog/default.nix | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/development/libraries/glog/default.nix index a64bb0967aa7b..85e9770f989e3 100644 --- a/pkgs/development/libraries/glog/default.nix +++ b/pkgs/development/libraries/glog/default.nix @@ -19,24 +19,48 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" + # glog's custom FindUnwind.cmake module detects LLVM's unwind in case + # stdenv.cc is clang. But the module doesn't get installed, causing + # consumers of the CMake config file to fail at the configuration step. + # Explicitly disabling unwind support sidesteps the issue. + "-DWITH_UNWIND=OFF" ]; - # TODO: Re-enable Darwin tests once we're on a release that has https://github.com/google/glog/issues/709#issuecomment-960381653 fixed - doCheck = !stdenv.isDarwin; + doCheck = true; + # There are some non-thread safe tests that can fail enableParallelChecking = false; nativeCheckInputs = [ perl ]; - GTEST_FILTER = + env.GTEST_FILTER = let filteredTests = lib.optionals stdenv.hostPlatform.isMusl [ "Symbolize.SymbolizeStackConsumption" "Symbolize.SymbolizeWithDemanglingStackConsumption" ] ++ lib.optionals stdenv.hostPlatform.isStatic [ "LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled" + ] ++ lib.optionals stdenv.cc.isClang [ + # Clang optimizes an expected allocation away. + # See https://github.com/google/glog/issues/937 + "DeathNoAllocNewHook.logging" + ] ++ lib.optionals stdenv.isDarwin [ + "LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled" + ]; + in + "-${builtins.concatStringsSep ":" filteredTests}"; + + checkPhase = + let + excludedTests = lib.optionals stdenv.isDarwin [ + "mock-log" ]; + excludedTestsRegex = lib.optionalString (excludedTests != [ ]) "(${lib.concatStringsSep "|" excludedTests})"; in - lib.optionalString doCheck "-${builtins.concatStringsSep ":" filteredTests}"; + '' + runHook preCheck + ctest -E "${excludedTestsRegex}" --output-on-failure + runHook postCheck + ''; meta = with lib; { homepage = "https://github.com/google/glog"; |