diff --git a/flake.nix b/flake.nix index f7ca19a7..00514452 100644 --- a/flake.nix +++ b/flake.nix @@ -114,7 +114,7 @@ /* set host specific properties here */ PubSolarOS = { tests = [ - (import ./tests/first-test.nix { pkgs = nixos.legacyPackages.x86_64-linux; }) + (import ./tests/first-test.nix { pkgs = nixos.legacyPackages.x86_64-linux; lib = nixos.lib; }) ]; }; }; diff --git a/tests/first-test.nix b/tests/first-test.nix index 95e2f411..251779a1 100644 --- a/tests/first-test.nix +++ b/tests/first-test.nix @@ -1,10 +1,15 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { name = "firstTest"; nodes.test-machine = { suites ? null, ... }: { imports = suites.iso; + home-manager.users.pub-solar.programs.zsh.shellAliases = { + test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok"; + test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok"; + }; + # source: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/tests/sway.nix environment = { # For glinfo and wayland-info: @@ -20,14 +25,25 @@ "WLR_RENDERER" = "pixman"; }; - shellAliases = { - test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok"; - test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok"; + # To help with OCR: + etc."xdg/foot/foot.ini".text = lib.generators.toINI { } { + main = { + font = "inconsolata:size=14"; + }; + colors = rec { + foreground = "000000"; + background = "ffffff"; + regular2 = foreground; + }; }; }; + fonts.fonts = [ pkgs.inconsolata ]; + # Need to switch to a different GPU driver than the default one (-vga std) so that Sway can launch: virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; + virtualisation.cores = 4; + virtualisation.memorySize = 2048; }; enableOCR = true; @@ -49,18 +65,6 @@ # Wait for Sway to complete startup: machine.wait_for_file("/run/user/1000/wayland-1") machine.wait_for_file("/tmp/sway-ipc.sock") - machine.wait_for_file("/run/user/1000/pipewire-0") - - # Test XWayland (foot does not support X): - machine.sleep(10) - swaymsg("exec WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY=invalid alacritty") - machine.wait_for_text("~") - machine.send_chars("test-x11\n") - machine.wait_for_file("/tmp/test-x11-exit-ok") - print(machine.succeed("cat /tmp/test-x11.out")) - machine.copy_from_vm("/tmp/test-x11.out") - machine.screenshot("alacritty_glinfo") - machine.succeed("pkill alacritty") # Start a terminal (foot) on workspace 3: machine.wait_for_text("1") @@ -69,11 +73,13 @@ machine.send_key("meta_l-ret") machine.sleep(10) machine.send_chars("whoami\n") + machine.sleep(3) machine.wait_for_text("pub-solar") machine.send_chars("test-wayland\n") machine.wait_for_file("/tmp/test-wayland-exit-ok") print(machine.succeed("cat /tmp/test-wayland.out")) machine.copy_from_vm("/tmp/test-wayland.out") + machine.sleep(3) machine.screenshot("foot_wayland_info") machine.send_key("meta_l-shift-q") machine.wait_until_fails("pgrep foot")