at 23.11-pre 1.5 kB view raw
1{ system ? builtins.currentSystem 2, config ? {} 3, pkgs ? import ../.. { inherit system config; } 4}: 5 6with import ../lib/testing-python.nix { inherit system pkgs; }; 7makeTest { 8 name = "tigervnc"; 9 meta = with pkgs.lib.maintainers; { 10 maintainers = [ lheckemann ]; 11 }; 12 13 nodes = { 14 server = { pkgs, ...}: { 15 environment.systemPackages = with pkgs; [ 16 tigervnc # for Xvnc 17 xorg.xwininfo 18 imagemagickBig # for display with working label: support 19 ]; 20 networking.firewall.allowedTCPPorts = [ 5901 ]; 21 }; 22 23 client = { pkgs, ... }: { 24 imports = [ ./common/x11.nix ]; 25 # for vncviewer 26 environment.systemPackages = [ pkgs.tigervnc ]; 27 }; 28 }; 29 30 enableOCR = true; 31 32 testScript = '' 33 start_all() 34 35 for host in [server, client]: 36 host.succeed("echo foobar | vncpasswd -f > vncpasswd") 37 38 server.succeed("Xvnc -geometry 720x576 :1 -PasswordFile vncpasswd >&2 &") 39 server.wait_until_succeeds("nc -z localhost 5901", timeout=10) 40 server.succeed("DISPLAY=:1 xwininfo -root | grep 720x576") 41 server.execute("DISPLAY=:1 display -size 360x200 -font sans -gravity south label:'HELLO VNC WORLD' >&2 &") 42 43 client.wait_for_x() 44 client.execute("vncviewer server:1 -PasswordFile vncpasswd >&2 &") 45 client.wait_for_window(r"VNC") 46 client.screenshot("screenshot") 47 text = client.get_screen_text() 48 # Displayed text 49 assert 'HELLO VNC WORLD' in text 50 # Client window title 51 assert 'TigerVNC' in text 52 ''; 53}