git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/tests/tinywl: init

This adds a very minimalistic (in terms of functionality and dependencies) test for wlroots, Wayland, and related packages. The Sway test covers more functionality and packages (e.g. XWayland) but this test has tree advantages: - Less dependencies: Much fewer rebuilds are required when testing core changes that need to go through staging. - Testing wlroots updates: The Sway package isn't immediately updated after a new wlroots version is released and a lot of other packages depend on wlroots as well. - Determining whether a bug only affects Sway or wlroots/TinyWL as well.

commite9efbc0bbb222cc90d14ba919f77bb198dd2d55f authorMichael Weiss <dev.primeos@gmail.com> dateTue 28 Dec 2021, 21:32 (5 years ago) parent2bc8eed
4 files changed+62−1
nixos/tests/all-tests.nix+1 nixos/tests/tinywl.nix+56 pkgs/applications/window-managers/tinywl/default.nix+1−1 pkgs/development/libraries/wlroots/0.15.nix+4
nixos/tests/all-tests.nix+1
@@ -476,6 +476,7 @@ in
476476 timezone = handleTest ./timezone.nix {};
477477 tinc = handleTest ./tinc {};
478478 tinydns = handleTest ./tinydns.nix {};
479+ tinywl = handleTest ./tinywl.nix {};
479480 tor = handleTest ./tor.nix {};
480481 # traefik test relies on docker-containers
481482 traefik = handleTestOn ["x86_64-linux"] ./traefik.nix {};
nixos/tests/tinywl.nixnew file+56
@@ -0,0 +1,56 @@
1+import ./make-test-python.nix ({ pkgs, lib, ... }:
2+
3+ {
4+ name = "tinywl";
5+ meta = {
6+ maintainers = with lib.maintainers; [ primeos ];
7+ };
8+
9+ machine = { config, ... }: {
10+ # Automatically login on tty1 as a normal user:
11+ imports = [ ./common/user-account.nix ];
12+ services.getty.autologinUser = "alice";
13+
14+ environment = {
15+ systemPackages = with pkgs; [ tinywl foot wayland-utils ];
16+ };
17+
18+ # Automatically start TinyWL when logging in on tty1:
19+ programs.bash.loginShellInit = ''
20+ if [ "$(tty)" = "/dev/tty1" ]; then
21+ set -e
22+ test ! -e /tmp/tinywl.log # Only start tinywl once
23+ readonly TEST_CMD="wayland-info |& tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok; read"
24+ readonly FOOT_CMD="foot sh -c '$TEST_CMD'"
25+ tinywl -s "$FOOT_CMD" |& tee /tmp/tinywl.log
26+ touch /tmp/tinywl-exit-ok
27+ fi
28+ '';
29+
30+ # Switch to a different GPU driver (default: -vga std), otherwise TinyWL segfaults:
31+ virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
32+ };
33+
34+ testScript = { nodes, ... }: ''
35+ start_all()
36+ machine.wait_for_unit("multi-user.target")
37+
38+ # Wait for complete startup:
39+ machine.wait_until_succeeds("pgrep tinywl")
40+ machine.wait_for_file("/run/user/1000/wayland-0")
41+ machine.wait_until_succeeds("pgrep foot")
42+ machine.wait_for_file("/tmp/test-wayland-exit-ok")
43+
44+ # Make a screenshot and save the result:
45+ machine.screenshot("tinywl_foot")
46+ print(machine.succeed("cat /tmp/test-wayland.out"))
47+ machine.copy_from_vm("/tmp/test-wayland.out")
48+
49+ # Terminate cleanly:
50+ machine.send_key("alt-esc")
51+ machine.wait_until_fails("pgrep foot")
52+ machine.wait_until_fails("pgrep tinywl")
53+ machine.wait_for_file("/tmp/tinywl-exit-ok")
54+ machine.copy_from_vm("/tmp/tinywl.log")
55+ '';
56+ })
pkgs/applications/window-managers/tinywl/default.nix+1−1
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
2121 meta = with lib; {
2222 homepage = "https://github.com/swaywm/wlroots/tree/master/tinywl";
2323 description = ''A "minimum viable product" Wayland compositor based on wlroots'';
24− maintainers = with maintainers; [ qyliss ];
24+ maintainers = with maintainers; [ qyliss ] ++ wlroots.meta.maintainers;
2525 license = licenses.cc0;
2626 inherit (wlroots.meta) platforms;
2727 };
pkgs/development/libraries/wlroots/0.15.nix+4
@@ -2,6 +2,7 @@
22, libGL, wayland, wayland-protocols, libinput, libxkbcommon, pixman
33, xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa
44, libpng, ffmpeg, xcbutilrenderutil, seatd, vulkan-loader, glslang
5+, nixosTests
56
67, enableXWayland ? true, xwayland ? null
78}:
@@ -49,6 +50,9 @@ stdenv.mkDerivation rec {
4950 done
5051 '';
5152
53+ # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots):
54+ passthru.tests.tinywl = nixosTests.tinywl;
55+
5256 meta = with lib; {
5357 description = "A modular Wayland compositor library";
5458 longDescription = ''