From 1434add94c3ab74a63db4165ec361a9d5cd89188 Mon Sep 17 00:00:00 2001 From: Sigmanificient Date: Tue, 11 Mar 2025 21:24:52 +0100 Subject: [PATCH] nixosTests.{qtile,ragnarwm}: migrate to runTestOn --- nixos/tests/all-tests.nix | 4 +- nixos/tests/qtile/default.nix | 90 +++++++++++++++++------------------ nixos/tests/ragnarwm.nix | 70 +++++++++++++-------------- 3 files changed, 80 insertions(+), 84 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index bec1dc19d8e6..4b0a32608a02 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -959,7 +959,7 @@ in { qgis = handleTest ./qgis.nix { package = pkgs.qgis; }; qgis-ltr = handleTest ./qgis.nix { package = pkgs.qgis-ltr; }; qownnotes = handleTest ./qownnotes.nix {}; - qtile = handleTestOn ["x86_64-linux" "aarch64-linux"] ./qtile/default.nix {}; + qtile = runTestOn ["x86_64-linux" "aarch64-linux"] ./qtile/default.nix; quake3 = handleTest ./quake3.nix {}; quicktun = handleTest ./quicktun.nix {}; quickwit = handleTest ./quickwit.nix {}; @@ -968,7 +968,7 @@ in { radarr = handleTest ./radarr.nix {}; radicale = handleTest ./radicale.nix {}; radicle = runTest ./radicle.nix; - ragnarwm = handleTest ./ragnarwm.nix {}; + ragnarwm = runTestOn ["x86_64-linux" "aarch64-linux"] ./ragnarwm.nix; rasdaemon = handleTest ./rasdaemon.nix {}; rathole = handleTest ./rathole.nix {}; readarr = handleTest ./readarr.nix {}; diff --git a/nixos/tests/qtile/default.nix b/nixos/tests/qtile/default.nix index 547a53dcf123..edd2cb3409da 100644 --- a/nixos/tests/qtile/default.nix +++ b/nixos/tests/qtile/default.nix @@ -1,54 +1,52 @@ -import ../make-test-python.nix ( - { lib, ... }: - { - name = "qtile"; +{ lib, ... }: +{ + name = "qtile"; - meta = { - maintainers = with lib.maintainers; [ sigmanificient ]; - }; + meta = { + maintainers = with lib.maintainers; [ sigmanificient ]; + }; - nodes.machine = - { pkgs, lib, ... }: - let - # We create a custom Qtile configuration file that adds a widget from - # qtile-extras to the bar. This ensure that the qtile-extras package - # also works, and that extraPackages behave as expected. + nodes.machine = + { pkgs, lib, ... }: + let + # We create a custom Qtile configuration file that adds a widget from + # qtile-extras to the bar. This ensure that the qtile-extras package + # also works, and that extraPackages behave as expected. - config-deriv = pkgs.callPackage ./config.nix { }; - in - { - imports = [ - ../common/x11.nix - ../common/user-account.nix - ]; - test-support.displayManager.auto.user = "alice"; + config-deriv = pkgs.callPackage ./config.nix { }; + in + { + imports = [ + ../common/x11.nix + ../common/user-account.nix + ]; + test-support.displayManager.auto.user = "alice"; - services.xserver.windowManager.qtile = { - enable = true; - configFile = "${config-deriv}/config.py"; - extraPackages = ps: [ ps.qtile-extras ]; - }; - - services.displayManager.defaultSession = lib.mkForce "qtile"; - - environment.systemPackages = [ pkgs.kitty ]; + services.xserver.windowManager.qtile = { + enable = true; + configFile = "${config-deriv}/config.py"; + extraPackages = ps: [ ps.qtile-extras ]; }; - testScript = '' - with subtest("ensure x starts"): - machine.wait_for_x() - machine.wait_for_file("/home/alice/.Xauthority") - machine.succeed("xauth merge ~alice/.Xauthority") + services.displayManager.defaultSession = lib.mkForce "qtile"; - with subtest("ensure client is available"): - machine.succeed("qtile --version") + environment.systemPackages = [ pkgs.kitty ]; + }; - with subtest("ensure we can open a new terminal"): - machine.sleep(2) - machine.send_key("meta_l-ret") - machine.wait_for_window(r"alice.*?machine") - machine.sleep(2) - machine.screenshot("terminal") - ''; - } -) + testScript = '' + with subtest("ensure x starts"): + machine.wait_for_x() + machine.wait_for_file("/home/alice/.Xauthority") + machine.succeed("xauth merge ~alice/.Xauthority") + + with subtest("ensure client is available"): + machine.succeed("qtile --version") + + with subtest("ensure we can open a new terminal"): + machine.sleep(2) + machine.send_key("meta_l-ret") + machine.wait_for_window(r"alice.*?machine") + machine.sleep(2) + machine.screenshot("terminal") + ''; +} diff --git a/nixos/tests/ragnarwm.nix b/nixos/tests/ragnarwm.nix index d944fac4b910..f951f4aff389 100644 --- a/nixos/tests/ragnarwm.nix +++ b/nixos/tests/ragnarwm.nix @@ -1,40 +1,38 @@ -import ./make-test-python.nix ( - { lib, ... }: - { - name = "ragnarwm"; +{ lib, ... }: +{ + name = "ragnarwm"; - meta = { - maintainers = with lib.maintainers; [ sigmanificient ]; + meta = { + maintainers = with lib.maintainers; [ sigmanificient ]; + }; + + nodes.machine = + { pkgs, lib, ... }: + { + imports = [ + ./common/x11.nix + ./common/user-account.nix + ]; + test-support.displayManager.auto.user = "alice"; + services.displayManager.defaultSession = lib.mkForce "ragnar"; + services.xserver.windowManager.ragnarwm.enable = true; + + # Setup the default terminal of Ragnar + environment.systemPackages = [ pkgs.alacritty ]; }; - nodes.machine = - { pkgs, lib, ... }: - { - imports = [ - ./common/x11.nix - ./common/user-account.nix - ]; - test-support.displayManager.auto.user = "alice"; - services.displayManager.defaultSession = lib.mkForce "ragnar"; - services.xserver.windowManager.ragnarwm.enable = true; + testScript = '' + with subtest("ensure x starts"): + machine.wait_for_x() + machine.wait_for_file("/home/alice/.Xauthority") + machine.succeed("xauth merge ~alice/.Xauthority") - # Setup the default terminal of Ragnar - environment.systemPackages = [ pkgs.alacritty ]; - }; - - testScript = '' - with subtest("ensure x starts"): - machine.wait_for_x() - machine.wait_for_file("/home/alice/.Xauthority") - machine.succeed("xauth merge ~alice/.Xauthority") - - with subtest("ensure we can open a new terminal"): - # Sleeping a bit before the test, as it may help for sending keys - machine.sleep(2) - machine.send_key("meta_l-ret") - machine.wait_for_window(r"alice.*?machine") - machine.sleep(2) - machine.screenshot("terminal") - ''; - } -) + with subtest("ensure we can open a new terminal"): + # Sleeping a bit before the test, as it may help for sending keys + machine.sleep(2) + machine.send_key("meta_l-ret") + machine.wait_for_window(r"alice.*?machine") + machine.sleep(2) + machine.screenshot("terminal") + ''; +}