diff options
author | Tor Hedin Brønner <torhedinbronner@gmail.com> | 2018-12-09 16:35:51 +0100 |
---|---|---|
committer | Tor Hedin Brønner <torhedinbronner@gmail.com> | 2018-12-10 10:36:25 +0100 |
commit | 75e223bf7ac358bcf4320bb80b386d7cfddc90d1 (patch) | |
tree | 2d6c9ad30e513a6969fd02ec84cc4035c9569f64 | |
parent | 116c16d9e234a4f1c3ef3bfa29f46a105eef8f9a (diff) | |
download | nixpkgs-75e223bf7ac358bcf4320bb80b386d7cfddc90d1.tar nixpkgs-75e223bf7ac358bcf4320bb80b386d7cfddc90d1.tar.gz nixpkgs-75e223bf7ac358bcf4320bb80b386d7cfddc90d1.tar.bz2 nixpkgs-75e223bf7ac358bcf4320bb80b386d7cfddc90d1.tar.lz nixpkgs-75e223bf7ac358bcf4320bb80b386d7cfddc90d1.tar.xz nixpkgs-75e223bf7ac358bcf4320bb80b386d7cfddc90d1.tar.zst nixpkgs-75e223bf7ac358bcf4320bb80b386d7cfddc90d1.zip |
nixos/tests/gnome3-gdm: port to wayland
The test now runs wayland, which means we can no longer use X11 style testing. Instead we get gnome shell to execute javascript through its dbus interface.
-rw-r--r-- | nixos/tests/gnome3-gdm.nix | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/nixos/tests/gnome3-gdm.nix b/nixos/tests/gnome3-gdm.nix index 959030d5988..c2808d87d99 100644 --- a/nixos/tests/gnome3-gdm.nix +++ b/nixos/tests/gnome3-gdm.nix @@ -23,11 +23,21 @@ import ./make-test.nix ({ pkgs, ...} : { virtualisation.memorySize = 1024; }; - testScript = - '' - # wait for gdm to start and bring up X + testScript = let + # Keep line widths somewhat managable + bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"; + gdbus = "${bus} gdbus"; + # Call javascript in gnome 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 = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval"; + # False when startup is done + startingUp = "${gdbus} ${eval} Main.layoutManager._startingUp"; + # Hopefully gnome-terminal's wm class + wmClass = "${gdbus} ${eval} global.display.focus_window.wm_class"; + in '' + # wait for gdm to start $machine->waitForUnit("display-manager.service"); - $machine->waitForX; # wait for alice to be logged in $machine->waitForUnit("default.target","alice"); @@ -35,10 +45,16 @@ import ./make-test.nix ({ pkgs, ...} : { # Check that logging in has given the user ownership of devices. $machine->succeed("getfacl /dev/snd/timer | grep -q alice"); - # open a terminal and check it's there - $machine->succeed("su - alice -c 'DISPLAY=:0.0 XAUTHORITY=/run/user/\$UID/gdm/Xauthority gnome-terminal'"); - $machine->succeed("xauth merge /run/user/1000/gdm/Xauthority"); - $machine->waitForWindow(qr/Terminal/); + # Wait for the wayland server + $machine->waitForFile("/run/user/1000/wayland-0"); + + # Wait for gnome shell, correct output should be "(true, 'false')" + $machine->waitUntilSucceeds("su - alice -c '${startingUp} | grep -q true,..false'"); + + # open a terminal + $machine->succeed("su - alice -c '${bus} gnome-terminal'"); + # and check it's there + $machine->waitUntilSucceeds("su - alice -c '${wmClass} | grep -q gnome-terminal-server'"); # wait to get a nice screenshot $machine->sleep(20); |