3
0
Fork 0
forked from mirrors/nixpkgs

drawterm: add nixos tests

This commit is contained in:
Jacob Moody 2023-12-23 15:53:20 -06:00
parent 54670895d3
commit c16ffa0a12
3 changed files with 64 additions and 1 deletions

View file

@ -257,6 +257,7 @@ in {
dolibarr = handleTest ./dolibarr.nix {};
domination = handleTest ./domination.nix {};
dovecot = handleTest ./dovecot.nix {};
drawterm = discoverTests (import ./drawterm.nix);
drbd = handleTest ./drbd.nix {};
dublin-traceroute = handleTest ./dublin-traceroute.nix {};
earlyoom = handleTestOn ["x86_64-linux"] ./earlyoom.nix {};

58
nixos/tests/drawterm.nix Normal file
View file

@ -0,0 +1,58 @@
{ system, pkgs }:
let
tests = {
xorg = {
node = { pkgs, ... }: {
imports = [ ./common/user-account.nix ./common/x11.nix ];
services.xserver.enable = true;
services.xserver.displayManager.sessionCommands = ''
${pkgs.drawterm}/bin/drawterm -g 1024x768 &
'';
test-support.displayManager.auto.user = "alice";
};
systems = [ "x86_64-linux" "aarch64-linux" ];
};
wayland = {
node = { pkgs, ... }: {
imports = [ ./common/wayland-cage.nix ];
services.cage.program = "${pkgs.drawterm-wayland}/bin/drawterm";
};
systems = [ "x86_64-linux" ];
};
};
mkTest = name: machine:
import ./make-test-python.nix ({ pkgs, ... }: {
inherit name;
nodes = { "${name}" = machine; };
meta = with pkgs.lib.maintainers; {
maintainers = [ moody ];
};
enableOCR = true;
testScript = ''
@polling_condition
def drawterm_running():
machine.succeed("pgrep drawterm")
start_all()
machine.wait_for_unit("graphical.target")
drawterm_running.wait() # type: ignore[union-attr]
machine.wait_for_text("cpu")
machine.send_chars("cpu\n")
machine.wait_for_text("auth")
machine.send_chars("cpu\n")
machine.wait_for_text("ending")
machine.screenshot("out.png")
'';
});
mkTestOn = systems: name: machine:
if pkgs.lib.elem system systems then mkTest name machine
else { ... }: { };
in
builtins.mapAttrs (k: v: mkTestOn v.systems k v.node { inherit system; }) tests

View file

@ -14,6 +14,7 @@
, wlr-protocols
, pulseaudio
, config
, nixosTests
}:
stdenv.mkDerivation {
@ -56,7 +57,10 @@ stdenv.mkDerivation {
installManPage drawterm.1
'';
passthru.updateScript = unstableGitUpdater { shallowClone = false; };
passthru = {
updateScript = unstableGitUpdater { shallowClone = false; };
tests = nixosTests.drawterm;
};
meta = with lib; {
description = "Connect to Plan 9 CPU servers from other operating systems.";