chiark / gitweb /
Run t-persist test with service user as root as well
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 2 Aug 2025 23:08:48 +0000 (00:08 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Mon, 29 Sep 2025 23:43:40 +0000 (00:43 +0100)
Services running as root should survive restarts just as well as ones
running as other users.  But I think start-stop-daemon will get this
wrong.

tests/t-persist

index b886f859bb17057001f057ddec4b3acd1d734766..2f4708a920aa51fb39e50cd7b28701e6b2725904 100755 (executable)
@@ -3,24 +3,26 @@ set -ex
 
 . tests/lib
 
-coproc userv --override 'execute cat -vet' games spong
+for service_user in games root; do
+    coproc userv --override 'execute cat -vet' "$service_user" spong
 
-stdout=${COPROC[0]}
-stdin=${COPROC[1]}
+    stdout=${COPROC[0]}
+    stdin=${COPROC[1]}
 
-print_expect_reply () {
-    local m=$1
-    local got
-    echo >&$stdin "$m"
-    read <&$stdout got
-    local exp="$(printf '%s$\n' "$m")"
-    test "$got" = "$exp"
-}
+    print_expect_reply () {
+        local m=$1
+        local got
+        echo >&$stdin "$m"
+        read <&$stdout got
+        local exp="$(printf '%s$\n' "$m")"
+        test "$got" = "$exp"
+    }
 
-print_expect_reply hi
+    print_expect_reply hi
 
-service userv restart
+    service userv restart
 
-print_expect_reply ho
+    print_expect_reply ho
+done
 
 echo ok.