summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2013-10-27 18:06:29 +1300
committerRobert Ancell <robert.ancell@canonical.com>2013-10-27 18:06:29 +1300
commitbc6bf92cf7d72d296629d3ecd177b7647d6c4ec5 (patch)
treeb824b7013832c7f21f23f01fe188bf91b92df8ee
parent98b434444b1f142181a266c878828d4a7fdff509 (diff)
downloadlightdm-bc6bf92cf7d72d296629d3ecd177b7647d6c4ec5.tar.gz
Add regression test for guest wrapper
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/scripts/guest-wrapper.conf37
-rw-r--r--tests/src/Makefile.am10
-rw-r--r--tests/src/test-guest-wrapper.c29
-rwxr-xr-xtests/test-guest-wrapper2
5 files changed, 80 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c5cbe85a..6fcb0fd8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -46,6 +46,7 @@ TESTS = \
test-autologin-guest \
test-autologin-guest-fail-setup-script \
test-autologin-guest-logout \
+ test-guest-wrapper \
test-group-membership \
test-xdg-current-desktop \
test-xdg-seat \
@@ -334,6 +335,7 @@ EXTRA_DIST = \
scripts/greeter-wrapper.conf \
scripts/greeter-xserver-crash.conf \
scripts/group-membership.conf \
+ scripts/guest-wrapper.conf \
scripts/headless.conf \
scripts/home-dir-on-authenticate.conf \
scripts/home-dir-on-session.conf \
diff --git a/tests/scripts/guest-wrapper.conf b/tests/scripts/guest-wrapper.conf
new file mode 100644
index 00000000..193f6b44
--- /dev/null
+++ b/tests/scripts/guest-wrapper.conf
@@ -0,0 +1,37 @@
+#
+# Check guest wrapper works
+#
+
+[SeatDefaults]
+autologin-guest=true
+user-session=default
+guest-wrapper=test-guest-wrapper
+
+#?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
+
+# Guest account created
+#?GUEST-ACCOUNT ADD USERNAME=guest-.*
+
+# Greeter wrapper starts
+#?GUEST-WRAPPER-X-0 START
+
+# Guest session starts
+#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 DESKTOP_SESSION=default USER=guest-.*
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Cleanup
+#?*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/src/Makefile.am b/tests/src/Makefile.am
index ccfb0e4a..0f507399 100644
--- a/tests/src/Makefile.am
+++ b/tests/src/Makefile.am
@@ -3,6 +3,7 @@ noinst_PROGRAMS = dbus-env \
plymouth \
test-gobject-greeter \
test-greeter-wrapper \
+ test-guest-wrapper \
test-mir-greeter \
test-runner \
test-script-hook \
@@ -96,6 +97,15 @@ test_greeter_wrapper_LDADD = \
$(GLIB_LIBS) \
$(GIO_UNIX_LIBS)
+test_guest_wrapper_SOURCES = test-guest-wrapper.c status.c status.h
+test_guest_wrapper_CFLAGS = \
+ $(WARN_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GIO_UNIX_CFLAGS)
+test_guest_wrapper_LDADD = \
+ $(GLIB_LIBS) \
+ $(GIO_UNIX_LIBS)
+
test_gobject_greeter_SOURCES = test-gobject-greeter.c status.c status.h
test_gobject_greeter_CFLAGS = \
-I$(top_srcdir)/liblightdm-gobject \
diff --git a/tests/src/test-guest-wrapper.c b/tests/src/test-guest-wrapper.c
new file mode 100644
index 00000000..0c883cf9
--- /dev/null
+++ b/tests/src/test-guest-wrapper.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "status.h"
+
+static void
+request_cb (const gchar *request)
+{
+}
+
+int
+main (int argc, char **argv)
+{
+ gchar *display;
+
+ status_connect (request_cb);
+
+ display = getenv ("DISPLAY");
+ if (display == NULL)
+ status_notify ("GUEST-WRAPPER-? START");
+ else if (display[0] == ':')
+ status_notify ("GUEST-WRAPPER-X-%s START", display + 1);
+ else
+ status_notify ("GUEST-WRAPPER-X-%s START", display);
+
+ execv (argv[1], argv + 1);
+
+ return EXIT_FAILURE;
+}
diff --git a/tests/test-guest-wrapper b/tests/test-guest-wrapper
new file mode 100755
index 00000000..7593c8fb
--- /dev/null
+++ b/tests/test-guest-wrapper
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner guest-wrapper test-gobject-greeter