From 9eb3a26500173c6d4e115765e689234f583a6675 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Tue, 15 Oct 2019 20:08:48 -0400 Subject: [PATCH 1/3] nixosTests.gnome3-flashback: init These are terminal tests identical to the gnome3-xorg test for various gnome flashback configurations. --- nixos/release-combined.nix | 3 +- nixos/tests/all-tests.nix | 5 +- nixos/tests/gnome3-flashback.nix | 97 ++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 nixos/tests/gnome3-flashback.nix diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 9e2109d88b5fc..338110373e326 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -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) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5e7c8a7f4b5fd..5b04553d6595d 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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.nix {}; + 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 {}; diff --git a/nixos/tests/gnome3-flashback.nix b/nixos/tests/gnome3-flashback.nix new file mode 100644 index 0000000000000..586de09fac1f9 --- /dev/null +++ b/nixos/tests/gnome3-flashback.nix @@ -0,0 +1,97 @@ +# GNOME Flashback Terminal tests for various custom sessions. + +{ 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; + + services.xserver.displayManager.gdm.enable = false; + 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"; + # }; + +} From 43d38acdf2562a75435f5ee8717e7705ef4cfa2d Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Tue, 5 Nov 2019 22:20:28 -0500 Subject: [PATCH 2/3] nixos/tests/gnome3: reorganize --- nixos/tests/all-tests.nix | 6 +++--- nixos/tests/{gnome3.nix => gnome3/default.nix} | 4 ++-- nixos/tests/{gnome3-flashback.nix => gnome3/flashback.nix} | 6 +++--- nixos/tests/{gnome3-xorg.nix => gnome3/xorg.nix} | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) rename nixos/tests/{gnome3.nix => gnome3/default.nix} (95%) rename nixos/tests/{gnome3-flashback.nix => gnome3/flashback.nix} (93%) rename nixos/tests/{gnome3-xorg.nix => gnome3/xorg.nix} (93%) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5b04553d6595d..01833e392cabe 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -103,9 +103,9 @@ in glib-networking = handleTest ./glib-networking.nix {}; glusterfs = handleTest ./glusterfs.nix {}; gnome-photos = handleTest ./gnome-photos.nix {}; - gnome3 = handleTest ./gnome3.nix {}; - gnome3-flashback = pkgs.recurseIntoAttrs (handleTest ./gnome3-flashback.nix {}); - gnome3-xorg = handleTest ./gnome3-xorg.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 {}; diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3/default.nix similarity index 95% rename from nixos/tests/gnome3.nix rename to nixos/tests/gnome3/default.nix index ab363efb6a197..afccf2d0a1704 100644 --- a/nixos/tests/gnome3.nix +++ b/nixos/tests/gnome3/default.nix @@ -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; @@ -7,7 +7,7 @@ import ./make-test.nix ({ pkgs, ...} : { machine = { ... }: - { imports = [ ./common/user-account.nix ]; + { imports = [ ../common/user-account.nix ]; services.xserver.enable = true; diff --git a/nixos/tests/gnome3-flashback.nix b/nixos/tests/gnome3/flashback.nix similarity index 93% rename from nixos/tests/gnome3-flashback.nix rename to nixos/tests/gnome3/flashback.nix index 586de09fac1f9..4694dde96ebbf 100644 --- a/nixos/tests/gnome3-flashback.nix +++ b/nixos/tests/gnome3/flashback.nix @@ -2,16 +2,16 @@ { system ? builtins.currentSystem, config ? {}, - pkgs ? import ../.. { inherit system config; } + pkgs ? import ../../.. { inherit system config; } }: -with import ../lib/testing.nix { inherit system pkgs; }; +with import ../../lib/testing.nix { inherit system pkgs; }; with pkgs.lib; let baseConfig = { - imports = [ ./common/user-account.nix ]; + imports = [ ../common/user-account.nix ]; services.xserver.enable = true; diff --git a/nixos/tests/gnome3-xorg.nix b/nixos/tests/gnome3/xorg.nix similarity index 93% rename from nixos/tests/gnome3-xorg.nix rename to nixos/tests/gnome3/xorg.nix index eb4c376319be2..e3736144cd4b0 100644 --- a/nixos/tests/gnome3-xorg.nix +++ b/nixos/tests/gnome3/xorg.nix @@ -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; @@ -7,7 +7,7 @@ import ./make-test.nix ({ pkgs, ...} : { machine = { ... }: - { imports = [ ./common/user-account.nix ]; + { imports = [ ../common/user-account.nix ]; services.xserver.enable = true; From f7fed7d2c95b86f6b66695c8711c4e75af5c2756 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Tue, 5 Nov 2019 22:22:14 -0500 Subject: [PATCH 3/3] nixos/tests/gnome3: add comment about failing gdm in x11 --- nixos/tests/gnome3/flashback.nix | 1 + nixos/tests/gnome3/xorg.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/nixos/tests/gnome3/flashback.nix b/nixos/tests/gnome3/flashback.nix index 4694dde96ebbf..94977c4adb835 100644 --- a/nixos/tests/gnome3/flashback.nix +++ b/nixos/tests/gnome3/flashback.nix @@ -15,6 +15,7 @@ let 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; diff --git a/nixos/tests/gnome3/xorg.nix b/nixos/tests/gnome3/xorg.nix index e3736144cd4b0..c6ca892e3ce91 100644 --- a/nixos/tests/gnome3/xorg.nix +++ b/nixos/tests/gnome3/xorg.nix @@ -11,6 +11,7 @@ import ../make-test.nix ({ pkgs, ...} : { 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;