mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
test: add a simple test for list-users
This commit is contained in:
parent
c5912adc85
commit
6083f7a604
@ -225,6 +225,8 @@ cleanup_session() (
|
||||
rm -rf /run/systemd/system/getty@tty2.service.d
|
||||
systemctl daemon-reload
|
||||
|
||||
loginctl disable-linger logind-test-user
|
||||
|
||||
pkill -u "$(id -u logind-test-user)"
|
||||
sleep 1
|
||||
pkill -KILL -u "$(id -u logind-test-user)"
|
||||
@ -445,6 +447,23 @@ test_session_properties() {
|
||||
/usr/lib/systemd/tests/manual/test-session-properties "/org/freedesktop/login1/session/_3${s?}"
|
||||
}
|
||||
|
||||
test_list_users() {
|
||||
if [[ ! -c /dev/tty2 ]]; then
|
||||
echo "/dev/tty2 does not exist, skipping test ${FUNCNAME[0]}."
|
||||
return
|
||||
fi
|
||||
|
||||
trap cleanup_session RETURN
|
||||
create_session
|
||||
|
||||
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
|
||||
|
||||
loginctl enable-linger logind-test-user
|
||||
|
||||
assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $3 }')" yes
|
||||
}
|
||||
|
||||
: >/failed
|
||||
|
||||
setup_test_user
|
||||
@ -456,6 +475,7 @@ test_shutdown
|
||||
test_session
|
||||
test_lock_idle_action
|
||||
test_session_properties
|
||||
test_list_users
|
||||
|
||||
touch /testok
|
||||
rm /failed
|
||||
|
Loading…
Reference in New Issue
Block a user