2022-02-03 18:59:01 +00:00
|
|
|
import ./make-test-python.nix (
|
|
|
|
{ pkgs, lib, ... }:
|
2022-03-20 23:15:30 +00:00
|
|
|
{
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
name = "sway";
|
|
|
|
meta = {
|
2021-12-23 19:19:41 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
primeos
|
|
|
|
synthetica
|
2021-06-24 17:57:07 +00:00
|
|
|
];
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
};
|
2021-12-23 19:19:41 +00:00
|
|
|
|
2022-06-04 05:55:01 +00:00
|
|
|
# testScriptWithTypes:49: error: Cannot call function of unknown type
|
|
|
|
# (machine.succeed if succeed else machine.execute)(
|
2024-12-10 19:26:33 +00:00
|
|
|
# ^
|
2022-06-04 05:55:01 +00:00
|
|
|
# Found 1 error in 1 file (checked 1 source file)
|
|
|
|
skipTypeCheck = true;
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine =
|
|
|
|
{ config, ... }:
|
2024-12-10 19:26:33 +00:00
|
|
|
{
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
# Automatically login on tty1 as a normal user:
|
|
|
|
imports = [ ./common/user-account.nix ];
|
|
|
|
services.getty.autologinUser = "alice";
|
2024-12-10 19:26:33 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
environment = {
|
|
|
|
# For glinfo and wayland-info:
|
2021-12-23 19:19:41 +00:00
|
|
|
systemPackages = with pkgs; [
|
2024-12-10 19:26:33 +00:00
|
|
|
mesa-demos
|
2021-12-23 19:19:41 +00:00
|
|
|
wayland-utils
|
2024-12-10 19:26:33 +00:00
|
|
|
alacritty
|
|
|
|
];
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
# Use a fixed SWAYSOCK path (for swaymsg):
|
2021-06-24 17:57:07 +00:00
|
|
|
variables = {
|
|
|
|
"SWAYSOCK" = "/tmp/sway-ipc.sock";
|
2021-12-23 19:19:41 +00:00
|
|
|
# TODO: Investigate if we can get hardware acceleration to work (via
|
|
|
|
# virtio-gpu and Virgil). We currently have to use the Pixman software
|
|
|
|
# renderer since the GLES2 renderer doesn't work inside the VM (even
|
|
|
|
# with WLR_RENDERER_ALLOW_SOFTWARE):
|
|
|
|
# "WLR_RENDERER_ALLOW_SOFTWARE" = "1";
|
|
|
|
"WLR_RENDERER" = "pixman";
|
2024-12-10 19:26:33 +00:00
|
|
|
};
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
# For convenience:
|
|
|
|
shellAliases = {
|
2021-12-23 19:19:41 +00:00
|
|
|
test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok";
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok";
|
2024-12-10 19:26:33 +00:00
|
|
|
};
|
|
|
|
|
2021-12-23 19:19:41 +00:00
|
|
|
# To help with OCR:
|
|
|
|
etc."xdg/foot/foot.ini".text = lib.generators.toINI { } {
|
|
|
|
main = {
|
|
|
|
font = "inconsolata:size=14";
|
2024-12-10 19:26:33 +00:00
|
|
|
};
|
2021-12-23 19:19:41 +00:00
|
|
|
colors = rec {
|
|
|
|
foreground = "000000";
|
|
|
|
background = "ffffff";
|
|
|
|
regular2 = foreground;
|
2024-12-10 19:26:33 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-06-21 14:08:00 +00:00
|
|
|
etc."gpg-agent.conf".text = ''
|
|
|
|
pinentry-timeout 86400
|
2024-12-10 19:26:33 +00:00
|
|
|
'';
|
2021-12-23 19:19:41 +00:00
|
|
|
};
|
2023-06-21 14:08:00 +00:00
|
|
|
|
|
|
|
fonts.packages = [ pkgs.inconsolata ];
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 14:08:00 +00:00
|
|
|
# Automatically configure and start Sway when logging in on tty1:
|
|
|
|
programs.bash.loginShellInit = ''
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
if [ "$(tty)" = "/dev/tty1" ]; then
|
2024-12-10 19:26:33 +00:00
|
|
|
set -e
|
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
mkdir -p ~/.config/sway
|
2023-06-21 14:08:00 +00:00
|
|
|
sed s/Mod4/Mod1/ /etc/sway/config > ~/.config/sway/config
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
|
2023-07-19 11:43:36 +00:00
|
|
|
sway --validate
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
sway && touch /tmp/sway-exit-ok
|
2023-07-19 11:43:36 +00:00
|
|
|
fi
|
|
|
|
'';
|
2021-12-23 19:19:41 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
programs.sway.enable = true;
|
|
|
|
|
|
|
|
# To test pinentry via gpg-agent:
|
2021-05-13 18:35:45 +00:00
|
|
|
programs.gnupg.agent.enable = true;
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
|
2021-05-27 18:37:24 +00:00
|
|
|
# Need to switch to a different GPU driver than the default one (-vga std) so that Sway can launch:
|
|
|
|
virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
};
|
2024-12-10 19:26:33 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
testScript =
|
|
|
|
{ nodes, ... }:
|
|
|
|
''
|
2022-02-03 19:00:58 +00:00
|
|
|
import shlex
|
2023-06-21 12:58:10 +00:00
|
|
|
import json
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
q = shlex.quote
|
|
|
|
NODE_GROUPS = ["nodes", "floating_nodes"]
|
2024-12-10 19:26:33 +00:00
|
|
|
|
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
def swaymsg(command: str = "", succeed=True, type="command"):
|
|
|
|
assert command != "" or type != "command", "Must specify command or type"
|
|
|
|
shell = q(f"swaymsg -t {q(type)} -- {q(command)}")
|
|
|
|
with machine.nested(
|
|
|
|
f"sending swaymsg {shell!r}" + " (allowed to fail)" * (not succeed)
|
|
|
|
):
|
|
|
|
ret = (machine.succeed if succeed else machine.execute)(
|
|
|
|
f"su - alice -c {shell}"
|
|
|
|
)
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
# execute also returns a status code, but disregard.
|
|
|
|
if not succeed:
|
|
|
|
_, ret = ret
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
if not succeed and not ret:
|
|
|
|
return None
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
parsed = json.loads(ret)
|
|
|
|
return parsed
|
2024-12-10 19:26:33 +00:00
|
|
|
|
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
def walk(tree):
|
|
|
|
yield tree
|
|
|
|
for group in NODE_GROUPS:
|
|
|
|
for node in tree.get(group, []):
|
|
|
|
yield from walk(node)
|
2024-12-10 19:26:33 +00:00
|
|
|
|
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
def wait_for_window(pattern):
|
|
|
|
def func(last_chance):
|
|
|
|
nodes = (node["name"] for node in walk(swaymsg(type="get_tree")))
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
if last_chance:
|
|
|
|
nodes = list(nodes)
|
|
|
|
machine.log(f"Last call! Current list of windows: {nodes}")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
return any(pattern in name for name in nodes)
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
retry(func)
|
2024-12-10 19:26:33 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
# To check the version:
|
|
|
|
print(machine.succeed("sway --version"))
|
2024-12-10 19:26:33 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
# Wait for Sway to complete startup:
|
|
|
|
machine.wait_for_file("/run/user/1000/wayland-1")
|
|
|
|
machine.wait_for_file("/tmp/sway-ipc.sock")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2021-12-23 19:19:41 +00:00
|
|
|
# Test XWayland (foot does not support X):
|
2024-01-06 10:21:21 +00:00
|
|
|
swaymsg("exec WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY= alacritty")
|
2023-06-21 12:58:10 +00:00
|
|
|
wait_for_window("alice@machine")
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
machine.send_chars("test-x11\n")
|
|
|
|
machine.wait_for_file("/tmp/test-x11-exit-ok")
|
|
|
|
print(machine.succeed("cat /tmp/test-x11.out"))
|
2021-12-23 19:19:41 +00:00
|
|
|
machine.copy_from_vm("/tmp/test-x11.out")
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
machine.screenshot("alacritty_glinfo")
|
|
|
|
machine.succeed("pkill alacritty")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2021-12-23 19:19:41 +00:00
|
|
|
# Start a terminal (foot) on workspace 3:
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
machine.send_key("alt-3")
|
2021-12-23 19:19:41 +00:00
|
|
|
machine.sleep(3)
|
|
|
|
machine.send_key("alt-ret")
|
2023-06-21 12:58:10 +00:00
|
|
|
wait_for_window("alice@machine")
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
machine.send_chars("test-wayland\n")
|
|
|
|
machine.wait_for_file("/tmp/test-wayland-exit-ok")
|
|
|
|
print(machine.succeed("cat /tmp/test-wayland.out"))
|
2021-12-23 19:19:41 +00:00
|
|
|
machine.copy_from_vm("/tmp/test-wayland.out")
|
|
|
|
machine.screenshot("foot_wayland_info")
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
machine.send_key("alt-shift-q")
|
2021-12-23 19:19:41 +00:00
|
|
|
machine.wait_until_fails("pgrep foot")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2021-05-13 18:35:45 +00:00
|
|
|
# Test gpg-agent starting pinentry-gnome3 via D-Bus (tests if
|
|
|
|
# $WAYLAND_DISPLAY is correctly imported into the D-Bus user env):
|
2023-06-21 14:08:00 +00:00
|
|
|
swaymsg("exec mkdir -p ~/.gnupg")
|
|
|
|
swaymsg("exec cp /etc/gpg-agent.conf ~/.gnupg")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
swaymsg("exec DISPLAY=INVALID gpg --no-tty --yes --quick-generate-key test", succeed=False)
|
2021-05-13 18:35:45 +00:00
|
|
|
machine.wait_until_succeeds("pgrep --exact gpg")
|
2023-06-21 12:58:10 +00:00
|
|
|
wait_for_window("gpg")
|
|
|
|
machine.succeed("pgrep --exact gpg")
|
2021-05-13 18:35:45 +00:00
|
|
|
machine.screenshot("gpg_pinentry")
|
|
|
|
machine.send_key("alt-shift-q")
|
|
|
|
machine.wait_until_fails("pgrep --exact gpg")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
# Test swaynag:
|
2023-06-21 12:58:10 +00:00
|
|
|
def get_height():
|
|
|
|
return [node['rect']['height'] for node in walk(swaymsg(type="get_tree")) if node['focused']][0]
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-06-21 12:58:10 +00:00
|
|
|
before = get_height()
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
machine.send_key("alt-shift-e")
|
2023-06-21 12:58:10 +00:00
|
|
|
retry(lambda _: get_height() < before)
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
machine.screenshot("sway_exit")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2022-02-03 19:24:35 +00:00
|
|
|
swaymsg("exec swaylock")
|
|
|
|
machine.wait_until_succeeds("pgrep -x swaylock")
|
|
|
|
machine.sleep(3)
|
|
|
|
machine.send_chars("${nodes.machine.config.users.users.alice.password}")
|
|
|
|
machine.send_key("ret")
|
|
|
|
machine.wait_until_fails("pgrep -x swaylock")
|
2024-12-10 19:26:33 +00:00
|
|
|
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
# Exit Sway and verify process exit status 0:
|
2022-02-03 19:00:58 +00:00
|
|
|
swaymsg("exit", succeed=False)
|
2021-06-25 00:06:00 +00:00
|
|
|
machine.wait_until_fails("pgrep -x sway")
|
2021-12-23 19:19:41 +00:00
|
|
|
machine.wait_for_file("/tmp/sway-exit-ok")
|
nixos/tests/sway: init
This adds a basic test for Sway. Because Sway is an important part of
the Wayland ecosystem, is stable, and has few dependencies this test
should also be suitable for testing core packages it depends on (e.g.
wayland, wayland-protocols, wlroots, xwayland, mesa, libglvnd, libdrm,
and soon libseat).
The test is modeled after the suggested way of using Sway, i.e. logging
in via a virtual console (tty1) and copying the configuration from
/etc/sway/config (we replace Mod4 (the GNU/Tux key - you've replaced
that evil logo, right? :D) with Mod1 (Alt key) because QEMU monitor's
sendkey command doesn't support the former).
The shell aliases are used to make the sendkey log output shorter.
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
2021-05-01 20:24:28 +00:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
)
|