lol

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.

+27 -25
+23 -20
pkgs/development/haskell-modules/configuration-common.nix
··· 145 145 czipwith = doJailbreak super.czipwith; 146 146 147 147 # Deal with infinite and NaN values generated by QuickCheck-2.14.3 148 - aeson = overrideCabal { 148 + aeson = overrideCabal (lib.optionalAttrs pkgs.stdenv.hostPlatform.is32bit { 149 149 # aeson's test suite includes some tests with big numbers that fail on 32bit 150 150 # https://github.com/haskell/aeson/issues/1060 151 - doCheck = !pkgs.stdenv.hostPlatform.is32bit; 152 - } (appendPatches [ 151 + doCheck = false; 152 + }) (appendPatches [ 153 153 (pkgs.fetchpatch { 154 154 name = "aeson-quickcheck-2.14.3-double-workaround.patch"; 155 155 url = "https://github.com/haskell/aeson/commit/58766a1916b4980792763bab74f0c86e2a7ebf20.patch"; ··· 1320 1320 1321 1321 # Requires pg_ctl command during tests 1322 1322 beam-postgres = overrideCabal (drv: { 1323 + testToolDepends = (drv.testToolDepends or []) ++ [pkgs.postgresql]; 1324 + } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1323 1325 # https://github.com/NixOS/nixpkgs/issues/198495 1324 - doCheck = pkgs.postgresql.doCheck; 1325 - testToolDepends = (drv.testToolDepends or []) ++ [pkgs.postgresql]; 1326 + doCheck = false; 1326 1327 }) super.beam-postgres; 1327 1328 1328 1329 # PortMidi needs an environment variable to have ALSA find its plugins: ··· 1364 1365 sed -i test/PostgreSQL/Test.hs \ 1365 1366 -e s^host=localhost^^ 1366 1367 ''; 1367 - # https://github.com/NixOS/nixpkgs/issues/198495 1368 - doCheck = pkgs.postgresql.doCheck; 1369 1368 # Match the test suite defaults (or hardcoded values?) 1370 1369 preCheck = drv.preCheck or "" + '' 1371 1370 PGUSER=esqutest ··· 1379 1378 pkgs.postgresql 1380 1379 pkgs.postgresqlTestHook 1381 1380 ]; 1381 + } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1382 + # https://github.com/NixOS/nixpkgs/issues/198495 1383 + doCheck = false; 1382 1384 }) 1383 1385 super.esqueleto; 1384 1386 ··· 1482 1484 sed -i test/PgInit.hs \ 1483 1485 -e s^'host=" <> host <> "'^^ 1484 1486 ''; 1485 - doCheck = 1486 - # https://github.com/commercialhaskell/stackage/issues/6884 1487 - # persistent-postgresql-2.13.5.1 needs persistent-test >= 2.13.1.3 which 1488 - # is incompatible with the stackage version of persistent, so the tests 1489 - # are disabled temporarily. 1490 - false 1491 - # https://github.com/NixOS/nixpkgs/issues/198495 1492 - && pkgs.postgresql.doCheck; 1487 + # https://github.com/commercialhaskell/stackage/issues/6884 1488 + # persistent-postgresql-2.13.5.1 needs persistent-test >= 2.13.1.3 which 1489 + # is incompatible with the stackage version of persistent, so the tests 1490 + # are disabled temporarily. 1491 + doCheck = false; 1493 1492 preCheck = drv.preCheck or "" + '' 1494 1493 PGDATABASE=test 1495 1494 PGUSER=test ··· 1498 1497 pkgs.postgresql 1499 1498 pkgs.postgresqlTestHook 1500 1499 ]; 1500 + } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1501 + # https://github.com/NixOS/nixpkgs/issues/198495 1502 + doCheck = false; 1501 1503 }) 1502 1504 super.persistent-postgresql; 1503 1505 ··· 1665 1667 testToolDepends = drv.testToolDepends or [] ++ [ 1666 1668 pkgs.postgresql pkgs.postgresqlTestHook 1667 1669 ]; 1668 - # https://github.com/NixOS/nixpkgs/issues/198495 1669 - doCheck = pkgs.postgresql.doCheck; 1670 1670 preCheck = drv.preCheck or "" + '' 1671 1671 # empty string means use default connection 1672 1672 export DATABASE_URL="" 1673 1673 ''; 1674 + } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1675 + # https://github.com/NixOS/nixpkgs/issues/198495 1676 + doCheck = false; 1674 1677 }) (super.pg-client.override { 1675 1678 resource-pool = self.hasura-resource-pool; 1676 1679 ekg-core = self.hasura-ekg-core; ··· 2133 2136 2134 2137 # Tests need to lookup target triple x86_64-unknown-linux 2135 2138 # https://github.com/llvm-hs/llvm-hs/issues/334 2136 - llvm-hs = overrideCabal { 2137 - doCheck = pkgs.stdenv.targetPlatform.system == "x86_64-linux"; 2138 - } super.llvm-hs; 2139 + llvm-hs = overrideCabal (lib.optionalAttrs (pkgs.stdenv.targetPlatform.system != "x86_64-linux") { 2140 + doCheck = false; 2141 + }) super.llvm-hs; 2139 2142 2140 2143 # Fix build with bytestring >= 0.11 (GHC 9.2) 2141 2144 # https://github.com/llvm-hs/llvm-hs/pull/389
+4 -5
pkgs/development/haskell-modules/configuration-nix.nix
··· 1103 1103 rel8 = pkgs.lib.pipe super.rel8 [ 1104 1104 (addTestToolDepend pkgs.postgresql) 1105 1105 # https://github.com/NixOS/nixpkgs/issues/198495 1106 - (overrideCabal { doCheck = pkgs.postgresql.doCheck; }) 1106 + (overrideCabal (lib.optionalAttrs (!pkgs.postgresql.doCheck) { doCheck = false; })) 1107 1107 ]; 1108 1108 1109 1109 # Wants running postgresql database accessible over ip, so postgresqlTestHook ··· 1178 1178 1179 1179 # Some hash implementations are x86 only, but part of the test suite. 1180 1180 # So executing and building it on non-x86 platforms will always fail. 1181 - hashes = overrideCabal { 1182 - doCheck = with pkgs.stdenv; hostPlatform == buildPlatform 1183 - && buildPlatform.isx86; 1184 - } super.hashes; 1181 + hashes = overrideCabal (lib.optionalAttrs (!pkgs.stdenv.hostPlatform.isx86) { 1182 + doCheck = false; 1183 + }) super.hashes; 1185 1184 1186 1185 # Tries to access network 1187 1186 aws-sns-verify = dontCheck super.aws-sns-verify;