From 127113a73c553148cce9157fb1e860f65cad477e Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Mon, 27 Jan 2025 00:06:25 +0800 Subject: [PATCH] nixosTests.lxqt: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/lxqt.nix | 80 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 nixos/tests/lxqt.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 4dfc0e1e7831..14705d7415d6 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -570,6 +570,7 @@ in { lomiri-gallery-app = runTest ./lomiri-gallery-app.nix; lomiri-system-settings = handleTest ./lomiri-system-settings.nix {}; lorri = handleTest ./lorri/default.nix {}; + lxqt = handleTest ./lxqt.nix {}; ly = handleTest ./ly.nix {}; maddy = discoverTests (import ./maddy { inherit handleTest; }); maestral = handleTest ./maestral.nix {}; diff --git a/nixos/tests/lxqt.nix b/nixos/tests/lxqt.nix new file mode 100644 index 000000000000..f2d5bb513ce8 --- /dev/null +++ b/nixos/tests/lxqt.nix @@ -0,0 +1,80 @@ +import ./make-test-python.nix ( + { pkgs, lib, ... }: + + { + name = "lxqt"; + + meta.maintainers = lib.teams.lxqt.members ++ [ lib.maintainers.bobby285271 ]; + + nodes.machine = + { ... }: + + { + imports = [ ./common/user-account.nix ]; + + services.xserver.enable = true; + services.xserver.desktopManager.lxqt.enable = true; + + services.displayManager = { + sddm.enable = true; + defaultSession = "lxqt"; + autoLogin = { + enable = true; + user = "alice"; + }; + }; + }; + + enableOCR = true; + + testScript = + { nodes, ... }: + let + user = nodes.machine.users.users.alice; + in + '' + machine.wait_for_unit("display-manager.service") + + with subtest("Wait for login"): + machine.wait_for_x() + machine.wait_for_file("/tmp/xauth_*") + machine.succeed("xauth merge /tmp/xauth_*") + machine.succeed("su - ${user.name} -c 'xauth merge /tmp/xauth_*'") + + with subtest("Check that logging in has given the user ownership of devices"): + machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") + + with subtest("Check if LXQt components actually start"): + for i in ["openbox", "lxqt-session", "pcmanfm-qt", "lxqt-panel", "lxqt-runner"]: + machine.wait_until_succeeds(f"pgrep {i}") + machine.wait_for_window("pcmanfm-desktop0") + machine.wait_for_window("lxqt-panel") + machine.wait_for_text("(Computer|Network|Trash)") + + with subtest("Open QTerminal"): + machine.succeed("su - ${user.name} -c 'DISPLAY=:0 qterminal >&2 &'") + machine.wait_until_succeeds("pgrep qterminal") + machine.wait_for_window("${user.name}@machine: ~") + + with subtest("Open PCManFM-Qt"): + machine.succeed("mkdir -p /tmp/test/test") + machine.succeed("su - ${user.name} -c 'DISPLAY=:0 QT_SCALE_FACTOR=2 pcmanfm-qt /tmp/test >&2 &'") + machine.wait_for_window("test") + machine.wait_for_text("(test|Bookmarks|Reload)") + + with subtest("Check if various environment variables are set"): + cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf /run/current-system/sw/bin/lxqt-panel)/environ" + machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP=LXQt'") + machine.succeed(f"{cmd} | grep 'QT_PLATFORM_PLUGIN=lxqt'") + # From login shell. + machine.succeed(f"{cmd} | grep '__NIXOS_SET_ENVIRONMENT_DONE=1'") + # See the nixos/lxqt module. + machine.succeed(f"{cmd} | grep 'XDG_CONFIG_DIRS' | grep '${nodes.machine.system.path}'") + + with subtest("Check if any coredumps are found"): + machine.succeed("(coredumpctl --json=short 2>&1 || true) | grep 'No coredumps found'") + machine.sleep(10) + machine.screenshot("screen") + ''; + } +)