mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 05:00:16 +00:00
Merge pull request #130778 from mayflower/tigervnc-tests-and-no-proprietary-fonts
Tigervnc tests and no proprietary fonts
This commit is contained in:
commit
72d1d4cb20
|
@ -499,7 +499,7 @@ class Machine:
|
||||||
output += out
|
output += out
|
||||||
return output
|
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.
|
"""Wait until a command returns success and return its output.
|
||||||
Throws an exception on timeout.
|
Throws an exception on timeout.
|
||||||
"""
|
"""
|
||||||
|
@ -511,7 +511,7 @@ class Machine:
|
||||||
return status == 0
|
return status == 0
|
||||||
|
|
||||||
with self.nested("waiting for success: {}".format(command)):
|
with self.nested("waiting for success: {}".format(command)):
|
||||||
retry(check_success)
|
retry(check_success, timeout)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def wait_until_fails(self, command: str) -> str:
|
def wait_until_fails(self, command: str) -> str:
|
||||||
|
|
|
@ -424,6 +424,7 @@ in
|
||||||
taskserver = handleTest ./taskserver.nix {};
|
taskserver = handleTest ./taskserver.nix {};
|
||||||
telegraf = handleTest ./telegraf.nix {};
|
telegraf = handleTest ./telegraf.nix {};
|
||||||
tiddlywiki = handleTest ./tiddlywiki.nix {};
|
tiddlywiki = handleTest ./tiddlywiki.nix {};
|
||||||
|
tigervnc = handleTest ./tigervnc.nix {};
|
||||||
timezone = handleTest ./timezone.nix {};
|
timezone = handleTest ./timezone.nix {};
|
||||||
tinc = handleTest ./tinc {};
|
tinc = handleTest ./tinc {};
|
||||||
tinydns = handleTest ./tinydns.nix {};
|
tinydns = handleTest ./tinydns.nix {};
|
||||||
|
|
53
nixos/tests/tigervnc.nix
Normal file
53
nixos/tests/tigervnc.nix
Normal file
|
@ -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
|
||||||
|
'';
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
{ lib, stdenv, fetchFromGitHub
|
{ lib, stdenv, fetchFromGitHub
|
||||||
, xorg, xkeyboard_config, zlib
|
, xorg, xkeyboard_config, zlib
|
||||||
, libjpeg_turbo, pixman, fltk
|
, libjpeg_turbo, pixman, fltk
|
||||||
, fontDirectories
|
|
||||||
, cmake, gettext, libtool
|
, cmake, gettext, libtool
|
||||||
, libGLU
|
, libGLU
|
||||||
, gnutls, pam, nettle
|
, gnutls, pam, nettle
|
||||||
, xterm, openssh, perl
|
, xterm, openssh, perl
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -22,17 +22,10 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "sha256-IX39oEhTyk7NV+9dD9mFtes22fBdMTAVIv5XkqFK560=";
|
sha256 = "sha256-IX39oEhTyk7NV+9dD9mFtes22fBdMTAVIv5XkqFK560=";
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit fontDirectories;
|
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -xkbdir ${xkeyboard_config}/etc/X11/xkb";' unix/vncserver/vncserver.in
|
sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -xkbdir ${xkeyboard_config}/etc/X11/xkb";' unix/vncserver/vncserver.in
|
||||||
fontPath=
|
fontPath=
|
||||||
for i in $fontDirectories; do
|
|
||||||
for j in $(find $i -name fonts.dir); do
|
|
||||||
addToSearchPathWithCustomDelimiter "," fontPath $(dirname $j)
|
|
||||||
done
|
|
||||||
done
|
|
||||||
sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -fp '"$fontPath"'";' unix/vncserver/vncserver.in
|
|
||||||
substituteInPlace vncviewer/vncviewer.cxx \
|
substituteInPlace vncviewer/vncviewer.cxx \
|
||||||
--replace '"/usr/bin/ssh' '"${openssh}/bin/ssh'
|
--replace '"/usr/bin/ssh' '"${openssh}/bin/ssh'
|
||||||
'';
|
'';
|
||||||
|
@ -98,6 +91,8 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
propagatedBuildInputs = xorg.xorgserver.propagatedBuildInputs;
|
propagatedBuildInputs = xorg.xorgserver.propagatedBuildInputs;
|
||||||
|
|
||||||
|
passthru.tests.tigervnc = nixosTests.vnc.testTigerVNC;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "https://tigervnc.org/";
|
homepage = "https://tigervnc.org/";
|
||||||
license = lib.licenses.gpl2Plus;
|
license = lib.licenses.gpl2Plus;
|
||||||
|
|
|
@ -9888,9 +9888,7 @@ in
|
||||||
|
|
||||||
tftp-hpa = callPackage ../tools/networking/tftp-hpa {};
|
tftp-hpa = callPackage ../tools/networking/tftp-hpa {};
|
||||||
|
|
||||||
tigervnc = callPackage ../tools/admin/tigervnc {
|
tigervnc = callPackage ../tools/admin/tigervnc {};
|
||||||
fontDirectories = [ xorg.fontadobe75dpi xorg.fontmiscmisc xorg.fontcursormisc xorg.fontbhlucidatypewriter75dpi ];
|
|
||||||
};
|
|
||||||
|
|
||||||
tightvnc = callPackage ../tools/admin/tightvnc {
|
tightvnc = callPackage ../tools/admin/tightvnc {
|
||||||
fontDirectories = [ xorg.fontadobe75dpi xorg.fontmiscmisc xorg.fontcursormisc
|
fontDirectories = [ xorg.fontadobe75dpi xorg.fontmiscmisc xorg.fontcursormisc
|
||||||
|
|
Loading…
Reference in a new issue