X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Ftest-login.c;h=707cf2158902747d46f03f10b0bc4b6f9d4c0077;hp=7d6f08202d91821d2643adb618e2a7034e6e124a;hb=8c8c43515cee56dfc2298998a9e5958308c46f99;hpb=4bba9156da3e1df2cee24d10d7cd88c776ef4179 diff --git a/src/login/test-login.c b/src/login/test-login.c index 7d6f08202..707cf2158 100644 --- a/src/login/test-login.c +++ b/src/login/test-login.c @@ -6,30 +6,31 @@ 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 . ***/ #include #include -#include "sd-login.h" +#include + #include "util.h" #include "strv.h" 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; @@ -74,6 +75,18 @@ int main(int argc, char* argv[]) { 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); @@ -126,6 +139,11 @@ int main(int argc, char* argv[]) { 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); + r = sd_get_sessions(&sessions); assert_se(r >= 0); assert_se(r == (int) strv_length(sessions));