summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Disable user switching if logind says it isn't supportedRichard Hansen2023-04-284-1/+94
| | | | | | | | | | This should work now that seat_local_get_active_session returns the proper value for non-seat0 seats. Note: systemd-logind v245 and older erroneously report CanMultiSession=no on non-seat0 seats even when it is supported. This change will break those users. See <https://github.com/systemd/systemd/pull/15337>.
* Use systemd-logind to discover active session on non-seat0 seatsRichard Hansen2023-04-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, `seat_local_get_active_session` would always return `NULL` for non-`seat0` seats. This broke Wayland sessions on non-`seat0` seats: 1. User logged in to a Wayland session on `seat1`. 2. LightDM properly terminated the X server to allow Wayland to take over the seat's hardware. (See the side note below.) 3. Wayland session started. 4. The X server termination triggered a call to `display_server_stopped_cb`. 5. `display_server_stopped_cb` called `seat_get_active_session` to see if it needed to start a greeter to replace a terminated session associated with the terminated display. 6. `seat_get_active_session` called `seat_local_get_active_session`. 7. `seat_local_get_active_session` erroneously probed the active VT even though VTs are only associated with `seat0`. 8. After finding no matching session associated with both `seat1` and the active VT, `seat_local_get_active_session` returned `NULL` when it should have returned the new Wayland session. 9. Due to the `NULL` response, `display_server_stopped_cb` erroneously arrived at the conclusion that a greeter must be started on `seat1`. 10. LightDM started a new X server and greeter on `seat1`, stomping on the newly created Wayland session. Side note: I don't think that terminating X to allow Wayland to take over the seat's hardware is required because I believe X and most?/all? Wayland compositors cooperatively share the devices via systemd-logind or maybe libseat. When switching sessions, logind uses a hand-off protocol to smoothly change which process is allowed to access the devices. This makes session switching possible even without virtual terminals. For details, see <https://dvdhrm.wordpress.com/2013/08/25/sane-session-switching/>. The above sequence of events is apparent in the debug log from a minimal script (the script is not included in this commit; the relevant lines from the log are copied below, with annotations): # # User logs in to seat1 with a Wayland session: # GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=no-password2 AUTHENTICATED=TRUE *GREETER-X-1 START-SESSION [+0.32s] DEBUG: Seat seat1: Creating display server of type wayland [+0.32s] DEBUG: Seat seat1: Display server ready, running session [+0.32s] DEBUG: Registering session with bus path /org/freedesktop/DisplayManager/Session0 [+0.32s] DEBUG: Session pid=1309577: Running command /home/rhansen/floss/lightdm/tests/src/lightdm-session test-session # # LightDM starts shutting down X+greeter for seat1 while # concurrently activating the new Wayland session (c1 = the # stopping seat1 greeter session, c2 = the starting Wayland # session). # [+0.33s] DEBUG: Seat seat1: Stopping greeter [+0.33s] DEBUG: Terminating login1 session c1 [+0.33s] DEBUG: Session pid=1309572: Sending SIGTERM [+0.33s] DEBUG: Activating login1 session c2 GREETER-X-1 TERMINATE SIGNAL=15 LOGIN1 ACTIVATE-SESSION SESSION=c2 # # The greeter session and X exit. # [+0.33s] DEBUG: Session pid=1309572: Exited with return value 0 [+0.33s] DEBUG: Seat seat1: Session stopped [+0.33s] DEBUG: Seat seat1: Stopping display server, no sessions require it [+0.33s] DEBUG: Sending signal 15 to process 1309569 XSERVER-1 TERMINATE SIGNAL=15 [+0.33s] DEBUG: Process 1309569 exited with return value 0 [+0.33s] DEBUG: XServer 1: X server stopped [+0.33s] DEBUG: Seat seat1: Display server stopped # # The start of the problem: LightDM should not restart the greeter # until the Wayland session terminates: # [+0.33s] DEBUG: Seat seat1: Active display server stopped, starting greeter [+0.33s] DEBUG: Seat seat1: Creating greeter session [+0.33s] DEBUG: Seat seat1: Creating display server of type x [+0.33s] DEBUG: Seat seat1: Starting local X display [+0.33s] DEBUG: XServer 1: Launching X Server [+0.33s] DEBUG: Launching process 1309583: /home/rhansen/floss/lightdm/tests/src/X :1 -seat seat1 -auth /var/run/lightdm/root/:1 -nolisten tcp [+0.33s] DEBUG: XServer 1: Waiting for ready signal from X server :1 XSERVER-1 START SEAT=seat1 # # The Wayland session has started concurrently with the # replacement X+greeter. # SESSION-WAYLAND START XDG_SEAT=seat1 XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/no-password2 XDG_SESSION_TYPE=wayland XDG_SESSION_DESKTOP=wayland USER=no-password2 *XSERVER-1 INDICATE-READY XSERVER-1 INDICATE-READY [+0.34s] DEBUG: Got signal 10 from process 1309583 [+0.34s] DEBUG: XServer 1: Got signal from X server :1 [+0.34s] DEBUG: XServer 1: Connecting to XServer :1 XSERVER-1 ACCEPT-CONNECT [+0.34s] DEBUG: Seat seat1: Display server ready, starting session authentication [+0.34s] DEBUG: Session pid=1309587: Started with service 'lightdm-greeter', username 'lightdm' [+0.40s] DEBUG: Session pid=1309587: Running command /home/rhansen/floss/lightdm/tests/src/.libs/test-gobject-greeter # # Finally, the replacement greeter stomps on the new Wayland # session. # [+0.40s] DEBUG: Locking login1 session c2 LOGIN1 LOCK-SESSION SESSION=c2
* tests: New FENCE script command to ensure event orderRichard Hansen2023-04-281-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, emitted status text is allowed to match a status matcher line from anywhere in the script. Thus, a script like the following: #?*FOO #?BAR will happily accept a sequence of events like this: BAR *FOO This loose ordering avoids test flakiness in the presence of concurrent events, but can be problematic if the test wants to assert that the BAR event is an effect of the FOO command and not coincidental. (A concrete example: assert that a greeter was launched *because* the user session terminated, not in parallel with the briefly-lived user session.) Script authors may be tempted to assert causality by introducing a WAIT like this: #?*WAIT #?*FOO #?BAR but that would not have the desired effect because it will still accept a BAR event before the FOO command (or even the WAIT command) is executed. The new FENCE command helps script authors assert causality by ensuring that an emitted status does not match a line on the other side of the fence. For example, the following script works as expected and asserts a causal relationship between FOO and BAR: #?*WAIT #?*FENCE #?*FOO #?BAR The above script only works if the WAIT is long enough to sufficiently rule out coincidence. To see why, note that the following sequence of events would be accepted by the above script: *WAIT *FENCE BAR *FOO The order of the FENCE and FOO should not be switched, otherwise it introduces a theoretical race condition: If the BAR event is caused by the FOO command, and the BAR event happens to arrive before the FENCE is executed, then the test will fail when it should not. (Technically it is not possible to lose the race right now because of how run_commands is implemented, but scripts should not rely on an implementation detail. Besides, it doesn't eliminate the need for the WAIT.) This new command will be used in a future commit to add a regression test for a Wayland multiseat bug.
* Initialize WaylandSessionPrivate.vt to -1Richard Hansen2023-04-283-0/+68
| | | | | | | | | | | This matters when starting a Wayland session on a non-seat0 seat: * It eliminates an erroneous attempt to switch to VT 0. * The XDG_VTNR environment variable is no longer set. Also add a multiseat test. A similar change for XServerLocalPrivate is not needed because its vt field is already initialized to -1.
* Update the "cancel-authentication" test to check for actual cancellingPaul Wolneykien2023-04-261-0/+1
| | | | | | | | | The purpose of "cancelling" state that was recently added to the greeter module is to notify the greeter client about session cancellation before disconnect. This patch adds a check for that behavior. Signed-off-by: Paul Wolneykien <manowar@altlinux.org>
* tests: Use unix:dir instead of unix:tmpdir for dbus-daemon socketRichard Hansen2023-04-263-11/+14
| | | | | | | | Starting with dbus-daemon v1.15.2, unix:tmpdir no longer causes dbus-daemon to create abstract sockets (for security reasons), so unix:tmpdir is now equivalent to unix:dir. (Also, some systems don't support abstract sockets.) Switch to unix:dir so that it is clear that the tests expect a socket file to be created in the filesystem.
* tests: Don't redirect /tmp/dbus-* to $LIGHTDM_TEST_ROOT/tmp/dbus-*Richard Hansen2023-04-261-0/+21
|
* tests: Include the command line in the debug logRichard Hansen2023-04-261-0/+2
|
* tests: Include $DBUS_SYSTEM_BUS_ADDRESS in the test logRichard Hansen2023-04-261-2/+2
|
* tests: Replace system("cp ...") with GIO callsRichard Hansen2023-04-261-16/+62
| | | | This silences some warning messages on Fedora.
* tests: Check for dbus connection errorRichard Hansen2023-04-261-1/+3
|
* tests: Reuse the g_bus_get_sync return valueRichard Hansen2023-04-261-45/+44
|
* tests: Fix g_bus_own_name argument orderRichard Hansen2023-04-261-2/+2
|
* tests: Include script commands in the debug logRichard Hansen2023-04-261-0/+3
|
* tests: Add some documenting comments to help future readersRichard Hansen2023-04-261-0/+53
|
* tests: Refactor run_commands for readabilityRichard Hansen2023-04-261-8/+9
|
* x-server-xvnc: Adjust default color depth to match upstream TigerVNC.Maxim Cournoyer2022-08-264-4/+4
| | | | | | | | | | | | | There is no longer support for 8 bit color depth in TigerVNC (see: https://github.com/TigerVNC/tigervnc/commit/e86d8720ba1e79b486ca29a5c2b27fa25811e6a2); using it causes a fatal error. * src/x-server-xvnc.c (x_server_xvnc_init): Set default depth to 24 bit. * tests/scripts/vnc-command.conf (command): Adjust accordingly. * tests/scripts/vnc-guest.conf (user-session): Likewise. * tests/scripts/vnc-login.conf (user-session): Likewise. * tests/scripts/vnc-open-file-descriptors.conf (user-session): Likewise. * data/lightdm.conf: Likewise.
* Fix tests broken by default config change in ↵Robert Ancell2022-07-186-9/+9
| | | | 77a7c6b7b8ca896b98ef43826641bdd520650bfb
* Fix test against arrays that can never be NULLRobert Ancell2022-06-151-8/+4
|
* Disable compiler optimizations for test programsPaul Wolneykien2022-05-121-0/+4
| | | | | | | | | | | | Disable compiler optimizations for test programs as it is known to be buggy with `LD_PRELOAD`. In particular, `getgroups()` call in `request_cb()` callback of `test-session` isn't overloaded by the corresponding function of the test library `libsystem.so` via `LD_PRELOAD` resulting in `test-group-membership` failure. Signed-off-by: Paul Wolneykien <manowar@altlinux.org>
* test-runner.c: Fix: Make the test configuration files aware of the ↵Paul Wolneykien2022-05-123-18/+18
| | | | | | | | | | | --with-greeter-user configuration parameter Use GREETER_USER for the greeter user name in the `tests/scripts/*-pam*.conf.in` files. Without this modification LightDM built with non-default greeter user name is unable to pass some tests. Signed-off-by: Paul Wolneykien <manowar@altlinux.org>
* test-runner.c: Fix: Make the test runner aware of the --with-greeter-user ↵Paul Wolneykien2022-05-121-1/+1
| | | | | | | | | | configuration parameter Use GREETER_USER for the greeter user name in the `<temp_dir>/etc/passwd` file. Without this modification LightDM built with non-default greeter user name is unable to pass some tests. Signed-off-by: Paul Wolneykien <manowar@altlinux.org>
* test-runner.c: Fix: Make the test runner aware of the --with-greeter-session ↵Paul Wolneykien2022-05-121-1/+4
| | | | | | | | | | configuration parameter Use DEFAULT_GREETER_SESSION for the greeter session name. Without this modification LightDM built with non-default greeter session name is unable to pass some tests. Signed-off-by: Paul Wolneykien <manowar@altlinux.org>
* Add __getgroups_chk prototype to fix build failures on some systemsRobert Ancell2022-05-021-0/+1
|
* Fix check for __getgroups_chkRobert Ancell2022-05-021-1/+1
|
* Fix test build failing on older versions of glibc without __getgroups_chkRobert Ancell2022-05-021-0/+2
|
* Mock __getgroups_chk to fix tests on recent glibcRobert Ancell2022-04-261-0/+6
|
* fix: use g_autofree in x_authority_loadmasterKT-lcz2021-06-251-1/+1
| | | add g_autofree before `guint8 *xauth_data;`
* ci: Disable flaky testRobert Ancell2021-02-161-1/+1
|
* Require python 3 for the testsRobert Ancell2021-02-161-1/+1
|
* Handle Python 3 sort method changesRobert Ancell2021-02-151-8/+1
|
* Handle Python 3 use of bytesRobert Ancell2021-02-151-2/+2
|
* Glibc 2.33 fix.Martin Liska2021-02-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | The library does not declare __fxstatat64 and friends in a header file. Thus the following warning appears: ``` libsystem.c:333:1: error: no previous prototype for '__xstat' [-Werror=missing-prototypes] 333 | __xstat (int version, const char *path, struct stat *buf) | ^~~~~~~ libsystem.c:342:1: error: no previous prototype for '__xstat64' [-Werror=missing-prototypes] 342 | __xstat64 (int version, const char *path, struct stat64 *buf) | ^~~~~~~~~ libsystem.c:351:1: error: no previous prototype for '__fxstatat' [-Werror=missing-prototypes] 351 | __fxstatat(int ver, int dirfd, const char *pathname, struct stat *buf, int flags) | ^~~~~~~~~~ libsystem.c:360:1: error: no previous prototype for '__fxstatat64' [-Werror=missing-prototypes] 360 | __fxstatat64(int ver, int dirfd, const char *pathname, struct stat64 *buf, int flags) | ^~~~~~~~~~~~ ``` Fixed #167.
* Drop Qt 4 support, it's been unsupported since 2015Robert Ancell2019-10-1435-128/+0
|
* Remove Unity System Compositor support - it is a dead projectRobert Ancell2018-08-3063-2061/+46
|
* Use more modern *_get_instance_private() method for storing private dataRobert Ancell2018-08-306-107/+141
|
* Fix qt5 test being run instead of qt4 oneRobert Ancell2018-08-301-1/+1
|
* Remove use of deprecated g_type_class_add_privateRobert Ancell2018-08-303-13/+12
|
* Set XDG_SEAT env variable in script hooksRobert Ancell2018-08-218-30/+32
|
* Fix test failing due to random ordering of resultsRobert Ancell2018-05-114-6/+23
|
* Fix incorrect use of ConsoleKit CanSuspend/Hibernate APIRobert Ancell2018-01-231-4/+4
|
* Move test variable declarations from the start of files.Robert Ancell2018-01-1720-1339/+754
|
* Fix test programs failing to link to liblightdm symbolsRobert Ancell2018-01-171-0/+2
| | | | Don't know what's changed, but this fixes it...
* Ensure XDMP X sever shuts down when session closesRobert Ancell2018-01-127-6/+123
| | | | | | | | Previously we were attempting to reconnect a greeter, however we can't trust the X server after the session is run, so we should instead close the connection. The XDMCP client is expected to reconnect again. https://bugs.launchpad.net/bugs/1739787
* Remove trailing whitespaceRobert Ancell2018-01-111-3/+3
|
* Fix LightDM failing to start greeters on remote X servers.Robert Ancell2018-01-113-0/+64
| | | | | This change caused the VNC support to break, so contains some logic fixes for that.
* Fix up KeyboardLayouts migration to AccountsService extensionRobert Ancell2017-12-221-2/+2
|
* Use AccountsService extension system for extended greeter information ↵Robert Ancell2017-12-201-5/+39
| | | | | | | | (background, messages etc) The support for this never landed upstream in AccountsService and the extension system was added later. This allows OSs to make use of these features without a patched AccountsService.
* Refactor global variables out of DBus codeRobert Ancell2017-12-201-218/+199
|
* Remove trailing whitespaceRobert Ancell2017-12-111-3/+3
|