tests: recurse into more attrs

This makes it so that our ci evals more tests and that hydra builds them, making it possible to catch more regressions.
This commit is contained in:
jopejoe1 2025-05-09 21:52:50 +02:00
parent 72a87bc217
commit 33964ab8ba
3 changed files with 54 additions and 44 deletions

View file

@ -456,7 +456,7 @@ recurseIntoAttrs {
);
};
data = {
data = recurseIntoAttrs {
json = expectDataEqual {
file = writeJSON "data.json" { hello = "world"; };
expected = ''

View file

@ -71,30 +71,32 @@ let
mapMultiPlatformTest =
crossSystemFun: test:
lib.mapAttrs (
name: system:
test rec {
crossPkgs = import pkgs.path {
localSystem = { inherit (pkgs.stdenv.hostPlatform) config; };
crossSystem = crossSystemFun system;
};
lib.recurseIntoAttrs (
lib.mapAttrs (
name: system:
lib.recurseIntoAttrs (test rec {
crossPkgs = import pkgs.path {
localSystem = { inherit (pkgs.stdenv.hostPlatform) config; };
crossSystem = crossSystemFun system;
};
emulator = crossPkgs.stdenv.hostPlatform.emulator pkgs;
emulator = crossPkgs.stdenv.hostPlatform.emulator pkgs;
# Apply some transformation on windows to get dlls in the right
# place. Unfortunately mingw doesnt seem to be able to do linking
# properly.
platformFun =
pkg:
if crossPkgs.stdenv.hostPlatform.isWindows then
pkgs.buildEnv {
name = "${pkg.name}-winlinks";
paths = [ pkg ] ++ pkg.buildInputs;
}
else
pkg;
}
) testedSystems;
# Apply some transformation on windows to get dlls in the right
# place. Unfortunately mingw doesnt seem to be able to do linking
# properly.
platformFun =
pkg:
if crossPkgs.stdenv.hostPlatform.isWindows then
pkgs.buildEnv {
name = "${pkg.name}-winlinks";
paths = [ pkg ] ++ pkg.buildInputs;
}
else
pkg;
})
) testedSystems
);
tests = {
@ -214,8 +216,12 @@ let
in
{
gcc = (lib.mapAttrs (_: mapMultiPlatformTest (system: system // { useLLVM = false; })) tests);
llvm = (lib.mapAttrs (_: mapMultiPlatformTest (system: system // { useLLVM = true; })) tests);
gcc = lib.recurseIntoAttrs (
lib.mapAttrs (_: mapMultiPlatformTest (system: system // { useLLVM = false; })) tests
);
llvm = lib.recurseIntoAttrs (
lib.mapAttrs (_: mapMultiPlatformTest (system: system // { useLLVM = true; })) tests
);
inherit mbuffer sanity;
}

View file

@ -87,13 +87,13 @@ with pkgs;
};
llvmTests = recurseIntoAttrs llvmTests;
inherit gccTests;
gccTests = recurseIntoAttrs gccTests;
};
devShellTools = callPackage ../build-support/dev-shell-tools/tests { };
stdenv-inputs = callPackage ./stdenv-inputs { };
stdenv = callPackage ./stdenv { };
stdenv = recurseIntoAttrs (callPackage ./stdenv { });
hardeningFlags = recurseIntoAttrs (callPackage ./cc-wrapper/hardening.nix { });
hardeningFlags-gcc = recurseIntoAttrs (
@ -113,24 +113,28 @@ with pkgs;
haskell = callPackage ./haskell { };
hooks = callPackage ./hooks { };
hooks = recurseIntoAttrs (callPackage ./hooks { });
cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; };
cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; };
compress-drv = callPackage ../build-support/compress-drv/test.nix { };
fetchurl = callPackages ../build-support/fetchurl/tests.nix { };
fetchtorrent = callPackages ../build-support/fetchtorrent/tests.nix { };
fetchpatch = callPackages ../build-support/fetchpatch/tests.nix { };
fetchpatch2 = callPackages ../build-support/fetchpatch/tests.nix { fetchpatch = fetchpatch2; };
fetchDebianPatch = callPackages ../build-support/fetchdebianpatch/tests.nix { };
fetchzip = callPackages ../build-support/fetchzip/tests.nix { };
fetchgit = callPackages ../build-support/fetchgit/tests.nix { };
fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };
fetchPypiLegacy = callPackages ../build-support/fetchpypilegacy/tests.nix { };
fetchurl = recurseIntoAttrs (callPackages ../build-support/fetchurl/tests.nix { });
fetchtorrent = recurseIntoAttrs (callPackages ../build-support/fetchtorrent/tests.nix { });
fetchpatch = recurseIntoAttrs (callPackages ../build-support/fetchpatch/tests.nix { });
fetchpatch2 = recurseIntoAttrs (
callPackages ../build-support/fetchpatch/tests.nix { fetchpatch = fetchpatch2; }
);
fetchDebianPatch = recurseIntoAttrs (callPackages ../build-support/fetchdebianpatch/tests.nix { });
fetchzip = recurseIntoAttrs (callPackages ../build-support/fetchzip/tests.nix { });
fetchgit = recurseIntoAttrs (callPackages ../build-support/fetchgit/tests.nix { });
fetchFirefoxAddon = recurseIntoAttrs (
callPackages ../build-support/fetchfirefoxaddon/tests.nix { }
);
fetchPypiLegacy = recurseIntoAttrs (callPackages ../build-support/fetchpypilegacy/tests.nix { });
install-shell-files = callPackage ./install-shell-files { };
install-shell-files = recurseIntoAttrs (callPackage ./install-shell-files { });
checkpointBuildTools = callPackage ./checkpointBuild { };
@ -138,7 +142,7 @@ with pkgs;
ld-library-path = callPackage ./ld-library-path { };
cross = callPackage ./cross { };
cross = recurseIntoAttrs (callPackage ./cross { });
php = recurseIntoAttrs (callPackages ./php { });
@ -146,18 +150,18 @@ with pkgs;
__recurseIntoDerivationForReleaseJobs = true;
};
buildRustCrate = callPackage ../build-support/rust/build-rust-crate/test { };
importCargoLock = callPackage ../build-support/rust/test/import-cargo-lock { };
buildRustCrate = recurseIntoAttrs (callPackage ../build-support/rust/build-rust-crate/test { });
importCargoLock = recurseIntoAttrs (callPackage ../build-support/rust/test/import-cargo-lock { });
vim = callPackage ./vim { };
nixos-functions = callPackage ./nixos-functions { };
nixosOptionsDoc = callPackage ../../nixos/lib/make-options-doc/tests.nix { };
nixosOptionsDoc = recurseIntoAttrs (callPackage ../../nixos/lib/make-options-doc/tests.nix { });
overriding = callPackage ./overriding.nix { };
texlive = callPackage ./texlive { };
texlive = recurseIntoAttrs (callPackage ./texlive { });
cuda = callPackage ./cuda { };
@ -175,7 +179,7 @@ with pkgs;
dotnet = recurseIntoAttrs (callPackages ./dotnet { });
makeHardcodeGsettingsPatch = callPackage ./make-hardcode-gsettings-patch { };
makeHardcodeGsettingsPatch = recurseIntoAttrs (callPackage ./make-hardcode-gsettings-patch { });
makeWrapper = callPackage ./make-wrapper { };
makeBinaryWrapper = callPackage ./make-binary-wrapper {