From 7d33e9d5e9dc89415eab7688c02fb6957f8eeadf Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 26 Jun 2025 23:22:50 +0200 Subject: [PATCH] tests: extract fn `instantiateTestsFromStr` Fn `instantiateTests` now takes an array of strings. It is used in the following commit. --- test/run-tests.sh | 2 +- test/tests.nix | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/test/run-tests.sh b/test/run-tests.sh index 09caffe..48abf8e 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -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]} diff --git a/test/tests.nix b/test/tests.nix index af6e30c..cee3b7b 100644 --- a/test/tests.nix +++ b/test/tests.nix @@ -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; }; }