Merge pull request #76157 from worldofpeace/port-gnome3-test
nixosTests.gnome3: port to python
This commit is contained in:
commit
30bfbe7e81
@ -1,4 +1,4 @@
|
|||||||
import ./make-test.nix ({ pkgs, ...} : {
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
name = "gnome3";
|
name = "gnome3";
|
||||||
meta = with pkgs.stdenv.lib.maintainers; {
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
maintainers = pkgs.gnome3.maintainers;
|
maintainers = pkgs.gnome3.maintainers;
|
||||||
@ -24,41 +24,53 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||||||
virtualisation.memorySize = 1024;
|
virtualisation.memorySize = 1024;
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = let
|
testScript = { nodes, ... }: let
|
||||||
# Keep line widths somewhat managable
|
# Keep line widths somewhat managable
|
||||||
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus";
|
user = nodes.machine.config.users.users.alice;
|
||||||
|
uid = toString user.uid;
|
||||||
|
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
|
||||||
gdbus = "${bus} gdbus";
|
gdbus = "${bus} gdbus";
|
||||||
|
su = command: "su - ${user.name} -c '${command}'";
|
||||||
|
|
||||||
# Call javascript in gnome shell, returns a tuple (success, output), where
|
# 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
|
# `success` is true if the dbus call was successful and output is what the
|
||||||
# javascript evaluates to.
|
# javascript evaluates to.
|
||||||
eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval";
|
eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval";
|
||||||
|
|
||||||
# False when startup is done
|
# False when startup is done
|
||||||
startingUp = "${gdbus} ${eval} Main.layoutManager._startingUp";
|
startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp";
|
||||||
|
|
||||||
|
# Start gnome-terminal
|
||||||
|
gnomeTerminalCommand = su "${bus} gnome-terminal";
|
||||||
|
|
||||||
# Hopefully gnome-terminal's wm class
|
# Hopefully gnome-terminal's wm class
|
||||||
wmClass = "${gdbus} ${eval} global.display.focus_window.wm_class";
|
wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class";
|
||||||
in ''
|
in ''
|
||||||
|
with subtest("Login to GNOME with GDM"):
|
||||||
# wait for gdm to start
|
# wait for gdm to start
|
||||||
$machine->waitForUnit("display-manager.service");
|
machine.wait_for_unit("display-manager.service")
|
||||||
|
# wait for the wayland server
|
||||||
|
machine.wait_for_file("/run/user/${uid}/wayland-0")
|
||||||
# wait for alice to be logged in
|
# wait for alice to be logged in
|
||||||
$machine->waitForUnit("default.target","alice");
|
machine.wait_for_unit("default.target", "${user.name}")
|
||||||
|
# check that logging in has given the user ownership of devices
|
||||||
|
assert "alice" in machine.succeed("getfacl -p /dev/snd/timer")
|
||||||
|
|
||||||
# Check that logging in has given the user ownership of devices.
|
with subtest("Wait for GNOME Shell"):
|
||||||
$machine->succeed("getfacl -p /dev/snd/timer | grep -q alice");
|
# correct output should be (true, 'false')
|
||||||
|
machine.wait_until_succeeds(
|
||||||
|
"${startingUp} | grep -q 'true,..false'"
|
||||||
|
)
|
||||||
|
|
||||||
# Wait for the wayland server
|
with subtest("Open Gnome Terminal"):
|
||||||
$machine->waitForFile("/run/user/1000/wayland-0");
|
machine.succeed(
|
||||||
|
"${gnomeTerminalCommand}"
|
||||||
# Wait for gnome shell, correct output should be "(true, 'false')"
|
)
|
||||||
$machine->waitUntilSucceeds("su - alice -c '${startingUp} | grep -q true,..false'");
|
# correct output should be (true, '"gnome-terminal-server"')
|
||||||
|
machine.wait_until_succeeds(
|
||||||
# open a terminal
|
"${wmClass} | grep -q 'gnome-terminal-server'"
|
||||||
$machine->succeed("su - alice -c '${bus} gnome-terminal'");
|
)
|
||||||
# and check it's there
|
machine.sleep(20)
|
||||||
$machine->waitUntilSucceeds("su - alice -c '${wmClass} | grep -q gnome-terminal-server'");
|
machine.screenshot("screen")
|
||||||
|
|
||||||
# wait to get a nice screenshot
|
|
||||||
$machine->sleep(20);
|
|
||||||
$machine->screenshot("screen");
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user