about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien@users.noreply.github.com>2023-12-31 15:41:26 +0100
committerGitHub <noreply@github.com>2023-12-31 15:41:26 +0100
commita5cbc50912518d6cb043f705b1c55b586b3de277 (patch)
treebd671914754fe15a7ed12713c517ca67862e651b /nixos/tests
parent941af3cea623ef41e2413b8c6700a70d37d6b26a (diff)
parentc16ffa0a125a6098c094fcb19d63c6c4512072d7 (diff)
downloadnixlib-a5cbc50912518d6cb043f705b1c55b586b3de277.tar
nixlib-a5cbc50912518d6cb043f705b1c55b586b3de277.tar.gz
nixlib-a5cbc50912518d6cb043f705b1c55b586b3de277.tar.bz2
nixlib-a5cbc50912518d6cb043f705b1c55b586b3de277.tar.lz
nixlib-a5cbc50912518d6cb043f705b1c55b586b3de277.tar.xz
nixlib-a5cbc50912518d6cb043f705b1c55b586b3de277.tar.zst
nixlib-a5cbc50912518d6cb043f705b1c55b586b3de277.zip
Merge pull request #276385 from majiru/drawterm-tests
drawterm: unstable-2023-09-03 -> unstable-2023-12-23 & nixos tests
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/drawterm.nix58
2 files changed, 59 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 8aecad0f9531..02e3e91e2e3d 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -257,6 +257,7 @@ in {
   dolibarr = handleTest ./dolibarr.nix {};
   domination = handleTest ./domination.nix {};
   dovecot = handleTest ./dovecot.nix {};
+  drawterm = discoverTests (import ./drawterm.nix);
   drbd = handleTest ./drbd.nix {};
   dublin-traceroute = handleTest ./dublin-traceroute.nix {};
   earlyoom = handleTestOn ["x86_64-linux"] ./earlyoom.nix {};
diff --git a/nixos/tests/drawterm.nix b/nixos/tests/drawterm.nix
new file mode 100644
index 000000000000..1d444bb55433
--- /dev/null
+++ b/nixos/tests/drawterm.nix
@@ -0,0 +1,58 @@
+{ system, pkgs }:
+let
+  tests = {
+    xorg = {
+      node = { pkgs, ... }: {
+        imports = [ ./common/user-account.nix ./common/x11.nix ];
+        services.xserver.enable = true;
+        services.xserver.displayManager.sessionCommands = ''
+          ${pkgs.drawterm}/bin/drawterm -g 1024x768 &
+        '';
+        test-support.displayManager.auto.user = "alice";
+      };
+      systems = [ "x86_64-linux" "aarch64-linux" ];
+    };
+    wayland = {
+      node = { pkgs, ... }: {
+        imports = [ ./common/wayland-cage.nix ];
+        services.cage.program = "${pkgs.drawterm-wayland}/bin/drawterm";
+      };
+      systems = [ "x86_64-linux" ];
+    };
+  };
+
+  mkTest = name: machine:
+    import ./make-test-python.nix ({ pkgs, ... }: {
+      inherit name;
+
+      nodes = { "${name}" = machine; };
+
+      meta = with pkgs.lib.maintainers; {
+        maintainers = [ moody ];
+      };
+
+      enableOCR = true;
+
+      testScript = ''
+        @polling_condition
+        def drawterm_running():
+            machine.succeed("pgrep drawterm")
+
+        start_all()
+
+        machine.wait_for_unit("graphical.target")
+        drawterm_running.wait() # type: ignore[union-attr]
+        machine.wait_for_text("cpu")
+        machine.send_chars("cpu\n")
+        machine.wait_for_text("auth")
+        machine.send_chars("cpu\n")
+        machine.wait_for_text("ending")
+        machine.screenshot("out.png")
+      '';
+
+    });
+  mkTestOn = systems: name: machine:
+    if pkgs.lib.elem system systems then mkTest name machine
+    else { ... }: { };
+in
+builtins.mapAttrs (k: v: mkTestOn v.systems k v.node { inherit system; }) tests