From: Frantisek Sumsal Date: Wed, 5 Nov 2025 14:47:46 +0000 (+0100) Subject: test: wait for the backgrounded socat job X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3849b0701a7713c147400f205e7ddb3e3f93ad26;p=thirdparty%2Fsystemd.git test: wait for the backgrounded socat job 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 --- diff --git a/test/units/TEST-07-PID1.socket-defer.sh b/test/units/TEST-07-PID1.socket-defer.sh index ec04f4f7e44..efbb7e14725 100755 --- a/test/units/TEST-07-PID1.socket-defer.sh +++ b/test/units/TEST-07-PID1.socket-defer.sh @@ -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