summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2013-08-08 22:10:19 +1200
committerRobert Ancell <robert.ancell@canonical.com>2013-08-08 22:10:19 +1200
commit0ed1ee2c79cf0f84c6a327d3198676a669f7a2a0 (patch)
tree90a53c865489fe866089fcd07deea7fd3ec5d230 /tests
parent11c8734efabd640d0cb27aaa34cecb228ab41cde (diff)
downloadlightdm-0ed1ee2c79cf0f84c6a327d3198676a669f7a2a0.tar.gz
Fix session locking broken in 1.7.5
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/scripts/lock-seat-console-kit.conf3
-rw-r--r--tests/scripts/lock-seat-return-session-console-kit.conf74
-rw-r--r--tests/scripts/lock-seat-return-session.conf6
-rw-r--r--tests/scripts/lock-seat.conf3
-rw-r--r--tests/scripts/lock-session-no-password.conf3
-rw-r--r--tests/scripts/lock-session-return-session.conf6
-rw-r--r--tests/scripts/lock-session.conf3
-rw-r--r--tests/scripts/switch-to-greeter-new-session-logout-new.conf3
-rw-r--r--tests/scripts/switch-to-greeter-new-session-logout-old.conf15
-rw-r--r--tests/scripts/switch-to-greeter-new-session.conf3
-rw-r--r--tests/scripts/switch-to-greeter-return-session-logout.conf6
-rw-r--r--tests/scripts/switch-to-greeter-return-session.conf6
-rw-r--r--tests/scripts/switch-to-greeter.conf3
-rw-r--r--tests/scripts/switch-to-guest.conf3
-rw-r--r--tests/scripts/switch-to-user-logout.conf3
-rw-r--r--tests/scripts/switch-to-user-no-password.conf3
-rw-r--r--tests/scripts/switch-to-user.conf3
-rw-r--r--tests/scripts/switch-to-users.conf6
-rw-r--r--tests/scripts/unity-switch.conf3
-rw-r--r--tests/src/test-runner.c24
-rwxr-xr-xtests/test-lock-seat-return-session-console-kit2
22 files changed, 175 insertions, 8 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4b7d4f55..54f633ad 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -107,6 +107,7 @@ TESTS = \
test-lock-session-no-password \
test-lock-session-return-session \
test-lock-seat-console-kit \
+ test-lock-seat-return-session-console-kit \
test-switch-to-greeter \
test-switch-to-greeter-new-session \
test-switch-to-greeter-new-session-logout-new \
@@ -324,6 +325,7 @@ EXTRA_DIST = \
scripts/lock-seat.conf \
scripts/lock-seat-console-kit.conf \
scripts/lock-seat-return-session.conf \
+ scripts/lock-seat-return-session-console-kit.conf \
scripts/lock-session.conf \
scripts/lock-session-no-password.conf \
scripts/lock-session-return-session.conf \
diff --git a/tests/scripts/lock-seat-console-kit.conf b/tests/scripts/lock-seat-console-kit.conf
index e49e5d6e..2abe49b4 100644
--- a/tests/scripts/lock-seat-console-kit.conf
+++ b/tests/scripts/lock-seat-console-kit.conf
@@ -36,6 +36,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?CONSOLE-KIT LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_COOKIE=ck-cookie-x:1
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/lock-seat-return-session-console-kit.conf b/tests/scripts/lock-seat-return-session-console-kit.conf
new file mode 100644
index 00000000..f7032cc5
--- /dev/null
+++ b/tests/scripts/lock-seat-return-session-console-kit.conf
@@ -0,0 +1,74 @@
+#
+# Check can lock a seat from D-Bus and can return to it when using ConsoleKit
+#
+
+[test-runner-config]
+disable-login1=true
+
+[SeatDefaults]
+autologin-user=have-password1
+user-session=default
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7
+
+# 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_SESSION_COOKIE=ck-cookie-x:0 USER=have-password1
+#?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
+
+# Daemon connects when X server is ready
+#?*XSERVER-1 INDICATE-READY
+#?XSERVER-1 INDICATE-READY
+#?XSERVER-1 ACCEPT-CONNECT
+
+# Session is locked
+#?CONSOLE-KIT LOCK-SESSION
+
+# Greeter starts
+#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_COOKIE=ck-cookie-x:1
+#?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
+
+# Switch to greeter
+#?VT ACTIVATE VT=8
+
+# Login as existing user
+#?*GREETER-X-1 AUTHENTICATE USERNAME=have-password1
+#?GREETER-X-1 SHOW-PROMPT TEXT="Password:"
+#?*GREETER-X-1 RESPOND TEXT="password"
+#?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
+#?*GREETER-X-1 START-SESSION
+
+# Old session is unlocked
+#?CONSOLE-KIT UNLOCK-SESSION
+
+# Return to session
+#?VT ACTIVATE VT=7
+
+# Greeter and X server stop
+#?GREETER-X-1 TERMINATE SIGNAL=15
+#?XSERVER-1 TERMINATE SIGNAL=15
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/lock-seat-return-session.conf b/tests/scripts/lock-seat-return-session.conf
index 4771cdde..9a6ad338 100644
--- a/tests/scripts/lock-seat-return-session.conf
+++ b/tests/scripts/lock-seat-return-session.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
@@ -51,6 +54,9 @@ user-session=default
#?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
#?*GREETER-X-1 START-SESSION
+# Old session is unlocked
+#?LOGIN1 UNLOCK-SESSION
+
# Return to session
#?VT ACTIVATE VT=7
diff --git a/tests/scripts/lock-seat.conf b/tests/scripts/lock-seat.conf
index ac4659ad..b0ea9883 100644
--- a/tests/scripts/lock-seat.conf
+++ b/tests/scripts/lock-seat.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/lock-session-no-password.conf b/tests/scripts/lock-session-no-password.conf
index e4398f66..4fad1abe 100644
--- a/tests/scripts/lock-session-no-password.conf
+++ b/tests/scripts/lock-session-no-password.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts with session user selected
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/lock-session-return-session.conf b/tests/scripts/lock-session-return-session.conf
index 75bf1ed6..4c17fe48 100644
--- a/tests/scripts/lock-session-return-session.conf
+++ b/tests/scripts/lock-session-return-session.conf
@@ -45,6 +45,9 @@ user-session=default
# Switch to greeter
#?VT ACTIVATE VT=8
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Login as existing user
#?*GREETER-X-1 AUTHENTICATE USERNAME=have-password1
#?GREETER-X-1 SHOW-PROMPT TEXT="Password:"
@@ -52,6 +55,9 @@ user-session=default
#?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
#?*GREETER-X-1 START-SESSION
+# Existing session is unlocked
+#?LOGIN1 UNLOCK-SESSION
+
# Return to session
#?VT ACTIVATE VT=7
diff --git a/tests/scripts/lock-session.conf b/tests/scripts/lock-session.conf
index 8f32265a..6a52cb06 100644
--- a/tests/scripts/lock-session.conf
+++ b/tests/scripts/lock-session.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts with session user selected
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/switch-to-greeter-new-session-logout-new.conf b/tests/scripts/switch-to-greeter-new-session-logout-new.conf
index 04c007d2..eb64e6c4 100644
--- a/tests/scripts/switch-to-greeter-new-session-logout-new.conf
+++ b/tests/scripts/switch-to-greeter-new-session-logout-new.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/switch-to-greeter-new-session-logout-old.conf b/tests/scripts/switch-to-greeter-new-session-logout-old.conf
index 0e595f75..965a2828 100644
--- a/tests/scripts/switch-to-greeter-new-session-logout-old.conf
+++ b/tests/scripts/switch-to-greeter-new-session-logout-old.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
@@ -60,6 +63,15 @@ user-session=default
#?*SWITCH-TO-USER USERNAME=have-password1
#?RUNNER SWITCH-TO-USER USERNAME=have-password1
+# Existing session is unlocked
+#?LOGIN1 UNLOCK-SESSION
+
+# Switch to greeter
+#?VT ACTIVATE VT=7
+
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Logout of old session
#?*SESSION-X-0 LOGOUT
#?XSERVER-0 TERMINATE SIGNAL=15
@@ -77,9 +89,6 @@ user-session=default
#?GREETER-X-0 CONNECT-TO-DAEMON
#?GREETER-X-0 CONNECTED-TO-DAEMON
-# Switch to greeter
-#?VT ACTIVATE VT=7
-
# Cleanup
#?*STOP-DAEMON
#?GREETER-X-0 TERMINATE SIGNAL=15
diff --git a/tests/scripts/switch-to-greeter-new-session.conf b/tests/scripts/switch-to-greeter-new-session.conf
index bcfa1e0b..1080954a 100644
--- a/tests/scripts/switch-to-greeter-new-session.conf
+++ b/tests/scripts/switch-to-greeter-new-session.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/switch-to-greeter-return-session-logout.conf b/tests/scripts/switch-to-greeter-return-session-logout.conf
index 7004a665..4102ec10 100644
--- a/tests/scripts/switch-to-greeter-return-session-logout.conf
+++ b/tests/scripts/switch-to-greeter-return-session-logout.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
@@ -50,6 +53,9 @@ user-session=default
#?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
#?*GREETER-X-1 START-SESSION
+# Session is unlocked
+#?LOGIN1 UNLOCK-SESSION
+
# Switch to session
#?VT ACTIVATE VT=7
diff --git a/tests/scripts/switch-to-greeter-return-session.conf b/tests/scripts/switch-to-greeter-return-session.conf
index d4a0828a..20ca573a 100644
--- a/tests/scripts/switch-to-greeter-return-session.conf
+++ b/tests/scripts/switch-to-greeter-return-session.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
@@ -50,6 +53,9 @@ user-session=default
#?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
#?*GREETER-X-1 START-SESSION
+# Session is unlocked
+#?LOGIN1 UNLOCK-SESSION
+
# Switch to session
#?VT ACTIVATE VT=7
diff --git a/tests/scripts/switch-to-greeter.conf b/tests/scripts/switch-to-greeter.conf
index 61079b1d..a6510cc6 100644
--- a/tests/scripts/switch-to-greeter.conf
+++ b/tests/scripts/switch-to-greeter.conf
@@ -33,6 +33,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/switch-to-guest.conf b/tests/scripts/switch-to-guest.conf
index 14469d6f..d8c2813b 100644
--- a/tests/scripts/switch-to-guest.conf
+++ b/tests/scripts/switch-to-guest.conf
@@ -37,6 +37,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Switch to session
#?VT ACTIVATE VT=8
diff --git a/tests/scripts/switch-to-user-logout.conf b/tests/scripts/switch-to-user-logout.conf
index d8ff178b..d6d82dcf 100644
--- a/tests/scripts/switch-to-user-logout.conf
+++ b/tests/scripts/switch-to-user-logout.conf
@@ -34,6 +34,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Switch to session
#?VT ACTIVATE VT=8
diff --git a/tests/scripts/switch-to-user-no-password.conf b/tests/scripts/switch-to-user-no-password.conf
index 5739b5ad..cfee1bf9 100644
--- a/tests/scripts/switch-to-user-no-password.conf
+++ b/tests/scripts/switch-to-user-no-password.conf
@@ -34,6 +34,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Switch to session
#?VT ACTIVATE VT=8
diff --git a/tests/scripts/switch-to-user.conf b/tests/scripts/switch-to-user.conf
index 86a2f83e..539111b3 100644
--- a/tests/scripts/switch-to-user.conf
+++ b/tests/scripts/switch-to-user.conf
@@ -34,6 +34,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/scripts/switch-to-users.conf b/tests/scripts/switch-to-users.conf
index 5d13fc24..6938ea58 100644
--- a/tests/scripts/switch-to-users.conf
+++ b/tests/scripts/switch-to-users.conf
@@ -34,6 +34,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# Switch to session
#?VT ACTIVATE VT=8
@@ -57,6 +60,9 @@ user-session=default
# Switch to session
#?VT ACTIVATE VT=9
+# Session is locked
+#?LOGIN1 LOCK-SESSION
+
# New session starts
#?SESSION-X-2 START XDG_SEAT=seat0 XDG_VTNR=9 USER=no-password2
#?XSERVER-2 ACCEPT-CONNECT
diff --git a/tests/scripts/unity-switch.conf b/tests/scripts/unity-switch.conf
index 4b4612b3..fec9f1c2 100644
--- a/tests/scripts/unity-switch.conf
+++ b/tests/scripts/unity-switch.conf
@@ -41,6 +41,9 @@ user-session=default
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
+# Lock session
+#?LOGIN1 LOCK-SESSION
+
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=7
#?XSERVER-1 ACCEPT-CONNECT
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c
index fa89820b..526bb73e 100644
--- a/tests/src/test-runner.c
+++ b/tests/src/test-runner.c
@@ -85,6 +85,7 @@ typedef struct
gchar *cookie;
gchar *path;
guint id;
+ gboolean locked;
} CKSession;
static GList *ck_sessions = NULL;
static gint ck_session_index = 0;
@@ -105,6 +106,7 @@ typedef struct
{
gchar *path;
guint pid;
+ gboolean locked;
} Login1Session;
static GList *login1_sessions = NULL;
@@ -1011,14 +1013,20 @@ handle_ck_session_call (GDBusConnection *connection,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
+ CKSession *session = user_data;
+
if (strcmp (method_name, "Lock") == 0)
- {
- check_status ("CONSOLE-KIT LOCK-SESSION");
+ {
+ if (!session->locked)
+ check_status ("CONSOLE-KIT LOCK-SESSION");
+ session->locked = TRUE;
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
}
else if (strcmp (method_name, "Unlock") == 0)
{
- check_status ("CONSOLE-KIT UNLOCK-SESSION");
+ if (session->locked)
+ check_status ("CONSOLE-KIT UNLOCK-SESSION");
+ session->locked = FALSE;
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
}
else
@@ -1132,14 +1140,20 @@ handle_login1_session_call (GDBusConnection *connection,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
+ Login1Session *session = user_data;
+
if (strcmp (method_name, "Lock") == 0)
{
- check_status ("LOGIN1 LOCK-SESSION");
+ if (!session->locked)
+ check_status ("LOGIN1 LOCK-SESSION");
+ session->locked = TRUE;
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
}
else if (strcmp (method_name, "Unlock") == 0)
{
- check_status ("LOGIN1 UNLOCK-SESSION");
+ if (session->locked)
+ check_status ("LOGIN1 UNLOCK-SESSION");
+ session->locked = FALSE;
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
}
else
diff --git a/tests/test-lock-seat-return-session-console-kit b/tests/test-lock-seat-return-session-console-kit
new file mode 100755
index 00000000..2a1df670
--- /dev/null
+++ b/tests/test-lock-seat-return-session-console-kit
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner lock-seat-return-session-console-kit test-gobject-greeter