lol

nixos/tests/pantheon: Only test wayland session

This copies the previous pantheon-wayland test to pantheon.

+35 -152
-1
nixos/tests/all-tests.nix
··· 1146 1146 patroni = handleTestOn [ "x86_64-linux" ] ./patroni.nix { }; 1147 1147 pantalaimon = runTest ./matrix/pantalaimon.nix; 1148 1148 pantheon = runTest ./pantheon.nix; 1149 - pantheon-wayland = runTest ./pantheon-wayland.nix; 1150 1149 paperless = runTest ./paperless.nix; 1151 1150 parsedmarc = handleTest ./parsedmarc { }; 1152 1151 password-option-override-ordering = runTest ./password-option-override-ordering.nix;
-104
nixos/tests/pantheon-wayland.nix
··· 1 - { pkgs, lib, ... }: 2 - 3 - { 4 - name = "pantheon-wayland"; 5 - 6 - meta.maintainers = lib.teams.pantheon.members; 7 - 8 - nodes.machine = 9 - { nodes, ... }: 10 - 11 - let 12 - videosAutostart = pkgs.writeTextFile { 13 - name = "autostart-elementary-videos"; 14 - destination = "/etc/xdg/autostart/io.elementary.videos.desktop"; 15 - text = '' 16 - [Desktop Entry] 17 - Version=1.0 18 - Name=Videos 19 - Type=Application 20 - Terminal=false 21 - Exec=io.elementary.videos %U 22 - ''; 23 - }; 24 - in 25 - { 26 - imports = [ ./common/user-account.nix ]; 27 - 28 - # Workaround ".gala-wrapped invoked oom-killer" 29 - virtualisation.memorySize = 2047; 30 - 31 - services.xserver.enable = true; 32 - services.desktopManager.pantheon.enable = true; 33 - services.displayManager = { 34 - autoLogin.enable = true; 35 - autoLogin.user = nodes.machine.users.users.alice.name; 36 - defaultSession = "pantheon-wayland"; 37 - }; 38 - 39 - # We ship pantheon.appcenter by default when this is enabled. 40 - services.flatpak.enable = true; 41 - 42 - # For basic OCR tests. 43 - environment.systemPackages = [ videosAutostart ]; 44 - 45 - # We don't ship gnome-text-editor in Pantheon module, we add this line mainly 46 - # to catch eval issues related to this option. 47 - environment.pantheon.excludePackages = [ pkgs.gnome-text-editor ]; 48 - }; 49 - 50 - enableOCR = true; 51 - 52 - testScript = 53 - { nodes, ... }: 54 - let 55 - user = nodes.machine.users.users.alice; 56 - in 57 - '' 58 - machine.wait_for_unit("display-manager.service") 59 - 60 - with subtest("Wait for wayland server"): 61 - machine.wait_for_file("/run/user/${toString user.uid}/wayland-0") 62 - 63 - with subtest("Check that logging in has given the user ownership of devices"): 64 - machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") 65 - 66 - with subtest("Check if Pantheon components actually start"): 67 - # We specifically check gsd-xsettings here since it is manually pulled up by gala. 68 - # https://github.com/elementary/gala/pull/2140 69 - for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock", "gsd-media-keys", "gsd-xsettings", "io.elementary.desktop.agent-polkit"]: 70 - machine.wait_until_succeeds(f"pgrep -f {i}") 71 - machine.wait_until_succeeds("pgrep -xf ${pkgs.pantheon.elementary-files}/libexec/io.elementary.files.xdg-desktop-portal") 72 - 73 - with subtest("Check if various environment variables are set"): 74 - cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf ${pkgs.pantheon.gala}/bin/gala)/environ" 75 - machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP' | grep 'Pantheon'") 76 - machine.succeed(f"{cmd} | grep 'XDG_SESSION_TYPE' | grep 'wayland'") 77 - # Hopefully from the sessionPath option. 78 - machine.succeed(f"{cmd} | grep 'XDG_DATA_DIRS' | grep 'gsettings-schemas/pantheon-agent-geoclue2'") 79 - # Hopefully from login shell. 80 - machine.succeed(f"{cmd} | grep '__NIXOS_SET_ENVIRONMENT_DONE' | grep '1'") 81 - # Hopefully from gcr-ssh-agent. 82 - machine.succeed(f"{cmd} | grep 'SSH_AUTH_SOCK' | grep 'gcr'") 83 - 84 - with subtest("Wait for elementary videos autostart"): 85 - machine.wait_until_succeeds("pgrep -f io.elementary.videos") 86 - machine.wait_for_text("No Videos Open") 87 - machine.screenshot("videos") 88 - 89 - with subtest("Trigger multitasking view"): 90 - cmd = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1" 91 - env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus" 92 - machine.succeed(f"su - ${user.name} -c '{env} {cmd}'") 93 - machine.sleep(5) 94 - machine.screenshot("multitasking") 95 - machine.succeed(f"su - ${user.name} -c '{env} {cmd}'") 96 - 97 - with subtest("Check if gala has ever coredumped"): 98 - machine.fail("coredumpctl --json=short | grep gala") 99 - # So we can see the dock. 100 - machine.execute("pkill -f -9 io.elementary.videos") 101 - machine.sleep(10) 102 - machine.screenshot("screen") 103 - ''; 104 - }
+35 -47
nixos/tests/pantheon.nix
··· 6 6 meta.maintainers = lib.teams.pantheon.members; 7 7 8 8 nodes.machine = 9 - { ... }: 9 + { nodes, ... }: 10 10 11 + let 12 + videosAutostart = pkgs.writeTextFile { 13 + name = "autostart-elementary-videos"; 14 + destination = "/etc/xdg/autostart/io.elementary.videos.desktop"; 15 + text = '' 16 + [Desktop Entry] 17 + Version=1.0 18 + Name=Videos 19 + Type=Application 20 + Terminal=false 21 + Exec=io.elementary.videos %U 22 + ''; 23 + }; 24 + in 11 25 { 12 26 imports = [ ./common/user-account.nix ]; 13 27 ··· 16 30 17 31 services.xserver.enable = true; 18 32 services.desktopManager.pantheon.enable = true; 33 + services.displayManager = { 34 + autoLogin.enable = true; 35 + autoLogin.user = nodes.machine.users.users.alice.name; 36 + defaultSession = "pantheon-wayland"; 37 + }; 19 38 20 39 # We ship pantheon.appcenter by default when this is enabled. 21 40 services.flatpak.enable = true; 22 41 42 + # For basic OCR tests. 43 + environment.systemPackages = [ videosAutostart ]; 44 + 23 45 # We don't ship gnome-text-editor in Pantheon module, we add this line mainly 24 46 # to catch eval issues related to this option. 25 47 environment.pantheon.excludePackages = [ pkgs.gnome-text-editor ]; 26 - 27 - environment.systemPackages = [ pkgs.xdotool ]; 28 48 }; 29 49 30 50 enableOCR = true; ··· 33 53 { nodes, ... }: 34 54 let 35 55 user = nodes.machine.users.users.alice; 36 - bob = nodes.machine.users.users.bob; 37 56 in 38 57 '' 39 58 machine.wait_for_unit("display-manager.service") 40 59 41 - with subtest("Test we can see usernames in elementary-greeter"): 42 - machine.wait_for_text("${user.description}") 43 - machine.wait_until_succeeds("pgrep -f io.elementary.greeter-compositor") 44 - # OCR was struggling with this one. 45 - # machine.wait_for_text("${bob.description}") 46 - # Ensure the password box is focused by clicking it. 47 - # Workaround for https://github.com/NixOS/nixpkgs/issues/211366. 48 - machine.succeed("XAUTHORITY=/var/lib/lightdm/.Xauthority DISPLAY=:0 xdotool mousemove 512 505 click 1") 49 - machine.sleep(2) 50 - machine.screenshot("elementary_greeter_lightdm") 51 - 52 - with subtest("Login with elementary-greeter"): 53 - machine.send_chars("${user.password}\n") 54 - machine.wait_for_x() 55 - machine.wait_for_file("${user.home}/.Xauthority") 56 - machine.succeed("xauth merge ${user.home}/.Xauthority") 57 - machine.wait_until_succeeds('journalctl -t gnome-session-binary --grep "Entering running state"') 60 + with subtest("Wait for wayland server"): 61 + machine.wait_for_file("/run/user/${toString user.uid}/wayland-0") 58 62 59 63 with subtest("Check that logging in has given the user ownership of devices"): 60 64 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") 61 65 62 66 with subtest("Check if Pantheon components actually start"): 63 - for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock", "gsd-media-keys", "io.elementary.desktop.agent-polkit"]: 67 + # We specifically check gsd-xsettings here since it is manually pulled up by gala. 68 + # https://github.com/elementary/gala/pull/2140 69 + for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock", "gsd-media-keys", "gsd-xsettings", "io.elementary.desktop.agent-polkit"]: 64 70 machine.wait_until_succeeds(f"pgrep -f {i}") 65 - for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock"]: 66 - machine.wait_for_window(i) 67 71 machine.wait_until_succeeds("pgrep -xf ${pkgs.pantheon.elementary-files}/libexec/io.elementary.files.xdg-desktop-portal") 68 72 69 73 with subtest("Check if various environment variables are set"): 70 74 cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf ${pkgs.pantheon.gala}/bin/gala)/environ" 71 75 machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP' | grep 'Pantheon'") 76 + machine.succeed(f"{cmd} | grep 'XDG_SESSION_TYPE' | grep 'wayland'") 72 77 # Hopefully from the sessionPath option. 73 78 machine.succeed(f"{cmd} | grep 'XDG_DATA_DIRS' | grep 'gsettings-schemas/pantheon-agent-geoclue2'") 74 79 # Hopefully from login shell. ··· 76 81 # Hopefully from gcr-ssh-agent. 77 82 machine.succeed(f"{cmd} | grep 'SSH_AUTH_SOCK' | grep 'gcr'") 78 83 79 - with subtest("Open elementary videos"): 80 - machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.videos >&2 &'") 81 - machine.sleep(2) 82 - machine.wait_for_window("io.elementary.videos") 84 + with subtest("Wait for elementary videos autostart"): 85 + machine.wait_until_succeeds("pgrep -f io.elementary.videos") 83 86 machine.wait_for_text("No Videos Open") 84 - 85 - with subtest("Open elementary calendar"): 86 - machine.wait_until_succeeds("pgrep -f evolution-calendar-factory") 87 - machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.calendar >&2 &'") 88 - machine.sleep(2) 89 - machine.wait_for_window("io.elementary.calendar") 90 - 91 - with subtest("Open system settings"): 92 - machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.settings >&2 &'") 93 - # Wait for all plugins to be loaded before we check if the window is still there. 94 - machine.sleep(5) 95 - machine.wait_for_window("io.elementary.settings") 96 - 97 - with subtest("Open elementary terminal"): 98 - machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal >&2 &'") 99 - machine.wait_for_window("io.elementary.terminal") 87 + machine.screenshot("videos") 100 88 101 89 with subtest("Trigger multitasking view"): 102 90 cmd = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1" 103 - env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0" 91 + env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus" 104 92 machine.succeed(f"su - ${user.name} -c '{env} {cmd}'") 105 93 machine.sleep(5) 106 94 machine.screenshot("multitasking") ··· 108 96 109 97 with subtest("Check if gala has ever coredumped"): 110 98 machine.fail("coredumpctl --json=short | grep gala") 111 - # So you can see the dock in the below screenshot. 112 - machine.succeed("su - ${user.name} -c 'DISPLAY=:0 xdotool mousemove 450 1000 >&2 &'") 99 + # So we can see the dock. 100 + machine.execute("pkill -f -9 io.elementary.videos") 113 101 machine.sleep(10) 114 102 machine.screenshot("screen") 115 103 '';