summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-08-09 09:47:33 +0200
committerGitHub <noreply@github.com>2017-08-09 09:47:33 +0200
commitc086160f7719f483f722b8496e1422b05ba6622b (patch)
tree373211df204530b924e3e289ffe319e367a84ceb
parentAdd rpm macro %_userpresetdir (#6571) (diff)
parentsd-login: test - fix failure when run from non-graphical seat (diff)
downloadsystemd-c086160f7719f483f722b8496e1422b05ba6622b.tar.xz
systemd-c086160f7719f483f722b8496e1422b05ba6622b.zip
Merge pull request #6568 from sourcejedi/test
sd-login: test - fix failure when run from non-graphical seat
-rw-r--r--src/libsystemd/sd-login/test-login.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libsystemd/sd-login/test-login.c b/src/libsystemd/sd-login/test-login.c
index b618b79b28..02a73f9189 100644
--- a/src/libsystemd/sd-login/test-login.c
+++ b/src/libsystemd/sd-login/test-login.c
@@ -55,7 +55,7 @@ static void test_login(void) {
*type = NULL, *class = NULL, *state = NULL, *state2 = NULL,
*seat = NULL, *session = NULL,
*unit = NULL, *user_unit = NULL, *slice = NULL;
- int r, k;
+ int r;
uid_t u, u2;
char *t, **seats, **sessions;
@@ -157,7 +157,7 @@ static void test_login(void) {
if (r >= 0) {
assert_se(seat);
- log_info("sd_session_get_display(\"%s\") → \"%s\"", session, seat);
+ log_info("sd_session_get_seat(\"%s\") → \"%s\"", session, seat);
r = sd_seat_can_multi_session(seat);
assert_se(r >= 0);
@@ -171,7 +171,7 @@ static void test_login(void) {
assert_se(r >= 0);
log_info("sd_session_can_graphical(\"%s\") → %s", seat, yes_no(r));
} else {
- log_info_errno(r, "sd_session_get_display(\"%s\"): %m", session);
+ log_info_errno(r, "sd_session_get_seat(\"%s\"): %m", session);
assert_se(r == -ENODATA);
}
@@ -186,13 +186,14 @@ static void test_login(void) {
assert_se(sd_uid_is_on_seat(u, 0, seat) > 0);
- k = sd_uid_is_on_seat(u, 1, seat);
- assert_se(k >= 0);
- assert_se(!!k == !!r);
-
- assert_se(sd_seat_get_active(seat, &session2, &u2) >= 0);
+ r = sd_seat_get_active(seat, &session2, &u2);
+ assert_se(r >= 0);
log_info("sd_seat_get_active(\"%s\", …) → \"%s\", "UID_FMT, seat, session2, u2);
+ r = sd_uid_is_on_seat(u, 1, seat);
+ assert_se(r >= 0);
+ assert_se(!!r == streq(session, session2));
+
r = sd_seat_get_sessions(seat, &sessions, &uids, &n);
assert_se(r >= 0);
assert_se(r == (int) strv_length(sessions));