about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorWolfgang Walther <walther@technowledgy.de>2024-02-10 15:15:56 +0100
committerWolfgang Walther <walther@technowledgy.de>2024-02-26 12:32:02 +0100
commitdf284fa43c9365e1e03b08cda09b5e3ff83e2cfc (patch)
tree66f2c2280129cde0551bdc8d76e0e6c5657639e3 /pkgs/development
parent85ebf8847ebcfa8316b8ff21135163887c7fc481 (diff)
downloadnixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.gz
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.bz2
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.lz
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.xz
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.zst
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.zip
haskellPackages: avoid re-enabling previously disabled tests
The intent of all doCheck = <condition>, where condition is possibly true, is to disable
the tests in a specific case. However, as currently written, this also has the effect of
re-enabling the tests, even if they have been disabled by an override before, e.g. to
mkDerivation.

This also affects the default value given in mkDerivation, which is !isCross. Before this
change, aeson for example, would have been built with tests when cross-compiling, which
was not intended.

The proper way is to set the doCheck = false attribute only conditionally, and otherwise
rely on a previous override or the default value given in mkDerivation.
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix43
-rw-r--r--pkgs/development/haskell-modules/configuration-nix.nix9
2 files changed, 27 insertions, 25 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index ccb2a145effe..64b388e5e57a 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -145,11 +145,11 @@ self: super: {
   czipwith = doJailbreak super.czipwith;
 
   # Deal with infinite and NaN values generated by QuickCheck-2.14.3
-  aeson = overrideCabal {
+  aeson = overrideCabal (lib.optionalAttrs pkgs.stdenv.hostPlatform.is32bit {
     # aeson's test suite includes some tests with big numbers that fail on 32bit
     # https://github.com/haskell/aeson/issues/1060
-    doCheck = !pkgs.stdenv.hostPlatform.is32bit;
-  } (appendPatches [
+    doCheck = false;
+  }) (appendPatches [
     (pkgs.fetchpatch {
       name = "aeson-quickcheck-2.14.3-double-workaround.patch";
       url = "https://github.com/haskell/aeson/commit/58766a1916b4980792763bab74f0c86e2a7ebf20.patch";
@@ -1320,9 +1320,10 @@ self: super: {
 
   # Requires pg_ctl command during tests
   beam-postgres = overrideCabal (drv: {
-    # https://github.com/NixOS/nixpkgs/issues/198495
-    doCheck = pkgs.postgresql.doCheck;
     testToolDepends = (drv.testToolDepends or []) ++ [pkgs.postgresql];
+  } // lib.optionalAttrs (!pkgs.postgresql.doCheck) {
+    # https://github.com/NixOS/nixpkgs/issues/198495
+    doCheck = false;
   }) super.beam-postgres;
 
   # PortMidi needs an environment variable to have ALSA find its plugins:
@@ -1364,8 +1365,6 @@ self: super: {
           sed -i test/PostgreSQL/Test.hs \
             -e s^host=localhost^^
         '';
-        # https://github.com/NixOS/nixpkgs/issues/198495
-        doCheck = pkgs.postgresql.doCheck;
         # Match the test suite defaults (or hardcoded values?)
         preCheck = drv.preCheck or "" + ''
           PGUSER=esqutest
@@ -1379,6 +1378,9 @@ self: super: {
           pkgs.postgresql
           pkgs.postgresqlTestHook
         ];
+      } // lib.optionalAttrs (!pkgs.postgresql.doCheck) {
+        # https://github.com/NixOS/nixpkgs/issues/198495
+        doCheck = false;
       })
       super.esqueleto;
 
@@ -1482,14 +1484,11 @@ self: super: {
           sed -i test/PgInit.hs \
             -e s^'host=" <> host <> "'^^
         '';
-        doCheck =
-          # https://github.com/commercialhaskell/stackage/issues/6884
-          # persistent-postgresql-2.13.5.1 needs persistent-test >= 2.13.1.3 which
-          # is incompatible with the stackage version of persistent, so the tests
-          # are disabled temporarily.
-          false
-          # https://github.com/NixOS/nixpkgs/issues/198495
-          && pkgs.postgresql.doCheck;
+        # https://github.com/commercialhaskell/stackage/issues/6884
+        # persistent-postgresql-2.13.5.1 needs persistent-test >= 2.13.1.3 which
+        # is incompatible with the stackage version of persistent, so the tests
+        # are disabled temporarily.
+        doCheck = false;
         preCheck = drv.preCheck or "" + ''
           PGDATABASE=test
           PGUSER=test
@@ -1498,6 +1497,9 @@ self: super: {
           pkgs.postgresql
           pkgs.postgresqlTestHook
         ];
+      } // lib.optionalAttrs (!pkgs.postgresql.doCheck) {
+        # https://github.com/NixOS/nixpkgs/issues/198495
+        doCheck = false;
       })
       super.persistent-postgresql;
 
@@ -1665,12 +1667,13 @@ self: super: {
     testToolDepends = drv.testToolDepends or [] ++ [
       pkgs.postgresql pkgs.postgresqlTestHook
     ];
-    # https://github.com/NixOS/nixpkgs/issues/198495
-    doCheck = pkgs.postgresql.doCheck;
     preCheck = drv.preCheck or "" + ''
       # empty string means use default connection
       export DATABASE_URL=""
     '';
+  } // lib.optionalAttrs (!pkgs.postgresql.doCheck) {
+    # https://github.com/NixOS/nixpkgs/issues/198495
+    doCheck = false;
   }) (super.pg-client.override {
     resource-pool = self.hasura-resource-pool;
     ekg-core = self.hasura-ekg-core;
@@ -2133,9 +2136,9 @@ self: super: {
 
   # Tests need to lookup target triple x86_64-unknown-linux
   # https://github.com/llvm-hs/llvm-hs/issues/334
-  llvm-hs = overrideCabal {
-    doCheck = pkgs.stdenv.targetPlatform.system == "x86_64-linux";
-  } super.llvm-hs;
+  llvm-hs = overrideCabal (lib.optionalAttrs (pkgs.stdenv.targetPlatform.system != "x86_64-linux") {
+    doCheck = false;
+  }) super.llvm-hs;
 
   # Fix build with bytestring >= 0.11 (GHC 9.2)
   # https://github.com/llvm-hs/llvm-hs/pull/389
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix
index 44780fe5e5db..8d976685e57a 100644
--- a/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/pkgs/development/haskell-modules/configuration-nix.nix
@@ -1103,7 +1103,7 @@ self: super: builtins.intersectAttrs super {
   rel8 = pkgs.lib.pipe super.rel8 [
     (addTestToolDepend pkgs.postgresql)
     # https://github.com/NixOS/nixpkgs/issues/198495
-    (overrideCabal { doCheck = pkgs.postgresql.doCheck; })
+    (overrideCabal (lib.optionalAttrs (!pkgs.postgresql.doCheck) { doCheck = false; }))
   ];
 
   # Wants running postgresql database accessible over ip, so postgresqlTestHook
@@ -1178,10 +1178,9 @@ self: super: builtins.intersectAttrs super {
 
   # Some hash implementations are x86 only, but part of the test suite.
   # So executing and building it on non-x86 platforms will always fail.
-  hashes = overrideCabal {
-    doCheck = with pkgs.stdenv; hostPlatform == buildPlatform
-      && buildPlatform.isx86;
-  } super.hashes;
+  hashes = overrideCabal (lib.optionalAttrs (!pkgs.stdenv.hostPlatform.isx86) {
+    doCheck = false;
+  }) super.hashes;
 
   # Tries to access network
   aws-sns-verify = dontCheck super.aws-sns-verify;