tigervnc, tightvnc: add basic tests

Co-Authored-By: Ingo Blechschmidt <iblech@web.de>
wip/nixpkgs-raku
Ingo Blechschmidt 4 years ago committed by Linus Heckemann
parent b59c06dc92
commit 5143ab9f74
  1. 4
      nixos/lib/test-driver/test-driver.py
  2. 1
      nixos/tests/all-tests.nix
  3. 53
      nixos/tests/tigervnc.nix
  4. 3
      pkgs/tools/admin/tigervnc/default.nix

@ -499,7 +499,7 @@ class Machine:
output += out
return output
def wait_until_succeeds(self, command: str) -> str:
def wait_until_succeeds(self, command: str, timeout: int = 900) -> str:
"""Wait until a command returns success and return its output.
Throws an exception on timeout.
"""
@ -511,7 +511,7 @@ class Machine:
return status == 0
with self.nested("waiting for success: {}".format(command)):
retry(check_success)
retry(check_success, timeout)
return output
def wait_until_fails(self, command: str) -> str:

@ -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 {};

@ -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
'';
}

@ -7,6 +7,7 @@
, gnutls, pam, nettle
, xterm, openssh, perl
, makeWrapper
, nixosTests
}:
with lib;
@ -98,6 +99,8 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = xorg.xorgserver.propagatedBuildInputs;
passthru.tests.tigervnc = nixosTests.vnc.testTigerVNC;
meta = {
homepage = "https://tigervnc.org/";
license = lib.licenses.gpl2Plus;

Loading…
Cancel
Save