2
0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-01-01 18:44:07 +00:00

nixos/switch-test: use the runTest handler to improve eval performance

The newer runTest handler uses a single nixpkgs instance to eval all the
specialisations, reducing the memory usage and eval time of the test
drastically compared to handleTest which creates a new nixpkgs instance
for every specialisation.
This commit is contained in:
r-vdp 2024-12-11 09:38:55 +01:00
parent 2fff1179a5
commit 779c710476
No known key found for this signature in database
2 changed files with 11 additions and 6 deletions

View File

@ -965,8 +965,14 @@ in {
swapspace = handleTestOn ["aarch64-linux" "x86_64-linux"] ./swapspace.nix {};
sway = handleTest ./sway.nix {};
swayfx = handleTest ./swayfx.nix {};
switchTest = handleTest ./switch-test.nix { ng = false; };
switchTestNg = handleTest ./switch-test.nix { ng = true; };
switchTest = runTest {
imports = [ ./switch-test.nix ];
defaults.system.switch.enableNg = false;
};
switchTestNg = runTest {
imports = [ ./switch-test.nix ];
defaults.system.switch.enableNg = true;
};
sx = handleTest ./sx.nix {};
sympa = handleTest ./sympa.nix {};
syncthing = handleTest ./syncthing.nix {};

View File

@ -1,6 +1,7 @@
# Test configuration switching.
{ lib, pkgs, ...}:
import ./make-test-python.nix ({ lib, pkgs, ng, ...} : let
let
# Simple service that can either be socket-activated or that will
# listen on port 1234 if not socket-activated.
@ -48,8 +49,6 @@ in {
nodes = {
machine = { pkgs, lib, ... }: {
system.switch.enableNg = ng;
environment.systemPackages = [ pkgs.socat ]; # for the socket activation stuff
users.mutableUsers = false;
@ -1455,4 +1454,4 @@ in {
assert_lacks(out, "\nstarting the following units:")
assert_lacks(out, "the following new units were started:")
'';
})
}