summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorIngo Blechschmidt <iblech@web.de>2020-04-13 05:56:20 +0200
committerLinus Heckemann <git@sphalerite.org>2021-07-20 15:22:31 +0200
commit5143ab9f742d27086790e07ebf35f36cb6b26ade (patch)
treeec6962b7594145bfe08ca464c567fce57ffde616 /nixos/tests
parentb59c06dc92f8d03660eb4155754d93a6c34cda83 (diff)
downloadnixpkgs-5143ab9f742d27086790e07ebf35f36cb6b26ade.tar
nixpkgs-5143ab9f742d27086790e07ebf35f36cb6b26ade.tar.gz
nixpkgs-5143ab9f742d27086790e07ebf35f36cb6b26ade.tar.bz2
nixpkgs-5143ab9f742d27086790e07ebf35f36cb6b26ade.tar.lz
nixpkgs-5143ab9f742d27086790e07ebf35f36cb6b26ade.tar.xz
nixpkgs-5143ab9f742d27086790e07ebf35f36cb6b26ade.tar.zst
nixpkgs-5143ab9f742d27086790e07ebf35f36cb6b26ade.zip
tigervnc, tightvnc: add basic tests
Co-Authored-By: Ingo Blechschmidt <iblech@web.de>
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/tigervnc.nix53
2 files changed, 54 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 76e5077f42d..6abbc92d643 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -421,6 +421,7 @@ in
   taskserver = handleTest ./taskserver.nix {};
   telegraf = handleTest ./telegraf.nix {};
   tiddlywiki = handleTest ./tiddlywiki.nix {};
+  tigervnc = handleTest ./tigervnc.nix {};
   timezone = handleTest ./timezone.nix {};
   tinc = handleTest ./tinc {};
   tinydns = handleTest ./tinydns.nix {};
diff --git a/nixos/tests/tigervnc.nix b/nixos/tests/tigervnc.nix
new file mode 100644
index 00000000000..c0a52808b27
--- /dev/null
+++ b/nixos/tests/tigervnc.nix
@@ -0,0 +1,53 @@
+{ system ? builtins.currentSystem
+, config ? {}
+, pkgs ? import ../.. { inherit system config; }
+}:
+
+with import ../lib/testing-python.nix { inherit system pkgs; };
+makeTest {
+  name = "tigervnc";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ lheckemann ];
+  };
+
+  nodes = {
+    server = { pkgs, ...}: {
+      environment.systemPackages = with pkgs; [
+        tigervnc # for Xvnc
+        xorg.xwininfo
+        imagemagickBig # for display with working label: support
+      ];
+      networking.firewall.allowedTCPPorts = [ 5901 ];
+    };
+
+    client = { pkgs, ... }: {
+      imports = [ ./common/x11.nix ];
+      # for vncviewer
+      environment.systemPackages = [ pkgs.tigervnc ];
+    };
+  };
+
+  enableOCR = true;
+
+  testScript = ''
+    start_all()
+
+    for host in [server, client]:
+        host.succeed("echo foobar | vncpasswd -f > vncpasswd")
+
+    server.succeed("Xvnc -geometry 720x576 :1 -PasswordFile vncpasswd &")
+    server.wait_until_succeeds("nc -z localhost 5901", timeout=10)
+    server.succeed("DISPLAY=:1 xwininfo -root | grep 720x576")
+    server.execute("DISPLAY=:1 display -size 360x200 -font sans -gravity south label:'HELLO VNC WORLD' &")
+
+    client.wait_for_x()
+    client.execute("vncviewer server:1 -PasswordFile vncpasswd &")
+    client.wait_for_window(r"VNC")
+    client.screenshot("screenshot")
+    text = client.get_screen_text()
+    # Displayed text
+    assert 'HELLO VNC WORLD' in text
+    # Client window title
+    assert 'TigerVNC' in text
+  '';
+}