Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ee2d307ef73d
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 30bfbe7e81b6
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Jan 30, 2020

  1. Copy the full SHA
    9888b30 View commit details
  2. nixosTests.gnome3: wait_for_wayland at login

    This prevents the default.target check from just failing.
    Blaming it on using systemctl in wait_for_unit (and it's particularly
    buggy for user units).
    worldofpeace committed Jan 30, 2020
    Copy the full SHA
    7651fcf View commit details
  3. Merge pull request #76157 from worldofpeace/port-gnome3-test

    nixosTests.gnome3: port to python
    worldofpeace authored Jan 30, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    30bfbe7 View commit details
Showing with 38 additions and 26 deletions.
  1. +38 −26 nixos/tests/gnome3.nix
64 changes: 38 additions & 26 deletions nixos/tests/gnome3.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : {
import ./make-test-python.nix ({ pkgs, ...} : {
name = "gnome3";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = pkgs.gnome3.maintainers;
@@ -24,41 +24,53 @@ import ./make-test.nix ({ pkgs, ...} : {
virtualisation.memorySize = 1024;
};

testScript = let
testScript = { nodes, ... }: let
# 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";
su = command: "su - ${user.name} -c '${command}'";

# 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");

# wait for alice to be logged in
$machine->waitForUnit("default.target","alice");
# Check that logging in has given the user ownership of devices.
$machine->succeed("getfacl -p /dev/snd/timer | grep -q alice");
# False when startup is done
startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp";

# Wait for the wayland server
$machine->waitForFile("/run/user/1000/wayland-0");
# Start gnome-terminal
gnomeTerminalCommand = su "${bus} gnome-terminal";

# Wait for gnome shell, correct output should be "(true, 'false')"
$machine->waitUntilSucceeds("su - alice -c '${startingUp} | grep -q true,..false'");
# Hopefully gnome-terminal's wm class
wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class";
in ''
with subtest("Login to GNOME with GDM"):
# wait for gdm to start
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
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")
# 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'");
with subtest("Wait for GNOME Shell"):
# correct output should be (true, 'false')
machine.wait_until_succeeds(
"${startingUp} | grep -q 'true,..false'"
)
# wait to get a nice screenshot
$machine->sleep(20);
$machine->screenshot("screen");
with subtest("Open Gnome Terminal"):
machine.succeed(
"${gnomeTerminalCommand}"
)
# correct output should be (true, '"gnome-terminal-server"')
machine.wait_until_succeeds(
"${wmClass} | grep -q 'gnome-terminal-server'"
)
machine.sleep(20)
machine.screenshot("screen")
'';
})