at 24.11-pre 2.2 kB view raw
1{ system, pkgs }: 2let 3 tests = { 4 xorg = { 5 node = { pkgs, ... }: { 6 imports = [ ./common/user-account.nix ./common/x11.nix ]; 7 services.xserver.enable = true; 8 services.xserver.displayManager.sessionCommands = '' 9 ${pkgs.drawterm}/bin/drawterm -g 1024x768 & 10 ''; 11 test-support.displayManager.auto.user = "alice"; 12 }; 13 systems = [ "x86_64-linux" "aarch64-linux" ]; 14 }; 15 wayland = { 16 node = { pkgs, ... }: { 17 imports = [ ./common/wayland-cage.nix ]; 18 services.cage.program = "${pkgs.drawterm-wayland}/bin/drawterm"; 19 }; 20 systems = [ "x86_64-linux" ]; 21 }; 22 }; 23 24 mkTest = name: machine: 25 import ./make-test-python.nix ({ pkgs, ... }: { 26 inherit name; 27 28 nodes = { "${name}" = machine; }; 29 30 meta = with pkgs.lib.maintainers; { 31 maintainers = [ moody ]; 32 }; 33 34 enableOCR = true; 35 36 testScript = '' 37 @polling_condition 38 def drawterm_running(): 39 machine.succeed("pgrep drawterm") 40 41 # cage is a bit wonky here. 42 # it seems to lag behind drawing 43 # and somehow needs a single input character 44 # in order to get the first prompt to show up. 45 # This is not present in any other compositor 46 # as far as I know, and after spending a couple 47 # hours with the upstream source trying to deduce 48 # how to perhaps fix it, I figured just polling is OK. 49 @polling_condition 50 def cpu_shown_up(): 51 machine.send_chars(".") 52 machine.wait_for_text("cpu", 1) 53 54 start_all() 55 56 machine.wait_for_unit("graphical.target") 57 drawterm_running.wait() # type: ignore[union-attr] 58 cpu_shown_up.wait() # type: ignore[union-attr] 59 machine.send_chars("cpu\n") 60 machine.wait_for_text("auth") 61 machine.send_chars("cpu\n") 62 machine.wait_for_text("ending") 63 machine.screenshot("out.png") 64 ''; 65 66 }); 67 mkTestOn = systems: name: machine: 68 if pkgs.lib.elem system systems then mkTest name machine 69 else { ... }: { }; 70in 71builtins.mapAttrs (k: v: mkTestOn v.systems k v.node { inherit system; }) tests