Skip to content

Commit

Permalink
nixos/tests/xfce-wayland: init
Browse files Browse the repository at this point in the history
Use wlrctl instead of wait_for_window, to avoid xwininfo usages.
  • Loading branch information
bobby285271 committed Nov 2, 2024
1 parent 84c1720 commit c75ad2d
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ in {
xandikos = handleTest ./xandikos.nix {};
xautolock = handleTest ./xautolock.nix {};
xfce = handleTest ./xfce.nix {};
xfce-wayland = handleTest ./xfce-wayland.nix {};
xmonad = handleTest ./xmonad.nix {};
xmonad-xdg-autostart = handleTest ./xmonad-xdg-autostart.nix {};
xpadneo = handleTest ./xpadneo.nix {};
Expand Down
68 changes: 68 additions & 0 deletions nixos/tests/xfce-wayland.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "xfce-wayland";

nodes.machine =
{ pkgs, ... }:

{
imports = [
./common/user-account.nix
];

services.xserver.enable = true;
services.displayManager = {
sddm.enable = true; # https://github.com/canonical/lightdm/issues/63
sddm.wayland.enable = true;
defaultSession = "xfce-wayland";
autoLogin = {
enable = true;
user = "alice";
};
};

services.xserver.desktopManager.xfce.enable = true;
services.xserver.desktopManager.xfce.enableWaylandSession = true;
# https://gitlab.xfce.org/apps/xfce4-screensaver/-/merge_requests/28
services.xserver.desktopManager.xfce.enableScreensaver = false;
environment.systemPackages = [ pkgs.wlrctl ];
};

enableOCR = true;

testScript = { nodes, ... }: let
user = nodes.machine.users.users.alice;
rtdir = "XDG_RUNTIME_DIR=/run/user/${toString user.uid}";
in ''
machine.wait_for_unit("display-manager.service")
with subtest("Wait for Wayland server"):
machine.wait_for_file("/run/user/${toString user.uid}/wayland-0")
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 Xfce components actually start"):
for p in ["labwc", "xfdesktop", "xfce4-notifyd", "xfconfd", "xfce4-panel"]:
machine.wait_until_succeeds(f"pgrep {p}")
with subtest("Open Xfce terminal"):
machine.succeed("su - ${user.name} -c '${rtdir} xfce4-terminal >&2 &'")
machine.wait_until_succeeds("su - ${user.name} -c '${rtdir} wlrctl toplevel list | grep xfce4-terminal'")
with subtest("Open Thunar"):
machine.succeed("su - ${user.name} -c '${rtdir} thunar >&2 &'")
machine.wait_until_succeeds("su - ${user.name} -c '${rtdir} wlrctl toplevel list | grep Thunar'")
machine.wait_for_text('(Pictures|Public|Templates|Videos)')
with subtest("Check if various environment variables are set"):
cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf xfce4-panel)/environ"
machine.succeed(f"{cmd} | grep 'XDG_SESSION_TYPE' | grep 'wayland'")
machine.succeed(f"{cmd} | grep 'XFCE4_SESSION_COMPOSITOR' | grep 'labwc'")
machine.succeed(f"{cmd} | grep 'XDG_SESSION_DESKTOP' | grep 'XFCE'")
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")
'';
})

0 comments on commit c75ad2d

Please sign in to comment.