tests: use a single link-farm for flake-checks

We need to optimise the buildbot attrs for nix-eval-jobs, however this
doesn't make sense for `nix flake check` or `nix flake show`.
This commit is contained in:
Matt Sturgeon 2025-07-01 01:19:42 +01:00
parent 278eb40fa7
commit 1463ec64d5
2 changed files with 22 additions and 16 deletions

View file

@ -55,13 +55,28 @@ let
platforms = callTests ./platforms { }; platforms = callTests ./platforms { };
# Tests generated from ./test-sources # Tests generated from ./test-sources
# As a list of { name, path } attrs
main = (callTests ./main.nix { }).tests;
# Combined into a single link-farm derivation
mainDrv.tests = linkFarm "tests" main;
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N } # Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
main = callTests ./main.nix { }; mainGrouped = lib.pipe main [
(helpers.groupListBySize 10)
(lib.imap1 (
i: group: rec {
name = "test-${toString i}";
value = linkFarm name group;
}
))
builtins.listToAttrs
];
in in
{ {
# TODO: consider whether all these tests are needed in the `checks` output # TODO: consider whether all these tests are needed in the `checks` output
flakeCheck = misc // docs // platforms // main; flakeCheck = misc // docs // platforms // mainDrv;
# TODO: consider whether all these tests are needed to be built by buildbot # TODO: consider whether all these tests are needed to be built by buildbot
buildbot = lib.optionalAttrs (system == "x86_64-linux") (misc // docs) // platforms // main; buildbot = lib.optionalAttrs (system == "x86_64-linux") (misc // docs) // platforms // mainGrouped;
} }

View file

@ -1,7 +1,6 @@
# Collects the various test modules in tests/test-sources/ and groups them into a number of test derivations # Collects the various test modules in tests/test-sources/ and groups them into a number of test derivations
{ {
callTest, callTest,
helpers,
lib ? pkgs.lib, lib ? pkgs.lib,
linkFarm, linkFarm,
pkgs, pkgs,
@ -69,8 +68,8 @@ let
}; };
in in
# We attempt to build & execute all configurations # We attempt to build & execute all configurations
lib.pipe (testFiles ++ [ exampleFiles ]) [ {
(builtins.map ( tests = map (
{ {
name, name,
file, file,
@ -80,13 +79,5 @@ lib.pipe (testFiles ++ [ exampleFiles ]) [
inherit name; inherit name;
path = linkFarm name (builtins.mapAttrs (moduleToTest file) cases); path = linkFarm name (builtins.mapAttrs (moduleToTest file) cases);
} }
)) ) (testFiles ++ [ exampleFiles ]);
(helpers.groupListBySize 10) }
(lib.imap1 (
i: group: rec {
name = "test-${toString i}";
value = linkFarm name group;
}
))
builtins.listToAttrs
]