0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

haskellPackages.mkDerivation: Replace testTarget with testTargets (#306283)

This commit is contained in:
maralorn 2025-02-11 13:28:36 +01:00 committed by GitHub
commit 38b4ca850b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 13 deletions

View file

@ -297,8 +297,8 @@ Defaults to `false`.
: Whether to build (HTML) documentation using [haddock][haddock].
Defaults to `true` if supported.
`testTarget`
: Name of the test suite to build and run. If unset, all test suites will be executed.
`testTargets`
: Names of the test suites to build and run. If unset, all test suites will be executed.
`preCompileBuildDriver`
: Shell code to run before compiling `Setup.hs`.

View file

@ -47,3 +47,7 @@
- `functor.wrapped` is now deprecated for some types and using it will give a warning with migration instructions. It is deprecated for these types:
- `lib.types.attrsWith`
- `lib.types.listOf`
- The `testTarget` argument of `haskellPackages.mkDerivation` has been deprecated in favour of `testTargets`.
`testTarget` took a space separated string of targets, whereas the new `testTargets` argument takes a list of targets.
For instance, `testTarget = "foo bar baz"` should become `testTargets = [ "foo" "bar" "baz" ]`.

View file

@ -147,7 +147,7 @@ self: super: {
vector = overrideCabal (old: {
# vector-doctest seems to be broken when executed via ./Setup test
testTarget = lib.concatStringsSep " " [
testTargets = [
"vector-tests-O0"
"vector-tests-O2"
];
@ -860,7 +860,7 @@ self: super: {
CHXHtml = dontDistribute super.CHXHtml;
# https://github.com/NixOS/nixpkgs/issues/6350
paypal-adaptive-hoops = overrideCabal (drv: { testTarget = "local"; }) super.paypal-adaptive-hoops;
paypal-adaptive-hoops = overrideCabal (drv: { testTargets = [ "local" ]; }) super.paypal-adaptive-hoops;
# Avoid "QuickCheck >=2.3 && <2.10" dependency we cannot fulfill in lts-11.x.
test-framework = dontCheck super.test-framework;
@ -2451,7 +2451,7 @@ self: super: {
rm Setup.hs
'';
# doctest suite uses doctest-parallel which still doesn't work in nixpkgs
testTarget = "tests";
testTargets = [ "tests" ];
}) super.conduit-aeson;
hermes-json = overrideCabal (drv: {
@ -2487,7 +2487,7 @@ self: super: {
# Disabling doctests.
regex-tdfa = overrideCabal {
testTarget = "regex-tdfa-unittest";
testTargets = [ "regex-tdfa-unittest" ];
} super.regex-tdfa;
# Missing test files https://github.com/kephas/xdg-basedir-compliant/issues/1

View file

@ -75,7 +75,7 @@ self: super: builtins.intersectAttrs super {
chmod +x "$out/bin/haskell-language-server"
'';
testToolDepends = [ self.cabal-install pkgs.git ];
testTarget = "func-test"; # wrapper test accesses internet
testTargets = [ "func-test" ]; # wrapper test accesses internet
preCheck = ''
export PATH=$PATH:$PWD/dist/build/haskell-language-server:$PWD/dist/build/haskell-language-server-wrapper
export HOME=$TMPDIR
@ -334,7 +334,7 @@ self: super: builtins.intersectAttrs super {
digitalocean-kzs = dontCheck super.digitalocean-kzs; # https://github.com/KazumaSATO/digitalocean-kzs/issues/1
github-types = dontCheck super.github-types; # http://hydra.cryp.to/build/1114046/nixlog/1/raw
hadoop-rpc = dontCheck super.hadoop-rpc; # http://hydra.cryp.to/build/527461/nixlog/2/raw
hjsonschema = overrideCabal (drv: { testTarget = "local"; }) super.hjsonschema;
hjsonschema = overrideCabal (drv: { testTargets = [ "local" ]; }) super.hjsonschema;
marmalade-upload = dontCheck super.marmalade-upload; # http://hydra.cryp.to/build/501904/nixlog/1/raw
mongoDB = dontCheck super.mongoDB;
network-transport-tcp = dontCheck super.network-transport-tcp;
@ -701,7 +701,7 @@ self: super: builtins.intersectAttrs super {
# Not running the "example" test because it requires a binary from lsps test
# suite which is not part of the output of lsp.
lsp-test = overrideCabal (old: { testTarget = "tests func-test"; }) super.lsp-test;
lsp-test = overrideCabal (old: { testTargets = [ "tests" "func-test" ]; }) super.lsp-test;
# the test suite attempts to run the binaries built in this package
# through $PATH but they aren't in $PATH
@ -1275,7 +1275,7 @@ self: super: builtins.intersectAttrs super {
"-p" "!/oeis/"
];
# disco-examples needs network access
testTarget = "disco-tests";
testTargets = [ "disco-tests" ];
}) super.disco;
# Apply a patch which hardcodes the store path of graphviz instead of using

View file

@ -83,7 +83,9 @@ in
, pkg-configDepends ? [], libraryPkgconfigDepends ? [], executablePkgconfigDepends ? [], testPkgconfigDepends ? [], benchmarkPkgconfigDepends ? []
, testDepends ? [], testHaskellDepends ? [], testSystemDepends ? [], testFrameworkDepends ? []
, benchmarkDepends ? [], benchmarkHaskellDepends ? [], benchmarkSystemDepends ? [], benchmarkFrameworkDepends ? []
, testTarget ? "", testFlags ? []
, # testTarget is deprecated. Use testTargets instead.
testTarget ? ""
, testTargets ? lib.strings.splitString " " testTarget, testFlags ? []
, broken ? false
, preCompileBuildDriver ? null, postCompileBuildDriver ? null
, preUnpack ? null, postUnpack ? null
@ -408,6 +410,10 @@ let
exec "$@"
'';
testTargetsString =
lib.warnIf (testTarget != "") "haskellPackages.mkDerivation: testTarget is deprecated. Use testTargets instead"
(lib.concatStringsSep " " testTargets);
in lib.fix (drv:
stdenv.mkDerivation ({
@ -616,7 +622,7 @@ stdenv.mkDerivation ({
${lib.escapeShellArgs (builtins.map (opt: "--test-option=${opt}") testFlags)}
)
export NIX_GHC_PACKAGE_PATH_FOR_TEST="''${NIX_GHC_PACKAGE_PATH_FOR_TEST:-$packageConfDir:}"
${setupCommand} test ${testTarget} $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"}
${setupCommand} test ${testTargetsString} $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"}
runHook postCheck
'';

View file

@ -12,7 +12,7 @@ let
# nom has unit-tests and golden-tests
# golden-tests call nix and thus cant be run in a nix build.
testTarget = "unit-tests";
testTargets = [ "unit-tests" ];
buildTools = [ installShellFiles ];
postInstall = ''