]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-07-PID: wait for sleep command being executed by sd-executor
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 10 Dec 2024 15:28:45 +0000 (00:28 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 10 Dec 2024 19:19:54 +0000 (19:19 +0000)
Hopefully fixes #35528.

test/units/TEST-07-PID1.private-pids.sh

index a64b124d93ad0c3c7242f8dc0ccf29bce4842816..eede43cbaf65de68ae8de07ba6664c0da3ca3224 100755 (executable)
@@ -50,7 +50,7 @@ testcase_basic() {
     systemd-run -p PrivatePIDs=yes --remain-after-exit --unit TEST-07-PID1-private-pid sleep infinity
     # Wait for ExecMainPID to be correctly populated as there might be a race between spawning service
     # and actual exec child process
-    sleep 2
+    timeout 10s bash -xec 'until [[ "$(cat /proc/$(systemctl show TEST-07-PID1-private-pid.service -p ExecMainPID --value)/comm)" == sleep ]]; do sleep .5; done'
     pid=$(systemctl show TEST-07-PID1-private-pid.service -p ExecMainPID --value)
     kill -9 "$pid"
     timeout 10s bash -xec 'while [[ "$(systemctl show -P SubState TEST-07-PID1-private-pid.service)" != "failed" ]]; do sleep .5; done'