tests: extract fn instantiateTestsFromStr

Fn `instantiateTests` now takes an array of strings.
It is used in the following commit.
This commit is contained in:
Erik Arvstedt 2025-06-26 23:22:50 +02:00
parent ac1344fb6d
commit 7d33e9d5e9
No known key found for this signature in database
GPG key ID: 33312B944DD97846
2 changed files with 10 additions and 11 deletions

View file

@ -193,7 +193,7 @@ buildTests() {
# TODO-EXTERNAL:
# Simplify and switch to pure build when `nix build` can instantiate flake function outputs
# shellcheck disable=SC2207
drvs=($(nixInstantiate "pkgs.instantiateTests \"${tests[*]}\""))
drvs=($(nixInstantiate "pkgs.instantiateTestsFromStr \"${tests[*]}\""))
for i in "${!tests[@]}"; do
testName=${tests[$i]}
drv=${drvs[$i]}

View file

@ -459,16 +459,15 @@ in {
};
});
instantiateTestsFromStr = testNamesStr: instantiateTests (lib.splitString " " testNamesStr);
instantiateTests = testNames:
let
testNames' = lib.splitString " " testNames;
in
map (name:
let
test = tests.${name};
in
builtins.seq (builtins.trace "Evaluating test '${name}'" test.outPath)
test
) testNames';
map (name:
let
test = tests.${name};
in
builtins.seq (builtins.trace "Evaluating test '${name}'" test.outPath)
test
) testNames;
};
}