]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test logind restart with different classes
authorMatteo Croce <teknoraver@meta.com>
Thu, 3 Apr 2025 10:57:37 +0000 (12:57 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 3 Apr 2025 22:14:42 +0000 (23:14 +0100)
Test logind restart with every possible value of XDG_SESSION_CLASS

test/units/TEST-35-LOGIN.sh

index 01dece997aec3b4886fde660569c0c4a6c0b3d7e..b19f42b524dfa8baf8d9670df4a6380f1b86df09 100755 (executable)
@@ -786,17 +786,23 @@ testcase_varlink() {
 }
 
 testcase_restart() {
-    local UNIT
+    local classes unit c
 
-    UNIT=user-sleeper.service
+    classes='user user-early user-incomplete greeter lock-screen background background-light manager manager-early'
 
-    systemd-run --service-type=notify run0 -u logind-test-user --unit="$UNIT" sleep infinity
-    systemctl restart systemd-logind
+    for c in $classes; do
+        unit="user-sleeper-$c.service"
+        systemd-run --service-type=notify run0  --setenv XDG_SESSION_CLASS="$c" -u logind-test-user --unit="$unit" sleep infinity
+    done
 
-    systemctl --quiet is-active "$UNIT"
-    loginctl | grep logind-test-user | grep -qw background
+    systemctl restart systemd-logind
 
-    systemctl kill "$UNIT"
+    for c in $classes; do
+        unit="user-sleeper-$c.service"
+        systemctl --quiet is-active "$unit"
+        loginctl | grep logind-test-user | grep -qw "$c"
+        systemctl kill "$unit"
+    done
 }
 
 setup_test_user