From: Yu Watanabe Date: Fri, 22 Jul 2022 06:45:24 +0000 (+0900) Subject: test: wait for user service or slice to be finished X-Git-Tag: v252-rc1~600 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8015e2587045f8a58a15d4551c76521a4a3ff50c;p=thirdparty%2Fsystemd.git test: wait for user service or slice to be finished Hopefully fixes #24040. --- diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh index d2cd36005af..6e556519b47 100755 --- a/test/units/testsuite-35.sh +++ b/test/units/testsuite-35.sh @@ -221,15 +221,32 @@ test_shutdown() { cleanup_session() ( set +ex - systemctl stop getty@tty2.service - rm -rf /run/systemd/system/getty@tty2.service.d - systemctl daemon-reload + local uid + + uid=$(id -u logind-test-user) loginctl disable-linger logind-test-user - pkill -u "$(id -u logind-test-user)" + systemctl stop getty@tty2.service + + pkill -u "$uid" sleep 1 - pkill -KILL -u "$(id -u logind-test-user)" + pkill -KILL -u "$uid" + + if ! timeout 30 bash -c "while systemctl is-active --quiet user@${uid}.service; do sleep 1; done"; then + echo "WARNING: user@${uid}.service is still active, ignoring." + fi + + if ! timeout 30 bash -c "while systemctl is-active --quiet user-runtime-dir@${uid}.service; do sleep 1; done"; then + echo "WARNING: user-runtime-dir@${uid}.service is still active, ignoring." + fi + + if ! timeout 30 bash -c "while systemctl is-active --quiet user-${uid}.slice; do sleep 1; done"; then + echo "WARNING: user-${uid}.slice is still active, ignoring." + fi + + rm -rf /run/systemd/system/getty@tty2.service.d + systemctl daemon-reload return 0 )