nixosTests.sddm: handleTest -> runTest

This commit is contained in:
Sizhe Zhao 2025-07-09 12:30:20 +08:00
parent a698ac1214
commit 447c8559c9
No known key found for this signature in database
GPG Key ID: ED1807251A7DA08F
2 changed files with 52 additions and 67 deletions

View File

@ -1265,7 +1265,7 @@ in
scion-freestanding-deployment = handleTest ./scion/freestanding-deployment { };
scrutiny = runTest ./scrutiny.nix;
scx = runTest ./scx/default.nix;
sddm = handleTest ./sddm.nix { };
sddm = import ./sddm.nix { inherit runTest; };
sdl3 = runTest ./sdl3.nix;
seafile = runTest ./seafile.nix;
searx = runTest ./searx.nix;

View File

@ -1,77 +1,62 @@
{ runTest }:
{
system ? builtins.currentSystem,
config ? { },
pkgs ? import ../.. { inherit system config; },
}:
default = runTest {
name = "sddm";
with import ../lib/testing-python.nix { inherit system pkgs; };
let
inherit (pkgs) lib;
tests = {
default = {
name = "sddm";
nodes.machine =
{ ... }:
{
imports = [ ./common/user-account.nix ];
services.xserver.enable = true;
services.displayManager.sddm.enable = true;
services.displayManager.defaultSession = "none+icewm";
services.xserver.windowManager.icewm.enable = true;
};
enableOCR = true;
testScript =
{ nodes, ... }:
let
user = nodes.machine.users.users.alice;
in
''
start_all()
machine.wait_for_text("(?i)select your user")
machine.screenshot("sddm")
machine.send_chars("${user.password}\n")
machine.wait_for_file("/tmp/xauth_*")
machine.succeed("xauth merge /tmp/xauth_*")
machine.wait_for_window("^IceWM ")
'';
nodes.machine = {
imports = [ ./common/user-account.nix ];
services.xserver.enable = true;
services.displayManager.sddm.enable = true;
services.displayManager.defaultSession = "none+icewm";
services.xserver.windowManager.icewm.enable = true;
};
autoLogin = {
enableOCR = true;
testScript =
{ nodes, ... }:
let
user = nodes.machine.users.users.alice;
in
''
start_all()
machine.wait_for_text("(?i)select your user")
machine.screenshot("sddm")
machine.send_chars("${user.password}\n")
machine.wait_for_file("/tmp/xauth_*")
machine.succeed("xauth merge /tmp/xauth_*")
machine.wait_for_window("^IceWM ")
'';
};
autoLogin = runTest (
{ lib, ... }:
{
name = "sddm-autologin";
meta = with pkgs.lib.maintainers; {
meta = with lib.maintainers; {
maintainers = [ ttuegel ];
};
nodes.machine =
{ ... }:
{
imports = [ ./common/user-account.nix ];
services.xserver.enable = true;
services.displayManager = {
sddm.enable = true;
autoLogin = {
enable = true;
user = "alice";
};
nodes.machine = {
imports = [ ./common/user-account.nix ];
services.xserver.enable = true;
services.displayManager = {
sddm.enable = true;
autoLogin = {
enable = true;
user = "alice";
};
services.displayManager.defaultSession = "none+icewm";
services.xserver.windowManager.icewm.enable = true;
};
services.displayManager.defaultSession = "none+icewm";
services.xserver.windowManager.icewm.enable = true;
};
testScript =
{ nodes, ... }:
''
start_all()
machine.wait_for_file("/tmp/xauth_*")
machine.succeed("xauth merge /tmp/xauth_*")
machine.wait_for_window("^IceWM ")
'';
};
};
in
lib.mapAttrs (lib.const makeTest) tests
testScript = ''
start_all()
machine.wait_for_file("/tmp/xauth_*")
machine.succeed("xauth merge /tmp/xauth_*")
machine.wait_for_window("^IceWM ")
'';
}
);
}