summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2011-09-06 11:50:03 +1000
committerRobert Ancell <robert.ancell@canonical.com>2011-09-06 11:50:03 +1000
commita810d0cb47dc325be70dd3bc4e87aad5b1ec61e3 (patch)
tree9c4d58fec13852d63bfee1275cf783447589b06c /tests
parentbbb30a86f16d6fa97898a50ffed7974e8d3b151a (diff)
downloadlightdm-a810d0cb47dc325be70dd3bc4e87aad5b1ec61e3.tar.gz
Stop daemon if greeter does not start
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am16
-rw-r--r--tests/scripts/greeter-fail-start.conf2
-rw-r--r--tests/scripts/greeter-fail-start.script21
-rw-r--r--tests/scripts/greeter-not-installed.conf2
-rw-r--r--tests/scripts/greeter-not-installed.script19
-rw-r--r--tests/scripts/switch-to-user.script20
-rw-r--r--tests/src/test-gobject-greeter.c7
-rwxr-xr-xtests/test-greeter-fail-start2
-rwxr-xr-xtests/test-greeter-not-installed2
9 files changed, 76 insertions, 15 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 46028000..d3365a64 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,6 +2,8 @@ SUBDIRS = src
TESTS = \
test-xserver-fail-start \
+ test-greeter-fail-start \
+ test-greeter-not-installed \
test-no-config \
test-headless \
test-autologin \
@@ -38,7 +40,6 @@ TESTS = \
# test-autologin-session-exit-error
# test-login-gobject-session-exit-error
# test-login-qt-session-exit-error
-# test-greeter-no-start
# test-greeter-no-exit
if COMPILE_LIBLIGHTDM_QT
@@ -61,7 +62,6 @@ endif
# In progress
# test-autologin-xserver-crash
-# test-xserver-fail-start
# test-greeter-xserver-crash
EXTRA_DIST = \
@@ -87,6 +87,10 @@ EXTRA_DIST = \
scripts/autologin-session-crash.script \
scripts/autologin-xserver-crash.conf \
scripts/autologin-xserver-crash.script \
+ scripts/greeter-fail-start.conf \
+ scripts/greeter-fail-start.script \
+ scripts/greeter-not-installed.conf \
+ scripts/greeter-not-installed.script \
scripts/headless.conf \
scripts/headless.script \
scripts/login.conf \
@@ -122,8 +126,8 @@ EXTRA_DIST = \
scripts/plymouth-active-vt.script \
scripts/plymouth-inactive-vt.conf \
scripts/plymouth-inactive-vt.script \
- scripts/plymouth-xserver-fail-start.conf \
- scripts/plymouth-xserver-fail-start.script \
+ scripts/plymouth-no-seat.conf \
+ scripts/plymouth-no-seat.script \
scripts/switch-to-greeter.conf \
scripts/switch-to-greeter.script \
scripts/switch-to-guest.conf \
@@ -131,4 +135,6 @@ EXTRA_DIST = \
scripts/switch-to-user.conf \
scripts/switch-to-user.script \
scripts/xdmcp-login.conf \
- scripts/xdmcp-login.script
+ scripts/xdmcp-login.script \
+ scripts/xserver-fail-start.conf \
+ scripts/xserver-fail-start.script
diff --git a/tests/scripts/greeter-fail-start.conf b/tests/scripts/greeter-fail-start.conf
new file mode 100644
index 00000000..7fbc32af
--- /dev/null
+++ b/tests/scripts/greeter-fail-start.conf
@@ -0,0 +1,2 @@
+[test-greeter-config]
+return-value=1
diff --git a/tests/scripts/greeter-fail-start.script b/tests/scripts/greeter-fail-start.script
new file mode 100644
index 00000000..c01799db
--- /dev/null
+++ b/tests/scripts/greeter-fail-start.script
@@ -0,0 +1,21 @@
+#
+# Check that LightDM quits when the greeter fails to start
+#
+RUNNER DAEMON-START
+
+# X server starts
+XSERVER :50 START
+XSERVER :50 INDICATE-READY
+
+# LightDM connects to X server
+XSERVER :50 ACCEPT-CONNECT
+
+# Greeter fails to start
+GREETER START
+GREETER EXIT CODE=1
+
+# X server stopped
+XSERVER :50 TERMINATE SIGNAL=15
+
+# Daemon stops with error
+RUNNER DAEMON-EXIT STATUS=1
diff --git a/tests/scripts/greeter-not-installed.conf b/tests/scripts/greeter-not-installed.conf
new file mode 100644
index 00000000..7fbc32af
--- /dev/null
+++ b/tests/scripts/greeter-not-installed.conf
@@ -0,0 +1,2 @@
+[test-greeter-config]
+return-value=1
diff --git a/tests/scripts/greeter-not-installed.script b/tests/scripts/greeter-not-installed.script
new file mode 100644
index 00000000..8b84afff
--- /dev/null
+++ b/tests/scripts/greeter-not-installed.script
@@ -0,0 +1,19 @@
+#
+# Check that LightDM quits when the greeter does not exist
+#
+RUNNER DAEMON-START
+
+# X server starts
+XSERVER :50 START
+XSERVER :50 INDICATE-READY
+
+# LightDM connects to X server
+XSERVER :50 ACCEPT-CONNECT
+
+# Invalid greeter attempted, fails to start
+
+# X server stopped
+XSERVER :50 TERMINATE SIGNAL=15
+
+# Daemon stops with error
+RUNNER DAEMON-EXIT STATUS=1
diff --git a/tests/scripts/switch-to-user.script b/tests/scripts/switch-to-user.script
index c946407e..e8864471 100644
--- a/tests/scripts/switch-to-user.script
+++ b/tests/scripts/switch-to-user.script
@@ -31,17 +31,17 @@ XSERVER :51 INDICATE-READY
XSERVER :51 ACCEPT-CONNECT
# Existing X server stops, new greeter starts
-(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON)
-(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON)
-(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON)
-(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON)
-(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON)
-(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON)
-(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON)
-
# Alice is automatically selected
-GREETER AUTHENTICATE-SELECTED USERNAME=alice
-GREETER SHOW-PROMPT TEXT="Password:"
+# FIXME: Need to make parallel tests...
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
+(XSERVER :50 TERMINATE SIGNAL=15|GREETER TERMINATE SIGNAL=15|GREETER START|GREETER CONNECT-XSERVER :51|XSERVER :51 ACCEPT-CONNECT|GREETER CONNECT-TO-DAEMON|GREETER CONNECTED-TO-DAEMON|GREETER AUTHENTICATE-SELECTED USERNAME=alice|GREETER SHOW-PROMPT TEXT="Password:")
# Cleanup
*STOP-DAEMON
diff --git a/tests/src/test-gobject-greeter.c b/tests/src/test-gobject-greeter.c
index 293dba67..7c110866 100644
--- a/tests/src/test-gobject-greeter.c
+++ b/tests/src/test-gobject-greeter.c
@@ -79,6 +79,13 @@ main (int argc, char **argv)
if (g_getenv ("LIGHTDM_TEST_CONFIG"))
g_key_file_load_from_file (config, g_getenv ("LIGHTDM_TEST_CONFIG"), G_KEY_FILE_NONE, NULL);
+ if (g_key_file_has_key (config, "test-greeter-config", "return-value", NULL))
+ {
+ int return_value = g_key_file_get_integer (config, "test-greeter-config", "return-value", NULL);
+ notify_status ("GREETER EXIT CODE=%d", return_value);
+ return return_value;
+ }
+
g_type_init ();
main_loop = g_main_loop_new (NULL, FALSE);
diff --git a/tests/test-greeter-fail-start b/tests/test-greeter-fail-start
new file mode 100755
index 00000000..e330483a
--- /dev/null
+++ b/tests/test-greeter-fail-start
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/test-runner greeter-fail-start test-gobject-greeter
diff --git a/tests/test-greeter-not-installed b/tests/test-greeter-not-installed
new file mode 100755
index 00000000..d5c030d5
--- /dev/null
+++ b/tests/test-greeter-not-installed
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/test-runner greeter-not-installed invalid-greeter