mirror of
https://github.com/systemd/systemd.git
synced 2025-09-22 13:45:07 +03:00
test: add a simple test for list-users
This commit is contained in:
@@ -225,6 +225,8 @@ cleanup_session() (
|
|||||||
rm -rf /run/systemd/system/getty@tty2.service.d
|
rm -rf /run/systemd/system/getty@tty2.service.d
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
loginctl disable-linger logind-test-user
|
||||||
|
|
||||||
pkill -u "$(id -u logind-test-user)"
|
pkill -u "$(id -u logind-test-user)"
|
||||||
sleep 1
|
sleep 1
|
||||||
pkill -KILL -u "$(id -u logind-test-user)"
|
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?}"
|
/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
|
: >/failed
|
||||||
|
|
||||||
setup_test_user
|
setup_test_user
|
||||||
@@ -456,6 +475,7 @@ test_shutdown
|
|||||||
test_session
|
test_session
|
||||||
test_lock_idle_action
|
test_lock_idle_action
|
||||||
test_session_properties
|
test_session_properties
|
||||||
|
test_list_users
|
||||||
|
|
||||||
touch /testok
|
touch /testok
|
||||||
rm /failed
|
rm /failed
|
||||||
|
Reference in New Issue
Block a user