diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2017-01-27 10:47:17 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2017-01-27 10:47:17 +1300 |
commit | efe8c45a10406d5f8255834ff84153be168cd8bb (patch) | |
tree | 2e84d138cb4792e484d568a89131145cee498063 /tests | |
parent | e3f0752d51490c01bd24b6ae43126a1d14da54a4 (diff) | |
download | lightdm-git-efe8c45a10406d5f8255834ff84153be168cd8bb.tar.gz |
Correctly pass return value from sessions to LightDM
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/scripts/greeter-fail-start.conf | 1 | ||||
-rw-r--r-- | tests/scripts/greeter-not-installed.conf | 3 | ||||
-rw-r--r-- | tests/scripts/login-greeter-return-failure.conf | 48 | ||||
-rw-r--r-- | tests/src/test-gobject-greeter.c | 8 | ||||
-rwxr-xr-x | tests/test-login-greeter-return-failure | 2 |
6 files changed, 60 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index d707aedb..cd00ea80 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -116,6 +116,7 @@ TESTS = \ test-login-remote-session-gobject \ test-login-session-crash \ test-login-xserver-crash \ + test-login-greeter-return-failure \ test-multiple-authenticate \ test-xserver-no-share \ test-home-dir-on-authenticate \ @@ -487,6 +488,7 @@ EXTRA_DIST = \ scripts/login1-terminate.conf \ scripts/login.conf \ scripts/login-crash-authenticate.conf \ + scripts/login-greeter-return-failure.conf \ scripts/login-guest.conf \ scripts/login-guest-disabled.conf \ scripts/login-guest-fail-setup-script.conf \ diff --git a/tests/scripts/greeter-fail-start.conf b/tests/scripts/greeter-fail-start.conf index 03e0ceb8..a68311a2 100644 --- a/tests/scripts/greeter-fail-start.conf +++ b/tests/scripts/greeter-fail-start.conf @@ -3,6 +3,7 @@ # [test-greeter-config] +exit-on-startup=true return-value=1 #?*START-DAEMON diff --git a/tests/scripts/greeter-not-installed.conf b/tests/scripts/greeter-not-installed.conf index ce452b85..18bfa91c 100644 --- a/tests/scripts/greeter-not-installed.conf +++ b/tests/scripts/greeter-not-installed.conf @@ -2,9 +2,6 @@ # Check that LightDM quits when the greeter does not exist # -[test-greeter-config] -return-value=1 - #?*START-DAEMON #?RUNNER DAEMON-START diff --git a/tests/scripts/login-greeter-return-failure.conf b/tests/scripts/login-greeter-return-failure.conf new file mode 100644 index 00000000..783b6596 --- /dev/null +++ b/tests/scripts/login-greeter-return-failure.conf @@ -0,0 +1,48 @@ +# +# Check can login even if the greeter returns an error code (it otherwise works fine) +# + +[Seat:*] +user-session=default + +[test-greeter-config] +return-value=1 + +#?*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 + +# Greeter starts +#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 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 into account with a password +#?*GREETER-X-0 AUTHENTICATE USERNAME=have-password1 +#?GREETER-X-0 SHOW-PROMPT TEXT="Password:" +#?*GREETER-X-0 RESPOND TEXT="password" +#?GREETER-X-0 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE +#?*GREETER-X-0 START-SESSION +#?GREETER-X-0 TERMINATE SIGNAL=15 + +# 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=c1 +#?XSERVER-0 ACCEPT-CONNECT +#?SESSION-X-0 CONNECT-XSERVER + +# Cleanup +#?*STOP-DAEMON +#?SESSION-X-0 TERMINATE SIGNAL=15 +#?XSERVER-0 TERMINATE SIGNAL=15 +#?RUNNER DAEMON-EXIT STATUS=0 diff --git a/tests/src/test-gobject-greeter.c b/tests/src/test-gobject-greeter.c index 94ebf519..92486d4c 100644 --- a/tests/src/test-gobject-greeter.c +++ b/tests/src/test-gobject-greeter.c @@ -520,7 +520,7 @@ main (int argc, char **argv) g_key_file_load_from_file (config, path, G_KEY_FILE_NONE, NULL); g_free (path); - if (g_key_file_has_key (config, "test-greeter-config", "return-value", NULL)) + if (g_key_file_get_boolean (config, "test-greeter-config", "exit-on-startup", NULL)) { int return_value = g_key_file_get_integer (config, "test-greeter-config", "return-value", NULL); status_notify ("%s EXIT CODE=%d", greeter_id, return_value); @@ -561,5 +561,11 @@ main (int argc, char **argv) g_main_loop_run (loop); + 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); + return return_value; + } + return exit_code; } diff --git a/tests/test-login-greeter-return-failure b/tests/test-login-greeter-return-failure new file mode 100755 index 00000000..2465f4d4 --- /dev/null +++ b/tests/test-login-greeter-return-failure @@ -0,0 +1,2 @@ +#!/bin/sh +./src/dbus-env ./src/test-runner login-greeter-return-failure test-gobject-greeter |