summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJesús González <jgonzalez@gdr-sistemas.com>2015-02-13 11:47:09 +0100
committerJesús González <jgonzalez@gdr-sistemas.com>2015-02-13 11:47:09 +0100
commit27a369121fa4fc2146dbc5653139b06ff6301ab2 (patch)
treec054e9bb409215f1b2f7dfdbc8a3a8cceda74dec /tests
parent850aad05441d414e9bdc9cd80cd8e8bca8bede2b (diff)
parent7b6a695d2b5eb47c41d468cbceca256833f0a790 (diff)
downloadlightdm-27a369121fa4fc2146dbc5653139b06ff6301ab2.tar.gz
Merged changes from parent branch.
Fixed "lock-seat-after-vt-switch" test to expect X server reuse by the new greeter instead of X server reinitiation.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/scripts/lock-seat-after-vt-switch.conf84
-rw-r--r--tests/scripts/vnc-guest.conf66
-rw-r--r--tests/scripts/xdmcp-server-guest.conf62
-rw-r--r--tests/src/test-runner.c48
-rwxr-xr-xtests/test-lock-seat-after-vt-switch2
-rwxr-xr-xtests/test-vnc-guest2
-rwxr-xr-xtests/test-xdmcp-server-guest2
8 files changed, 268 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2dc06ad7..ec291966 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -129,6 +129,7 @@ TESTS = \
test-upstart-login \
test-dbus \
test-lock-seat \
+ test-lock-seat-after-vt-switch \
test-lock-seat-twice \
test-lock-seat-resettable \
test-lock-seat-return-session \
@@ -410,6 +411,7 @@ EXTRA_DIST = \
scripts/language-env.conf \
scripts/language-no-accounts-service.conf \
scripts/lock-seat.conf \
+ scripts/lock-seat-after-vt-switch.conf
scripts/lock-seat-console-kit.conf \
scripts/lock-seat-resettable.conf \
scripts/lock-seat-return-session.conf \
diff --git a/tests/scripts/lock-seat-after-vt-switch.conf b/tests/scripts/lock-seat-after-vt-switch.conf
new file mode 100644
index 00000000..35d7cac8
--- /dev/null
+++ b/tests/scripts/lock-seat-after-vt-switch.conf
@@ -0,0 +1,84 @@
+#
+# Check that a seat is locked properly when it has been unlocked by switching
+# back to the user session and using the screensaver to unlock it.
+#
+
+[SeatDefaults]
+autologin-user=have-password1
+user-session=default
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Session starts
+#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Lock the seat
+#?*SESSION-X-0 LOCK-SEAT
+#?SESSION-X-0 LOCK-SEAT
+
+# New X server starts
+#?XSERVER-1 START VT=8 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-1 INDICATE-READY
+#?XSERVER-1 INDICATE-READY
+#?XSERVER-1 ACCEPT-CONNECT
+
+# Session is locked
+#?LOGIN1 LOCK-SESSION SESSION=c0
+
+# Greeter starts
+#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_CLASS=greeter
+#?XSERVER-1 ACCEPT-CONNECT
+#?GREETER-X-1 CONNECT-XSERVER
+#?GREETER-X-1 CONNECT-TO-DAEMON
+#?GREETER-X-1 CONNECTED-TO-DAEMON
+#?GREETER-X-1 LOCK-HINT
+
+# Session is switched to greeter
+#?LOGIN1 ACTIVATE-SESSION SESSION=c1
+#?VT ACTIVATE VT=8
+
+# External program switches back to the first session
+#?*UPDATE-SEAT ID=seat0 ACTIVE-SESSION=c0
+
+# Session is unlocked using the screensaver
+#?*UNLOCK-SESSION SESSION=c0
+#?RUNNER UNLOCK-SESSION SESSION=c0
+
+# Lock the seat again
+#?*SESSION-X-0 LOCK-SEAT
+#?SESSION-X-0 LOCK-SEAT
+#?LOGIN1 LOCK-SESSION SESSION=c0
+
+# Old greeter is stopped
+#?GREETER-X-1 TERMINATE SIGNAL=15
+
+# A new greeter is started and activated on the same X server
+#?LOGIN1 ACTIVATE-SESSION SESSION=c2
+#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_CLASS=greeter
+#?XSERVER-1 ACCEPT-CONNECT
+#?GREETER-X-1 CONNECT-XSERVER
+#?GREETER-X-1 CONNECT-TO-DAEMON
+#?GREETER-X-1 CONNECTED-TO-DAEMON
+#?GREETER-X-1 LOCK-HINT
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?GREETER-X-1 TERMINATE SIGNAL=15
+#?XSERVER-1 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/vnc-guest.conf b/tests/scripts/vnc-guest.conf
new file mode 100644
index 00000000..820b2324
--- /dev/null
+++ b/tests/scripts/vnc-guest.conf
@@ -0,0 +1,66 @@
+#
+# Check can log into a guest account via VNC
+#
+
+[LightDM]
+start-default-seat=false
+
+[VNCServer]
+enabled=true
+
+[SeatDefaults]
+user-session=default
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+#?*WAIT
+
+# Start a VNC client
+#?*START-VNC-CLIENT
+#?VNC-CLIENT START
+#?VNC-CLIENT CONNECT
+
+# Xvnc server starts
+#?XSERVER-0 START GEOMETRY=1024x768 DEPTH=8 OPTION=FALSE
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Negotiate with Xvnc
+#?*XSERVER-0 START-VNC
+#?VNC-CLIENT CONNECTED VERSION="RFB 003.007"
+
+# VNC client connects to X server
+#?XSERVER-0 VNC-CLIENT-CONNECT VERSION="RFB 003.003"
+
+# Greeter starts and connects to remote X server
+#?GREETER-X-0 START XDG_SESSION_CLASS=greeter
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Log in
+#?*GREETER-X-0 AUTHENTICATE-GUEST
+#?GREETER-X-0 AUTHENTICATION-COMPLETE AUTHENTICATED=TRUE
+#?*GREETER-X-0 START-SESSION
+#?GREETER-X-0 TERMINATE SIGNAL=15
+
+# Guest account created
+#?GUEST-ACCOUNT ADD USERNAME=guest-.*
+
+# Guest session starts
+#?SESSION-X-0 START XDG_GREETER_DATA_DIR=.*/guest-.* XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=guest-.*
+#?LOGIN1 ACTIVATE-SESSION SESSION=c1
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Clean up
+#?*STOP-DAEMON
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?GUEST-ACCOUNT REMOVE USERNAME=guest-.*
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/xdmcp-server-guest.conf b/tests/scripts/xdmcp-server-guest.conf
new file mode 100644
index 00000000..9553a49d
--- /dev/null
+++ b/tests/scripts/xdmcp-server-guest.conf
@@ -0,0 +1,62 @@
+#
+# Check can log into a guest account via XDMCP
+#
+
+[LightDM]
+start-default-seat=false
+
+[XDMCPServer]
+enabled=true
+
+[SeatDefaults]
+user-session=default
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+#?*WAIT
+
+# Start a remote X server to log in with XDMCP
+#?*START-XSERVER ARGS=":98 -query 127.0.0.1 -nolisten unix"
+#?XSERVER-98 START
+
+# Start sending XDMCP queries
+#?*XSERVER-98 START-XDMCP
+#?XSERVER-98 SEND-QUERY
+
+# Negotiate with daemon
+#?XSERVER-98 GOT-WILLING AUTHENTICATION-NAME="" HOSTNAME="" STATUS=""
+#?XSERVER-98 SEND-REQUEST DISPLAY-NUMBER=98 AUTHORIZATION-NAME="MIT-MAGIC-COOKIE-1" MFID="TEST XSERVER"
+#?XSERVER-98 GOT-ACCEPT SESSION-ID=[0-9]* AUTHENTICATION-NAME="" AUTHORIZATION-NAME="MIT-MAGIC-COOKIE-1"
+#?XSERVER-98 SEND-MANAGE SESSION-ID=[0-9]* DISPLAY-NUMBER=98 DISPLAY-CLASS="DISPLAY CLASS"
+
+# LightDM connects to X server
+#?XSERVER-98 ACCEPT-CONNECT
+
+# Greeter starts and connects to remote X server
+#?GREETER-X-127.0.0.1:98 START XDG_SESSION_CLASS=greeter
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+#?XSERVER-98 ACCEPT-CONNECT
+#?GREETER-X-127.0.0.1:98 CONNECT-XSERVER
+#?GREETER-X-127.0.0.1:98 CONNECT-TO-DAEMON
+#?GREETER-X-127.0.0.1:98 CONNECTED-TO-DAEMON
+
+# Log in
+#?*GREETER-X-127.0.0.1:98 AUTHENTICATE-GUEST
+#?GREETER-X-127.0.0.1:98 AUTHENTICATION-COMPLETE AUTHENTICATED=TRUE
+#?*GREETER-X-127.0.0.1:98 START-SESSION
+#?GREETER-X-127.0.0.1:98 TERMINATE SIGNAL=15
+
+# Guest account created
+#?GUEST-ACCOUNT ADD USERNAME=guest-.*
+
+# Guest session starts
+#?SESSION-X-127.0.0.1:98 START XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=guest-.*
+#?LOGIN1 ACTIVATE-SESSION SESSION=c1
+#?XSERVER-98 ACCEPT-CONNECT
+#?SESSION-X-127.0.0.1:98 CONNECT-XSERVER
+
+# Clean up
+#?*STOP-DAEMON
+#?SESSION-X-127.0.0.1:98 TERMINATE SIGNAL=15
+#?GUEST-ACCOUNT REMOVE USERNAME=guest-.*
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c
index abad4865..e66dead8 100644
--- a/tests/src/test-runner.c
+++ b/tests/src/test-runner.c
@@ -110,6 +110,7 @@ typedef struct
gchar *path;
gboolean can_graphical;
gboolean can_multi_session;
+ gchar *active_session;
} Login1Seat;
static GList *login1_seats = NULL;
@@ -142,6 +143,7 @@ static void check_status (const gchar *status);
static AccountsUser *get_accounts_user_by_uid (guint uid);
static AccountsUser *get_accounts_user_by_name (const gchar *username);
static void accounts_user_set_hidden (AccountsUser *user, gboolean hidden, gboolean emit_signal);
+static Login1Session *find_login1_session (const gchar *id);
static gboolean
kill_timeout_cb (gpointer data)
@@ -567,6 +569,13 @@ handle_command (const gchar *command)
seat->can_multi_session = strcmp (v, "TRUE") == 0;
g_variant_builder_add (&invalidated_properties, "s", "CanMultiSession");
}
+ v = g_hash_table_lookup (params, "ACTIVE-SESSION");
+ if (v)
+ {
+ g_free (seat->active_session);
+ seat->active_session = g_strdup (v);
+ g_variant_builder_add (&invalidated_properties, "s", "ActiveSession");
+ }
g_dbus_connection_emit_signal (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
NULL,
@@ -917,6 +926,26 @@ handle_command (const gchar *command)
check_status (status_text);
g_free (status_text);
}
+ else if (strcmp (name, "UNLOCK-SESSION") == 0)
+ {
+ gchar *status_text, *id;
+ Login1Session *session;
+
+ id = g_hash_table_lookup (params, "SESSION");
+ session = find_login1_session (id);
+ if (session)
+ {
+ if (!session->locked)
+ g_warning ("Session %s is not locked", id);
+ session->locked = FALSE;
+ }
+ else
+ g_warning ("Unknown session %s", id);
+
+ status_text = g_strdup_printf ("RUNNER UNLOCK-SESSION SESSION=%s", id);
+ check_status (status_text);
+ g_free (status_text);
+ }
/* Forward to external processes */
else if (g_str_has_prefix (name, "SESSION-") ||
g_str_has_prefix (name, "GREETER-") ||
@@ -1481,6 +1510,22 @@ handle_login1_seat_get_property (GDBusConnection *connection,
return g_variant_new_boolean (seat->can_multi_session);
else if (strcmp (property_name, "Id") == 0)
return g_variant_new_string (seat->id);
+ else if (strcmp (property_name, "ActiveSession") == 0)
+ {
+ if (seat->active_session)
+ {
+ gchar *path;
+ GVariant *ret;
+
+ path = g_strdup_printf ("/org/freedesktop/login1/session/%s", seat->active_session);
+ ret = g_variant_new ("(so)", seat->active_session, path);
+ g_free (path);
+
+ return ret;
+ }
+ else
+ return NULL;
+ }
else
return NULL;
}
@@ -1497,6 +1542,7 @@ add_login1_seat (GDBusConnection *connection, const gchar *id, gboolean emit_sig
" <interface name='org.freedesktop.login1.Seat'>"
" <property name='CanGraphical' type='b' access='read'/>"
" <property name='CanMultiSession' type='b' access='read'/>"
+ " <property name='ActiveSession' type='(so)' access='read'/>"
" <property name='Id' type='s' access='read'/>"
" </interface>"
"</node>";
@@ -1512,6 +1558,7 @@ add_login1_seat (GDBusConnection *connection, const gchar *id, gboolean emit_sig
seat->path = g_strdup_printf ("/org/freedesktop/login1/seat/%s", seat->id);
seat->can_graphical = TRUE;
seat->can_multi_session = TRUE;
+ seat->active_session = NULL;
login1_seat_info = g_dbus_node_info_new_for_xml (login1_seat_interface, &error);
if (error)
@@ -1589,6 +1636,7 @@ remove_login1_seat (GDBusConnection *connection, const gchar *id)
login1_seats = g_list_remove (login1_seats, seat);
g_free (seat->id);
g_free (seat->path);
+ g_free (seat->active_session);
g_free (seat);
}
diff --git a/tests/test-lock-seat-after-vt-switch b/tests/test-lock-seat-after-vt-switch
new file mode 100755
index 00000000..1689fe3d
--- /dev/null
+++ b/tests/test-lock-seat-after-vt-switch
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner lock-seat-after-vt-switch test-gobject-greeter
diff --git a/tests/test-vnc-guest b/tests/test-vnc-guest
new file mode 100755
index 00000000..5806cbd4
--- /dev/null
+++ b/tests/test-vnc-guest
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner vnc-guest test-gobject-greeter
diff --git a/tests/test-xdmcp-server-guest b/tests/test-xdmcp-server-guest
new file mode 100755
index 00000000..967098ef
--- /dev/null
+++ b/tests/test-xdmcp-server-guest
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner xdmcp-server-guest test-gobject-greeter