wip: first PubSolarOS iso test using the NixOS
test suite: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
This commit is contained in:
parent
a79cb4f592
commit
528e69af1e
|
@ -122,7 +122,12 @@
|
||||||
imports = [ (digga.lib.importHosts ./hosts) ];
|
imports = [ (digga.lib.importHosts ./hosts) ];
|
||||||
hosts = {
|
hosts = {
|
||||||
/* set host specific properties here */
|
/* set host specific properties here */
|
||||||
PubSolarOS = { };
|
PubSolarOS = {
|
||||||
|
tests = [
|
||||||
|
(import ./tests/first-test.nix {})
|
||||||
|
(import ./tests/second-test.nix {})
|
||||||
|
];
|
||||||
|
};
|
||||||
fae = {
|
fae = {
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
};
|
};
|
||||||
|
|
52
tests/first-test.nix
Normal file
52
tests/first-test.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{ }:
|
||||||
|
{
|
||||||
|
name = "firstTest";
|
||||||
|
|
||||||
|
nodes.test-machine = { suites ? null, ... }: {
|
||||||
|
imports = suites.iso;
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
variables = {
|
||||||
|
"SWAYSOCK" = "/tmp/sway-ipc.sock";
|
||||||
|
# TODO: Investigate if we can get hardware acceleration to work (via
|
||||||
|
# virtio-gpu and Virgil). We currently have to use the Pixman software
|
||||||
|
# renderer since the GLES2 renderer doesn't work inside the VM (even
|
||||||
|
# with WLR_RENDERER_ALLOW_SOFTWARE):
|
||||||
|
# "WLR_RENDERER_ALLOW_SOFTWARE" = "1";
|
||||||
|
"WLR_RENDERER" = "pixman";
|
||||||
|
};
|
||||||
|
|
||||||
|
shellAliases = {
|
||||||
|
test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# 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" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
enableOCR = true;
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("multi-user.target")
|
||||||
|
# To check the version:
|
||||||
|
print(machine.succeed("sway --version"))
|
||||||
|
# Wait for Sway to complete startup:
|
||||||
|
machine.wait_for_file("/run/user/1000/wayland-1")
|
||||||
|
machine.wait_for_file("/tmp/sway-ipc.sock")
|
||||||
|
|
||||||
|
# Start a terminal (alacritty) on workspace 3:
|
||||||
|
machine.send_key("super-3")
|
||||||
|
machine.sleep(3)
|
||||||
|
machine.send_key("super-ret")
|
||||||
|
machine.send_chars("whoami\n")
|
||||||
|
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.screenshot("alacritty_wayland_info")
|
||||||
|
machine.send_key("super-shift-q")
|
||||||
|
machine.wait_until_fails("pgrep alacritty")
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue