Skip to content

Commit bc6bf92

Browse files
committed
Add regression test for guest wrapper
1 parent 98b4344 commit bc6bf92

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed

tests/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ TESTS = \
4646
test-autologin-guest \
4747
test-autologin-guest-fail-setup-script \
4848
test-autologin-guest-logout \
49+
test-guest-wrapper \
4950
test-group-membership \
5051
test-xdg-current-desktop \
5152
test-xdg-seat \
@@ -334,6 +335,7 @@ EXTRA_DIST = \
334335
scripts/greeter-wrapper.conf \
335336
scripts/greeter-xserver-crash.conf \
336337
scripts/group-membership.conf \
338+
scripts/guest-wrapper.conf \
337339
scripts/headless.conf \
338340
scripts/home-dir-on-authenticate.conf \
339341
scripts/home-dir-on-session.conf \

tests/scripts/guest-wrapper.conf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Check guest wrapper works
3+
#
4+
5+
[SeatDefaults]
6+
autologin-guest=true
7+
user-session=default
8+
guest-wrapper=test-guest-wrapper
9+
10+
#?RUNNER DAEMON-START
11+
12+
# X server starts
13+
#?XSERVER-0 START VT=7
14+
15+
# Daemon connects when X server is ready
16+
#?*XSERVER-0 INDICATE-READY
17+
#?XSERVER-0 INDICATE-READY
18+
#?XSERVER-0 ACCEPT-CONNECT
19+
20+
# Guest account created
21+
#?GUEST-ACCOUNT ADD USERNAME=guest-.*
22+
23+
# Greeter wrapper starts
24+
#?GUEST-WRAPPER-X-0 START
25+
26+
# Guest session starts
27+
#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 DESKTOP_SESSION=default USER=guest-.*
28+
#?XSERVER-0 ACCEPT-CONNECT
29+
#?SESSION-X-0 CONNECT-XSERVER
30+
31+
# Cleanup
32+
#?*STOP-DAEMON
33+
#?SESSION-X-0 TERMINATE SIGNAL=15
34+
#?XSERVER-0 TERMINATE SIGNAL=15
35+
#?GUEST-ACCOUNT REMOVE USERNAME=guest.*
36+
#?RUNNER DAEMON-EXIT STATUS=0
37+

tests/src/Makefile.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ noinst_PROGRAMS = dbus-env \
33
plymouth \
44
test-gobject-greeter \
55
test-greeter-wrapper \
6+
test-guest-wrapper \
67
test-mir-greeter \
78
test-runner \
89
test-script-hook \
@@ -96,6 +97,15 @@ test_greeter_wrapper_LDADD = \
9697
$(GLIB_LIBS) \
9798
$(GIO_UNIX_LIBS)
9899

100+
test_guest_wrapper_SOURCES = test-guest-wrapper.c status.c status.h
101+
test_guest_wrapper_CFLAGS = \
102+
$(WARN_CFLAGS) \
103+
$(GLIB_CFLAGS) \
104+
$(GIO_UNIX_CFLAGS)
105+
test_guest_wrapper_LDADD = \
106+
$(GLIB_LIBS) \
107+
$(GIO_UNIX_LIBS)
108+
99109
test_gobject_greeter_SOURCES = test-gobject-greeter.c status.c status.h
100110
test_gobject_greeter_CFLAGS = \
101111
-I$(top_srcdir)/liblightdm-gobject \

tests/src/test-guest-wrapper.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <stdlib.h>
2+
#include <unistd.h>
3+
4+
#include "status.h"
5+
6+
static void
7+
request_cb (const gchar *request)
8+
{
9+
}
10+
11+
int
12+
main (int argc, char **argv)
13+
{
14+
gchar *display;
15+
16+
status_connect (request_cb);
17+
18+
display = getenv ("DISPLAY");
19+
if (display == NULL)
20+
status_notify ("GUEST-WRAPPER-? START");
21+
else if (display[0] == ':')
22+
status_notify ("GUEST-WRAPPER-X-%s START", display + 1);
23+
else
24+
status_notify ("GUEST-WRAPPER-X-%s START", display);
25+
26+
execv (argv[1], argv + 1);
27+
28+
return EXIT_FAILURE;
29+
}

tests/test-guest-wrapper

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
./src/dbus-env ./src/test-runner guest-wrapper test-gobject-greeter

0 commit comments

Comments
 (0)