nixosTests.scx: init (#401972)

For now, test only the useful schedulers, there's no need to test all of them.

Co-authored-by: Gliczy <129636582+Gliczy@users.noreply.github.com>
Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>

Changed files
+46
nixos
pkgs
os-specific
linux
+1
nixos/tests/all-tests.nix
···
schleuder = handleTest ./schleuder.nix { };
scion-freestanding-deployment = handleTest ./scion/freestanding-deployment { };
scrutiny = runTest ./scrutiny.nix;
+
scx = runTest ./scx/default.nix;
sddm = handleTest ./sddm.nix { };
sdl3 = handleTest ./sdl3.nix { };
seafile = handleTest ./seafile.nix { };
+42
nixos/tests/scx/default.nix
···
+
{ pkgs, ... }:
+
+
{
+
name = "scx_full";
+
meta = {
+
inherit (pkgs.scx.full.meta) maintainers;
+
};
+
+
nodes.machine = {
+
boot.kernelPackages = pkgs.linuxPackages_latest;
+
services.scx.enable = true;
+
+
specialisation = {
+
bpfland.configuration.services.scx.scheduler = "scx_bpfland";
+
central.configuration.services.scx.scheduler = "scx_central";
+
lavd.configuration.services.scx.scheduler = "scx_lavd";
+
rlfifo.configuration.services.scx.scheduler = "scx_rlfifo";
+
rustland.configuration.services.scx.scheduler = "scx_rustland";
+
rusty.configuration.services.scx.scheduler = "scx_rusty";
+
};
+
};
+
+
testScript = ''
+
specialisation = [
+
"bpfland",
+
"central",
+
"lavd",
+
"rlfifo",
+
"rustland",
+
"rusty"
+
]
+
+
def activate_specialisation(name: str):
+
machine.succeed(f"/run/booted-system/specialisation/{name}/bin/switch-to-configuration test >&2")
+
+
for sched in specialisation:
+
with subtest(f"{sched}"):
+
activate_specialisation(sched)
+
machine.succeed("systemctl restart scx.service")
+
machine.succeed(f"ps -U root -u root u | grep scx_{sched}")
+
'';
+
}
+3
pkgs/os-specific/linux/scx/scx_full.nix
···
stdenv,
scx-common,
scx,
+
nixosTests,
}:
scx.cscheds.overrideAttrs (oldAttrs: {
pname = "scx_full";
···
+ ''
cp ${scx.rustscheds}/bin/* ${placeholder "bin"}/bin/
'';
+
+
passthru.tests.basic = nixosTests.scx;
passthru.updateScript.command = ./update.sh;