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