nixpkgs/nixos/tests/cage.nix
Michael Weiss af99194379
nixos/tests/cage: Increase the xterm font size to fix the test
The result still looks far from ideal but at least it gets recognized
now. "-fa Monospace" is required to switch to a font from the FreeType
library so that "-fs 24" works.

Note: Using linuxPackages_latest is not required anymore.
2021-04-29 21:08:10 +02:00

36 lines
883 B
Nix

import ./make-test-python.nix ({ pkgs, ...} :
{
name = "cage";
meta = with pkgs.lib.maintainers; {
maintainers = [ matthewbauer ];
};
machine = { ... }:
{
imports = [ ./common/user-account.nix ];
services.cage = {
enable = true;
user = "alice";
# Disable color and bold and use a larger font to make OCR easier:
program = "${pkgs.xterm}/bin/xterm -cm -pc -fa Monospace -fs 24";
};
virtualisation.memorySize = 1024;
};
enableOCR = true;
testScript = { nodes, ... }: let
user = nodes.machine.config.users.users.alice;
in ''
with subtest("Wait for cage to boot up"):
start_all()
machine.wait_for_file("/run/user/${toString user.uid}/wayland-0.lock")
machine.wait_until_succeeds("pgrep xterm")
machine.wait_for_text("alice@machine")
machine.screenshot("screen")
'';
})