summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-05-17 01:41:13 +0900
committerGitHub <noreply@github.com>2023-05-17 01:41:13 +0900
commit871a41f0ef60cc33528dc249cb1358d0f3c1a3bc (patch)
tree2d41bfd1a065c9f63b26da74bd879e17ea6deccc /test
parent8c7dd49ad1c936bfff8f976f61cfcb7037c48103 (diff)
parent306ff2e29798f571fba573577abaeb812f7e3166 (diff)
downloadsystemd-871a41f0ef60cc33528dc249cb1358d0f3c1a3bc.tar.gz
Merge pull request #27606 from YHNdnzj/loginctl-list-show-state
loginctl: list-{users,sessions}: add a column for showing state
Diffstat (limited to 'test')
-rwxr-xr-xtest/units/testsuite-35.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh
index bfd11658d6..76127102c4 100755
--- a/test/units/testsuite-35.sh
+++ b/test/units/testsuite-35.sh
@@ -520,7 +520,7 @@ test_session_properties() {
/usr/lib/systemd/tests/unit-tests/manual/test-session-properties "/org/freedesktop/login1/session/_3${s?}"
}
-test_list_users() {
+test_list_users_sessions() {
if [[ ! -c /dev/tty2 ]]; then
echo "/dev/tty2 does not exist, skipping test ${FUNCNAME[0]}."
return
@@ -531,12 +531,22 @@ test_list_users() {
assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $1 }')" "$(id -ru logind-test-user)"
assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $3 }')" no
+ assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $4 }')" active
+ assert_eq "$(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $6 }')" active
loginctl enable-linger logind-test-user
-
assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $3 }')" yes
-}
+ for s in $(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $1 }'); do
+ loginctl terminate-session "$s"
+ done
+ 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."
+ return
+ fi
+
+ assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $4 }')" lingering
+}
teardown_stop_idle_session() (
set +eux
@@ -637,7 +647,7 @@ test_sanity_check
test_session
test_lock_idle_action
test_session_properties
-test_list_users
+test_list_users_sessions
test_stop_idle_session
test_ambient_caps