aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-11 21:06:44 +0900
committerOphestra <cat@gensokyo.uk>2026-03-12 00:52:18 +0900
commit04e6bc3c5c99d6a99f17cfa5f69f34fe8941aee2 (patch)
tree2ad64307c13e2f967fdf17c5f02e7682189b22e1 /test
parent5c540f90aa5ac069a370cbef0ddd81fa268b43c5 (diff)
hst: expose scheduling policy
This is primarily useful for poorly written music players for now. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test')
-rw-r--r--test/configuration.nix9
-rw-r--r--test/interactive/configuration.nix8
-rw-r--r--test/test.py8
3 files changed, 25 insertions, 0 deletions
diff --git a/test/configuration.nix b/test/configuration.nix
index 5724ec4f..62d8239d 100644
--- a/test/configuration.nix
+++ b/test/configuration.nix
@@ -28,6 +28,15 @@
# Automatically login on tty1 as a normal user:
services.getty.autologinUser = "alice";
+ security.pam.loginLimits = [
+ {
+ domain = "@users";
+ item = "rtprio";
+ type = "-";
+ value = 1;
+ }
+ ];
+
environment = {
systemPackages = with pkgs; [
# For D-Bus tests:
diff --git a/test/interactive/configuration.nix b/test/interactive/configuration.nix
index 49c90343..9d1bddd8 100644
--- a/test/interactive/configuration.nix
+++ b/test/interactive/configuration.nix
@@ -23,6 +23,14 @@
security = {
sudo.wheelNeedsPassword = false;
rtkit.enable = true;
+ pam.loginLimits = [
+ {
+ domain = "@users";
+ item = "rtprio";
+ type = "-";
+ value = 1;
+ }
+ ];
};
services = {
diff --git a/test/test.py b/test/test.py
index 485e475f..9071f563 100644
--- a/test/test.py
+++ b/test/test.py
@@ -206,6 +206,14 @@ machine.wait_until_fails("pgrep foot", timeout=5)
machine.wait_for_file("/tmp/shim-cont-unexpected-pid")
print(machine.succeed('grep "shim: got SIGCONT from unexpected process$" /tmp/shim-cont-unexpected-pid'))
+# Check setscheduler:
+sched_unset = int(machine.succeed("sudo -u alice -i hakurei -v run cat /proc/self/sched | grep '^policy' | tr -d ' ' | cut -d ':' -f 2"))
+if sched_unset != 0:
+ raise Exception(f"unexpected unset policy: {sched_unset}")
+sched_idle = int(machine.succeed("sudo -u alice -i hakurei -v run --sched=idle cat /proc/self/sched | grep '^policy' | tr -d ' ' | cut -d ':' -f 2"))
+if sched_idle != 5:
+ raise Exception(f"unexpected idle policy: {sched_idle}")
+
# Start app (foot) with Wayland enablement:
swaymsg("exec ne-foot")
wait_for_window(f"u0_a{hakurei_identity(0)}@machine")