Merge lp:~robert-ancell/lightdm/test-no-usc into lp:lightdm

Proposed by Robert Ancell
Status: Merged
Approved by: Robert Ancell
Approved revision: 1919
Merged at revision: 1918
Proposed branch: lp:~robert-ancell/lightdm/test-no-usc
Merge into: lp:lightdm
Diff against target: 75 lines (+30/-4)
4 files modified
src/unity-system-compositor.c (+10/-4)
tests/Makefile.am (+2/-0)
tests/scripts/unity-compositor-not-found.conf (+16/-0)
tests/test-unity-compositor-not-found (+2/-0)
To merge this branch: bzr merge lp:~robert-ancell/lightdm/test-no-usc
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Robert Ancell Approve
Review via email: mp+209831@code.launchpad.net

Commit message

Check we correctly stop if the Unity compositor can't be found

To post a comment you must log in.
1919. By Robert Ancell

Fix memory leak

Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-system-compositor.c'
2--- src/unity-system-compositor.c 2014-03-04 03:23:30 +0000
3+++ src/unity-system-compositor.c 2014-03-07 03:47:21 +0000
4@@ -403,13 +403,19 @@
5 process_set_env (compositor->priv->process, "LD_LIBRARY_PATH", g_getenv ("LD_LIBRARY_PATH"));
6 }
7
8- command = g_strdup_printf ("%s --file '%s' --from-dm-fd %d --to-dm-fd %d --vt %d", compositor->priv->command, compositor->priv->socket, compositor->priv->to_compositor_pipe[0], compositor->priv->from_compositor_pipe[1], compositor->priv->vt);
9- absolute_command = get_absolute_command (command);
10+ /* Generate command line to run */
11+ absolute_command = get_absolute_command (compositor->priv->command);
12+ if (!absolute_command)
13+ {
14+ l_debug (compositor, "Can't launch compositor %s, not found in path", compositor->priv->command);
15+ return FALSE;
16+ }
17+ command = g_strdup_printf ("%s --file '%s' --from-dm-fd %d --to-dm-fd %d --vt %d", absolute_command, compositor->priv->socket, compositor->priv->to_compositor_pipe[0], compositor->priv->from_compositor_pipe[1], compositor->priv->vt);
18+ process_set_command (compositor->priv->process, command);
19 g_free (command);
20+ g_free (absolute_command);
21
22 /* Start the compositor */
23- process_set_command (compositor->priv->process, absolute_command);
24- g_free (absolute_command);
25 g_signal_connect (compositor->priv->process, "stopped", G_CALLBACK (stopped_cb), compositor);
26 result = process_start (compositor->priv->process, FALSE);
27
28
29=== modified file 'tests/Makefile.am'
30--- tests/Makefile.am 2014-02-26 23:52:14 +0000
31+++ tests/Makefile.am 2014-03-07 03:47:21 +0000
32@@ -161,6 +161,7 @@
33 test-mir-session-crash \
34 test-mir-session-compositor-crash \
35 test-unity-compositor-command \
36+ test-unity-compositor-not-found \
37 test-unity-compositor-fail-start \
38 test-unity-compositor-fail-ready \
39 test-unity-compositor-crash \
40@@ -452,6 +453,7 @@
41 scripts/unity-compositor-fallback.conf \
42 scripts/unity-compositor-mir-next-session.conf \
43 scripts/unity-compositor-next-session.conf \
44+ scripts/unity-compositor-not-found.conf \
45 scripts/unity-login.conf \
46 scripts/unity-mir-autologin.conf \
47 scripts/unity-mir-greeter-mir-session.conf \
48
49=== added file 'tests/scripts/unity-compositor-not-found.conf'
50--- tests/scripts/unity-compositor-not-found.conf 1970-01-01 00:00:00 +0000
51+++ tests/scripts/unity-compositor-not-found.conf 2014-03-07 03:47:21 +0000
52@@ -0,0 +1,16 @@
53+#
54+# Check can set the unity compositor command
55+#
56+
57+[SeatDefaults]
58+type=unity
59+user-session=default
60+unity-compositor-command=unity-system-compositor-INVALID
61+
62+#?*START-DAEMON
63+#?RUNNER DAEMON-START
64+
65+# Command is not found
66+
67+# Daemon exits with error code
68+#?RUNNER DAEMON-EXIT STATUS=1
69
70=== added file 'tests/test-unity-compositor-not-found'
71--- tests/test-unity-compositor-not-found 1970-01-01 00:00:00 +0000
72+++ tests/test-unity-compositor-not-found 2014-03-07 03:47:21 +0000
73@@ -0,0 +1,2 @@
74+#!/bin/sh
75+./src/dbus-env ./src/test-runner unity-compositor-not-found test-gobject-greeter

Subscribers

People subscribed via source and target branches