TEST-23-UNIT-FILE: do not wait indefinitely but set a reasonable timeout

Otherwise, the test does not finish until the global timeout is reached.

This is for making the test fail earlier when something spurious happens:
```
[FAILED] Failed to start TEST-23-UNIT-FILE-short-lived.service - Shortlived Unit.
TEST-23-UNIT-FILE.sh[776]: + '[' 0 -eq 0 ']'
TEST-23-UNIT-FILE.sh[776]: + sleep .5
(snip)
58/98 systemd:integration-tests / TEST-23-UNIT-FILE  TIMEOUT  1800.52s  killed by signal 9 SIGKILL
```
This commit is contained in:
Yu Watanabe
2025-07-28 22:57:07 +09:00
committed by Luca Boccassi
parent 257e941cc1
commit e43efecc8f

View File

@@ -24,9 +24,13 @@ trap -p SIGUSR1
systemctl start TEST-23-UNIT-FILE-success.service
while [ "$sigusr1" -eq 0 ] ; do
for _ in {1..120}; do
sleep .5
if [[ "$sigusr1" == 1 ]]; then
break
fi
done
[[ "$sigusr1" == 1 ]]
systemctl stop TEST-23-UNIT-FILE-uphold.service
@@ -46,17 +50,13 @@ rm -f /tmp/TEST-23-UNIT-FILE-retry-fail
systemctl start TEST-23-UNIT-FILE-retry-uphold.service
systemctl is-active TEST-23-UNIT-FILE-upheldby-install.service
until systemctl is-failed TEST-23-UNIT-FILE-retry-fail.service ; do
sleep .5
done
timeout 60 bash -c 'until systemctl is-failed TEST-23-UNIT-FILE-retry-fail.service; do sleep .5; done'
(! systemctl is-active TEST-23-UNIT-FILE-retry-upheld.service)
touch /tmp/TEST-23-UNIT-FILE-retry-fail
until systemctl is-active TEST-23-UNIT-FILE-retry-upheld.service ; do
sleep .5
done
timeout 60 bash -c 'until systemctl is-active TEST-23-UNIT-FILE-retry-upheld.service; do sleep .5; done'
systemctl stop TEST-23-UNIT-FILE-retry-uphold.service TEST-23-UNIT-FILE-retry-fail.service TEST-23-UNIT-FILE-retry-upheld.service
@@ -74,10 +74,13 @@ trap sigusr2=1 SIGUSR2
systemctl start TEST-23-UNIT-FILE-prop-stop-one.service
while [ "$sigusr2" -eq 0 ] ; do
for _ in {1..120}; do
sleep .5
if [[ "$sigusr2" == 1 ]]; then
break
fi
done
[[ "$sigusr2" == 1 ]]
# Idea is this:
# 1. we start TEST-23-UNIT-FILE-binds-to.service
@@ -92,8 +95,12 @@ trap sigrtmin1=1 SIGRTMIN+1
systemctl start TEST-23-UNIT-FILE-binds-to.service
while [ "$sigrtmin1" -eq 0 ] ; do
for _ in {1..120}; do
sleep .5
if [[ "$sigrtmin1" == 1 ]]; then
break
fi
done
[[ "$sigrtmin1" == 1 ]]
systemd-analyze log-level info