X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Ftest-login.c;h=159ff3efc5b3f07fa1bacfaad7a2a5055d51ffdd;hb=31f92a7df427593532d221dd715e2e0a5b6f3a96;hp=4596721060c60d1c3e082f5d01036b4d0eb7d399;hpb=50b1678aaba9d3c2be5115db34a822911d791b8c;p=elogind.git diff --git a/src/login/test-login.c b/src/login/test-login.c index 459672106..159ff3efc 100644 --- a/src/login/test-login.c +++ b/src/login/test-login.c @@ -6,16 +6,16 @@ Copyright 2011 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) { int r, k; uid_t u, u2; - char *seat; + char *seat, *type, *class, *display; char *session; char *state; char *session2; @@ -71,10 +71,27 @@ int main(int argc, char* argv[]) { assert_se(r >= 0); printf("active = %s\n", yes_no(r)); + r = sd_session_get_state(session, &state); + assert_se(r >= 0); + printf("state = %s\n", state); + free(state); + assert_se(sd_session_get_uid(session, &u) >= 0); printf("uid = %lu\n", (unsigned long) u); assert_se(u == u2); + assert_se(sd_session_get_type(session, &type) >= 0); + printf("type = %s\n", type); + free(type); + + assert_se(sd_session_get_class(session, &class) >= 0); + printf("class = %s\n", class); + free(class); + + assert_se(sd_session_get_display(session, &display) >= 0); + printf("display = %s\n", display); + free(display); + assert_se(sd_session_get_seat(session, &seat) >= 0); printf("seat = %s\n", seat); @@ -82,6 +99,14 @@ int main(int argc, char* argv[]) { assert_se(r >= 0); printf("can do multi session = %s\n", yes_no(r)); + r = sd_seat_can_tty(seat); + assert_se(r >= 0); + printf("can do tty = %s\n", yes_no(r)); + + r = sd_seat_can_graphical(seat); + assert_se(r >= 0); + printf("can do graphical = %s\n", yes_no(r)); + assert_se(sd_uid_get_state(u, &state) >= 0); printf("state = %s\n", state); @@ -125,13 +150,13 @@ int main(int argc, char* argv[]) { printf("seats = %s\n", t); free(t); + assert_se(sd_get_seats(NULL) == r); + r = sd_seat_get_active(NULL, &t, NULL); assert_se(r >= 0); printf("active session on current seat = %s\n", t); free(t); - assert_se(sd_get_seats(NULL) == r); - r = sd_get_sessions(&sessions); assert_se(r >= 0); assert_se(r == (int) strv_length(sessions));