mirror of
https://github.com/systemd/systemd.git
synced 2025-03-22 06:50:18 +03:00
test: terminate session and user on cleanup
This commit is contained in:
parent
e0a12b9634
commit
fe9d58b25a
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user