]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: wait for the backgrounded socat job
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 5 Nov 2025 14:47:46 +0000 (15:47 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 5 Nov 2025 17:38:39 +0000 (17:38 +0000)
It should exit on its own anyway and this will work even if the job has
already finished* (unlike kill).

[*] assuming job control is off, as it's the case when running the
    test suite

Resolves: #39543

test/units/TEST-07-PID1.socket-defer.sh

index ec04f4f7e44be713e7ef9307cbcc25fdc2ca850f..efbb7e147258698c4fba4fcc15f270fe3d1fd10c 100755 (executable)
@@ -72,7 +72,7 @@ assert_eq "$(systemctl show "$UNIT_NAME.socket" -P SubState)" "listening"
 
 socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
 wait_for_start
-kill %%
+wait %%
 
 touch "/tmp/$UNIT_NAME/flag"
 systemctl start "$UNIT_NAME-conflict2.service"
@@ -80,7 +80,7 @@ wait_for_stop
 
 socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
 wait_for_start
-kill %%
+wait %%
 (! systemctl -q is-active "$UNIT_NAME-conflict2.service")
 
 # DeferTrigger=yes
@@ -99,7 +99,7 @@ assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
 socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
 timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
 (! systemctl -q is-active "$UNIT_NAME.service")
-kill %%
+wait %%
 assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
 
 systemctl daemon-reload
@@ -122,7 +122,7 @@ wait_for_stop
 socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
 timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
 (! systemctl -q is-active "$UNIT_NAME.service")
-kill %%
+wait %%
 
 rm "/tmp/$UNIT_NAME/flag"
 timeout 30 bash -c "while systemctl -q is-active '$UNIT_NAME-conflict2.service'; do sleep .2; done"
@@ -138,7 +138,7 @@ assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
 socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
 timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
 (! systemctl -q is-active "$UNIT_NAME.service")
-kill %%
+wait %%
 
 echo "DeferTriggerMaxSec=20s" >>/run/systemd/system/"$UNIT_NAME.socket"
 systemctl daemon-reload