summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Rong <rjl931189261@126.com>2023-11-20 00:10:36 +0800
committerBobby Rong <rjl931189261@126.com>2023-11-28 20:51:28 +0800
commit2521b3978260466952b1719f710bbc72d0ed7c5d (patch)
treeb1fd67f2d4a03eb62859fceb04ccdaefcb2c7495
parentcinnamon.pix: 3.0.2 -> 3.2.0 (diff)
downloadnixpkgs-origin/cinnamon.tar.gz
nixosTests.cinnamon-wayland: initorigin/cinnamon
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/cinnamon-wayland.nix71
2 files changed, 72 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 3b0871e36a77..1c9db70bd37d 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -186,6 +186,7 @@ in {
chrony = handleTestOn ["aarch64-linux" "x86_64-linux"] ./chrony.nix {};
chrony-ptp = handleTestOn ["aarch64-linux" "x86_64-linux"] ./chrony-ptp.nix {};
cinnamon = handleTest ./cinnamon.nix {};
+ cinnamon-wayland = handleTest ./cinnamon-wayland.nix {};
cjdns = handleTest ./cjdns.nix {};
clickhouse = handleTest ./clickhouse.nix {};
cloud-init = handleTest ./cloud-init.nix {};
diff --git a/nixos/tests/cinnamon-wayland.nix b/nixos/tests/cinnamon-wayland.nix
new file mode 100644
index 000000000000..58dddbbb0866
--- /dev/null
+++ b/nixos/tests/cinnamon-wayland.nix
@@ -0,0 +1,71 @@
+import ./make-test-python.nix ({ pkgs, lib, ... }: {
+ name = "cinnamon-wayland";
+
+ meta.maintainers = lib.teams.cinnamon.members;
+
+ nodes.machine = { nodes, ... }: {
+ imports = [ ./common/user-account.nix ];
+ services.xserver.enable = true;
+ services.xserver.desktopManager.cinnamon.enable = true;
+ services.xserver.displayManager = {
+ autoLogin.enable = true;
+ autoLogin.user = nodes.machine.users.users.alice.name;
+ defaultSession = "cinnamon-wayland";
+ };
+ };
+
+ enableOCR = true;
+
+ testScript = { nodes, ... }:
+ let
+ user = nodes.machine.users.users.alice;
+ env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus";
+ su = command: "su - ${user.name} -c '${env} ${command}'";
+
+ # Call javascript in cinnamon (the shell), returns a tuple (success, output),
+ # where `success` is true if the dbus call was successful and `output` is what
+ # the javascript evaluates to.
+ eval = name: su "gdbus call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval ${name}";
+ 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("Wait for the Cinnamon shell"):
+ # Correct output should be (true, '2')
+ # https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187
+ machine.wait_until_succeeds("${eval "Main.runState"} | grep -q 'true,..2'")
+
+ with subtest("Check if Cinnamon components actually start"):
+ for i in ["csd-media-keys", "xapp-sn-watcher", "nemo-desktop"]:
+ machine.wait_until_succeeds(f"pgrep -f {i}")
+ machine.wait_until_succeeds("journalctl -b --grep 'Loaded applet menu@cinnamon.org'")
+ machine.wait_until_succeeds("journalctl -b --grep 'calendar@cinnamon.org: Calendar events supported'")
+
+ with subtest("Open Cinnamon Settings"):
+ machine.succeed("${su "cinnamon-settings themes >&2 &"}")
+ machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'cinnamon-settings'")
+ machine.wait_for_text('(Style|Appearance|Color)')
+ machine.sleep(2)
+ machine.screenshot("cinnamon_settings")
+
+ with subtest("Check if screensaver works"):
+ # This is not supported at the moment.
+ # https://trello.com/b/HHs01Pab/cinnamon-wayland
+ machine.execute("${su "cinnamon-screensaver-command -l >&2 &"}")
+ machine.wait_until_succeeds("journalctl -b --grep 'Cinnamon Screensaver is unavailable on Wayland'")
+
+ with subtest("Open GNOME Terminal"):
+ machine.succeed("${su "dbus-launch gnome-terminal"}")
+ machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'gnome-terminal'")
+ machine.sleep(2)
+
+ with subtest("Check if Cinnamon has ever coredumped"):
+ machine.fail("coredumpctl --json=short | grep -E 'cinnamon|nemo'")
+ '';
+})