2020-04-13 05:56:20 +02:00
|
|
|
{ system ? builtins.currentSystem
|
|
|
|
, config ? {}
|
|
|
|
, pkgs ? import ../.. { inherit system config; }
|
|
|
|
}:
|
|
|
|
|
|
|
|
with import ../lib/testing-python.nix { inherit system pkgs; };
|
|
|
|
makeTest {
|
|
|
|
name = "tigervnc";
|
2021-09-22 08:33:38 +02:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2020-04-13 05:56:20 +02:00
|
|
|
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")
|
|
|
|
|
2021-11-05 01:43:22 +01:00
|
|
|
server.succeed("Xvnc -geometry 720x576 :1 -PasswordFile vncpasswd >&2 &")
|
2020-04-13 05:56:20 +02:00
|
|
|
server.wait_until_succeeds("nc -z localhost 5901", timeout=10)
|
|
|
|
server.succeed("DISPLAY=:1 xwininfo -root | grep 720x576")
|
2021-11-05 01:43:22 +01:00
|
|
|
server.execute("DISPLAY=:1 display -size 360x200 -font sans -gravity south label:'HELLO VNC WORLD' >&2 &")
|
2020-04-13 05:56:20 +02:00
|
|
|
|
|
|
|
client.wait_for_x()
|
2021-11-05 01:43:22 +01:00
|
|
|
client.execute("vncviewer server:1 -PasswordFile vncpasswd >&2 &")
|
2020-04-13 05:56:20 +02:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
}
|