Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixosTests.gnome3-flashback: init #71212

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion nixos/release-combined.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ in rec {
(all nixos.tests.firefox)
(all nixos.tests.firewall)
(all nixos.tests.fontconfig-default-fonts)
(all nixos.tests.gnome3-xorg)
(all nixos.tests.gnome3)
(all nixos.tests.gnome3-flashback.metacity)
(all nixos.tests.gnome3-xorg)
(all nixos.tests.pantheon)
nixos.tests.installer.zfsroot.x86_64-linux or [] # ZFS is 64bit only
(except ["aarch64-linux"] nixos.tests.installer.lvm)
Expand Down
5 changes: 3 additions & 2 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ in
gjs = handleTest ./gjs.nix {};
glib-networking = handleTest ./glib-networking.nix {};
glusterfs = handleTest ./glusterfs.nix {};
gnome3-xorg = handleTest ./gnome3-xorg.nix {};
gnome3 = handleTest ./gnome3.nix {};
gnome-photos = handleTest ./gnome-photos.nix {};
gnome3 = handleTest ./gnome3 {};
gnome3-flashback = pkgs.recurseIntoAttrs (handleTest ./gnome3/flashback.nix {});
gnome3-xorg = handleTest ./gnome3/xorg.nix {};
gocd-agent = handleTest ./gocd-agent.nix {};
gocd-server = handleTest ./gocd-server.nix {};
google-oslogin = handleTest ./google-oslogin {};
Expand Down
4 changes: 2 additions & 2 deletions nixos/tests/gnome3.nix → nixos/tests/gnome3/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : {
import ../make-test.nix ({ pkgs, ...} : {
name = "gnome3";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = pkgs.gnome3.maintainers;
Expand All @@ -7,7 +7,7 @@ import ./make-test.nix ({ pkgs, ...} : {
machine =
{ ... }:

{ imports = [ ./common/user-account.nix ];
{ imports = [ ../common/user-account.nix ];

services.xserver.enable = true;

Expand Down
98 changes: 98 additions & 0 deletions nixos/tests/gnome3/flashback.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# GNOME Flashback Terminal tests for various custom sessions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terminal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they pretty much test if a terminal shows up.
Btw, I've pretty much rewritten this entirely locally. Though there's issues with the python testing driver and other ports preventing me from re-PRing it.


{ system ? builtins.currentSystem,
config ? {},
pkgs ? import ../../.. { inherit system config; }
}:

with import ../../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;

let

baseConfig = {
imports = [ ../common/user-account.nix ];

services.xserver.enable = true;

# See: https://github.com/NixOS/nixpkgs/issues/66443
services.xserver.displayManager.gdm.enable = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment why this is done? I do not think git blame will carry to the original file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it seems in the gnome3-xorg test, and in the past gnome3 module enabled gdm and then it got removed and this got added. And I've copied it here.

Actual issue with why we don't test with gdm is #66443.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, link there should be enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GDM doesn't have any way to specify a default session, and I'm guessing it will happily launch wayland sessions even though GDM itself runs X11. Think I switched the test to LightDM when adding wayland support since I didn't manage to get it launch the correct session.

We'd probably have to do something with AccountsService to get it working.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that's weird, GDM X11 does indeed launch an X11 session, never mind me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I wasn't sure why I was seeing error: unable to open display ":0.0" when using xwininfo. Only thing I thought of was it using wayland? But it was explicitly disabled.

Copy link
Contributor Author

@worldofpeace worldofpeace Nov 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hedning You're actually correct, setting xserver default will have no effects on gdm.
So we do need to set it with accountsservice over dbus.

services.xserver.displayManager.lightdm.enable = true;
services.xserver.displayManager.lightdm.autoLogin.enable = true;
services.xserver.displayManager.lightdm.autoLogin.user = "alice";
services.xserver.desktopManager.gnome3.enable = true;

virtualisation.memorySize = 2047;
};

makeFlashbackTest =
{ wmName
, wmLabel ? ""
, wmCommand ? ""
, useMetacity ? false
}:
makeTest rec {
name = "gnome-flashback-${wmName}";

meta = with pkgs.stdenv.lib.maintainers; {
maintainers = pkgs.gnome3.maintainers;
};

machine = { ... }: {
imports = [ baseConfig ];

services.xserver.desktopManager.default = "gnome-flashback-${wmName}";

services.xserver.desktopManager.gnome3.flashback = {
enableMetacity = useMetacity;

customSessions = mkIf (!useMetacity) [
{ inherit wmName wmLabel wmCommand; }
];
};

};

testScript =
''
$machine->waitForX;

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

$machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'");
$machine->succeed("xauth merge ~alice/.Xauthority");
$machine->waitForWindow(qr/alice.*machine/);
$machine->succeed("timeout 900 bash -c 'while read msg; do if [[ \$msg =~ \"GNOME Shell started\" ]]; then break; fi; done < <(journalctl -f)'");
$machine->sleep(10);
$machine->screenshot("screen");
'';
};

in

{

metacity = makeFlashbackTest {
useMetacity = true;
wmName = "metacity";
};

# TODO: These are currently broken with gnome-session 3.34
# See: https://github.com/NixOS/nixpkgs/pull/71212#issuecomment-544303107
# i3 = makeFlashbackTest {
# wmName = "i3";
# wmLabel = "i3";
# wmCommand = "${pkgs.i3}/bin/i3";
# };

# xmonad = makeFlashbackTest {
# wmName = "xmonad";
# wmLabel = "XMonad";
# wmCommand = "${pkgs.haskellPackages.xmonad}/bin/xmonad";
# };

}
5 changes: 3 additions & 2 deletions nixos/tests/gnome3-xorg.nix → nixos/tests/gnome3/xorg.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : {
import ../make-test.nix ({ pkgs, ...} : {
name = "gnome3-xorg";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = pkgs.gnome3.maintainers;
Expand All @@ -7,10 +7,11 @@ import ./make-test.nix ({ pkgs, ...} : {
machine =
{ ... }:

{ imports = [ ./common/user-account.nix ];
{ imports = [ ../common/user-account.nix ];

services.xserver.enable = true;

# See: https://github.com/NixOS/nixpkgs/issues/66443
services.xserver.displayManager.gdm.enable = false;
services.xserver.displayManager.lightdm.enable = true;
services.xserver.displayManager.lightdm.autoLogin.enable = true;
Expand Down