From: Luca Boccassi Date: Mon, 29 Jun 2026 10:56:30 +0000 (+0100) Subject: test: make TEST-07-PID1.issue-14566 more robust X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e9482b9ebb05d4f23ba1a7faa3b89dd8db84c270;p=thirdparty%2Fsystemd.git test: make TEST-07-PID1.issue-14566 more robust The test slept a fixed 4s after starting the service, then read the child PID from /leakedtestpid. On a loaded host the executor had not exec'd the script yet: [ 1571.079978] TEST-07-PID1.sh[17329]: + systemctl start issue14566-repro [ 1571.079978] TEST-07-PID1.sh[17329]: + sleep 4 [ 1571.079978] TEST-07-PID1.sh[17329]: + systemctl status issue14566-repro [ 1562.350438] systemd[1]: init.scope: Child 17296 belongs to init.scope. [ 1571.081084] TEST-07-PID1.sh[17333]: ● issue14566-repro.service - Issue 14566 Repro [ 1571.081084] TEST-07-PID1.sh[17333]: Loaded: loaded (/usr/lib/systemd/tests/testdata/TEST-07-PID1.units/issue14566-repro.service; static) [ 1571.081084] TEST-07-PID1.sh[17333]: Drop-In: /usr/lib/systemd/system/service.d [ 1571.081084] TEST-07-PID1.sh[17333]: └─10-timeout-abort.conf [ 1571.081084] TEST-07-PID1.sh[17333]: Active: active (running) since Mon 2026-06-29 06:19:07 UTC; 4s ago [ 1571.081084] TEST-07-PID1.sh[17333]: Invocation: b3356aa5fff24eee85e302250ecb06b1 [ 1571.081084] TEST-07-PID1.sh[17333]: Main PID: 17331 (9) [ 1571.081084] TEST-07-PID1.sh[17333]: Tasks: 1 (limit: 4468) [ 1571.081084] TEST-07-PID1.sh[17333]: Memory: 768K (peak: 768K) [ 1571.081084] TEST-07-PID1.sh[17333]: CPU: 1ms [ 1571.081084] TEST-07-PID1.sh[17333]: CGroup: /system.slice/issue14566-repro.service [ 1571.081084] TEST-07-PID1.sh[17333]: └─17331 systemd-executor --deserialize 66 --log-level debug,console:info --log-target journal [ 1562.350492] systemd[1]: Child 17297 ((sd-close)) died (code=exited, status=0/SUCCESS) [ 1571.082379] TEST-07-PID1.sh[17334]: ++ cat /leakedtestpid [ 1571.082379] TEST-07-PID1.sh[17334]: cat: /leakedtestpid: No such file or directory Make the service Type=notify and notify readiness after writing the PID file, and wait for the service to go inactive in a timeout loop instead of fixed sleeps. Follow-up for c1566ef0d22ed786b9ecf4c476e53b8a91e67578 --- diff --git a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service index 4fd77160813..e285277188d 100644 --- a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service +++ b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service @@ -3,6 +3,8 @@ Description=Issue 14566 Repro [Service] +Type=notify +NotifyAccess=all ExecStart=/usr/lib/systemd/tests/testdata/TEST-07-PID1.units/%N.sh ExecStopPost=true KillMode=mixed diff --git a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh index 74fa7605e7a..ec0268e8916 100755 --- a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh +++ b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh @@ -3,4 +3,5 @@ sleep infinity & echo $! >/leakedtestpid +systemd-notify --ready wait $! diff --git a/test/units/TEST-07-PID1.issue-14566.sh b/test/units/TEST-07-PID1.issue-14566.sh index ecc18e411bd..05fade9c4c4 100755 --- a/test/units/TEST-07-PID1.issue-14566.sh +++ b/test/units/TEST-07-PID1.issue-14566.sh @@ -14,13 +14,12 @@ if [[ -v ASAN_OPTIONS ]]; then fi systemctl start issue14566-repro -sleep 4 systemctl status issue14566-repro leaked_pid=$(cat /leakedtestpid) systemctl stop issue14566-repro -sleep 4 +timeout 30 bash -c 'while systemctl is-active issue14566-repro; do sleep .5; done' # Leaked PID will still be around if we're buggy. # I personally prefer to see 42.