mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
Merge pull request #24090 from yuwata/test-login
test: hopefully fixes race in TEST-35-LOGIN
This commit is contained in:
commit
11d4ea2dbd
@ -221,7 +221,7 @@ test_shutdown() {
|
||||
cleanup_session() (
|
||||
set +ex
|
||||
|
||||
local uid
|
||||
local uid s
|
||||
|
||||
uid=$(id -u logind-test-user)
|
||||
|
||||
@ -229,6 +229,17 @@ cleanup_session() (
|
||||
|
||||
systemctl stop getty@tty2.service
|
||||
|
||||
for s in $(loginctl --no-legend list-sessions | awk '$3 == "logind-test-user" { print $1 }'); do
|
||||
echo "INFO: stopping session $s"
|
||||
loginctl terminate-session "$s"
|
||||
done
|
||||
|
||||
loginctl terminate-user logind-test-user
|
||||
|
||||
if ! timeout 30 bash -c "while loginctl --no-legend | grep -q logind-test-user; do sleep 1; done"; then
|
||||
echo "WARNING: session for logind-test-user still active, ignoring."
|
||||
fi
|
||||
|
||||
pkill -u "$uid"
|
||||
sleep 1
|
||||
pkill -KILL -u "$uid"
|
||||
@ -312,6 +323,7 @@ create_session() {
|
||||
Type=simple
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --autologin logind-test-user --noclear %I $TERM
|
||||
Restart=no
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
|
||||
@ -395,11 +407,11 @@ EOF
|
||||
teardown_lock_idle_action() (
|
||||
set +eux
|
||||
|
||||
cleanup_session
|
||||
|
||||
rm -f /run/systemd/logind.conf.d/idle-action-lock.conf
|
||||
systemctl restart systemd-logind.service
|
||||
|
||||
cleanup_session
|
||||
|
||||
return 0
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user