diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 610a57f674bd..a00ce39bdf4f 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1192,6 +1192,7 @@ in 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 { }; diff --git a/nixos/tests/scx/default.nix b/nixos/tests/scx/default.nix new file mode 100644 index 000000000000..67627d0ed3e3 --- /dev/null +++ b/nixos/tests/scx/default.nix @@ -0,0 +1,42 @@ +{ 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}") + ''; +} diff --git a/pkgs/os-specific/linux/scx/scx_full.nix b/pkgs/os-specific/linux/scx/scx_full.nix index c56208058a2f..ea1d9ad7b23e 100644 --- a/pkgs/os-specific/linux/scx/scx_full.nix +++ b/pkgs/os-specific/linux/scx/scx_full.nix @@ -3,6 +3,7 @@ stdenv, scx-common, scx, + nixosTests, }: scx.cscheds.overrideAttrs (oldAttrs: { pname = "scx_full"; @@ -12,6 +13,8 @@ scx.cscheds.overrideAttrs (oldAttrs: { cp ${scx.rustscheds}/bin/* ${placeholder "bin"}/bin/ ''; + passthru.tests.basic = nixosTests.scx; + passthru.updateScript.command = ./update.sh; meta = oldAttrs.meta // {