nixosTests.xss-lock: migrate to runTest

Part Of #386873
This commit is contained in:
Martin Weinelt 2025-03-14 23:07:18 +01:00
parent 20ad3329fe
commit 650ab40c81
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 39 additions and 42 deletions

View File

@ -1295,7 +1295,7 @@ in {
xrdp = handleTest ./xrdp.nix {};
xrdp-with-audio-pulseaudio = handleTest ./xrdp-with-audio-pulseaudio.nix {};
xscreensaver = handleTest ./xscreensaver.nix {};
xss-lock = handleTest ./xss-lock.nix {};
xss-lock = runTest ./xss-lock.nix;
xterm = runTest ./xterm.nix;
xxh = runTest ./xxh.nix;
yabar = runTest ./yabar.nix;

View File

@ -1,54 +1,51 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "xss-lock";
meta.maintainers = [ ];
{
name = "xss-lock";
meta.maintainers = [ ];
nodes = {
simple = {
nodes = {
simple = {
imports = [
./common/x11.nix
./common/user-account.nix
];
programs.xss-lock.enable = true;
test-support.displayManager.auto.user = "alice";
};
custom_lockcmd =
{ pkgs, ... }:
{
imports = [
./common/x11.nix
./common/user-account.nix
];
programs.xss-lock.enable = true;
test-support.displayManager.auto.user = "alice";
};
custom_lockcmd =
{ pkgs, ... }:
{
imports = [
./common/x11.nix
./common/user-account.nix
programs.xss-lock = {
enable = true;
extraOptions = [
"-n"
"${pkgs.libnotify}/bin/notify-send 'About to sleep!'"
];
test-support.displayManager.auto.user = "alice";
programs.xss-lock = {
enable = true;
extraOptions = [
"-n"
"${pkgs.libnotify}/bin/notify-send 'About to sleep!'"
];
lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant";
};
lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant";
};
};
};
};
testScript = ''
def perform_xsslock_test(machine, lockCmd):
machine.start()
machine.wait_for_x()
machine.wait_for_unit("xss-lock.service", "alice")
machine.fail(f"pgrep {lockCmd}")
machine.succeed("su -l alice -c 'xset dpms force standby'")
machine.wait_until_succeeds(f"pgrep {lockCmd}")
testScript = ''
def perform_xsslock_test(machine, lockCmd):
machine.start()
machine.wait_for_x()
machine.wait_for_unit("xss-lock.service", "alice")
machine.fail(f"pgrep {lockCmd}")
machine.succeed("su -l alice -c 'xset dpms force standby'")
machine.wait_until_succeeds(f"pgrep {lockCmd}")
with subtest("simple"):
perform_xsslock_test(simple, "i3lock")
with subtest("simple"):
perform_xsslock_test(simple, "i3lock")
with subtest("custom_cmd"):
perform_xsslock_test(custom_lockcmd, "xlock")
'';
}
)
with subtest("custom_cmd"):
perform_xsslock_test(custom_lockcmd, "xlock")
'';
}