Skip to content

Commit

Permalink
nixos/lib/testing: Pull callTest in
Browse files Browse the repository at this point in the history
It makes more sense to let the modules guide the invocation of this
function rather than to produce a data structure and then consume it
immmediately.

Maybe the same should be done for exposeIntermediateAttrs. It'd turn
the two functions into a catamorphism that's integrated into the
modules.
  • Loading branch information
roberth committed Feb 11, 2023
1 parent ecd4e73 commit 1b39fb2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
12 changes: 0 additions & 12 deletions nixos/lib/testing/call-test.nix

This file was deleted.

3 changes: 1 addition & 2 deletions nixos/lib/testing/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
let

evalTest = module: lib.evalModules { modules = testModules ++ [ module ]; };
runTest = module: (evalTest ({ config, ... }: { imports = [ module ]; result = config.test; })).config.result;
runTest = module: (evalTest ({ lib, config, ... }: { imports = [ module ]; })).config.result;

testModules = [
./call-test.nix
./driver.nix
./interactive.nix
./legacy.nix
Expand Down
2 changes: 1 addition & 1 deletion nixos/lib/testing/matrix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ in
nextDecision = (lib.head sortedEnable).name;
in
if sortedEnable == [ ]
then config
then config.callTest config
else
lib.recurseIntoAttrs
(
Expand Down
2 changes: 1 addition & 1 deletion nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let
// exposeIntermediateAttrs tree
else callTest tree;

runTest = arg: let r = doRunTest arg; in findTests r;
runTest = arg: let r = doRunTest arg; in r;
runTestOn = systems: arg:
if elem system systems then runTest arg
else {};
Expand Down

0 comments on commit 1b39fb2

Please sign in to comment.