Merge lp:~ted/dbus-test-runner/reporting-delay into lp:dbus-test-runner/12.10

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 56
Merged at revision: 45
Proposed branch: lp:~ted/dbus-test-runner/reporting-delay
Merge into: lp:dbus-test-runner/12.10
Diff against target: 392 lines (+73/-39)
11 files modified
libdbustest/Makefile.am (+1/-1)
libdbustest/bustle.c (+21/-8)
libdbustest/process.c (+27/-8)
libdbustest/service.c (+5/-5)
libdbustest/task.c (+1/-1)
src/Makefile.am (+1/-1)
src/dbus-test-runner.c (+7/-7)
tests/Makefile.am (+5/-6)
tests/test-bustle-data-check.sh (+3/-0)
tests/test-bustle-list.sh (+1/-1)
tests/test-bustle.reference (+1/-1)
To merge this branch: bzr merge lp:~ted/dbus-test-runner/reporting-delay
Reviewer Review Type Date Requested Status
jenkins (community) continuous-integration Approve
Charles Kerr (community) Approve
Review via email: mp+127375@code.launchpad.net

Commit message

Adding a clearing of the buffers to make tests pass on slow systems

Description of the change

Setting up the dispose function so that it clears the buffers when complete to make sure we get a full log out. This should hopefully make it so that the tests pass even when Jenkins is busy doing other things at the same time.

Didn't realize when I started, but the bustle test is failing in trunk. So I fixed that along the way. Which then, lead me to realize that the bustle test data test wasn't actually checking its data. So I fixed that too. End of the day, this should make the test suite in good shape.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

Hey great incentive to fix a couple of failing tests not related to this MP, eh :) ?

53. By Ted Gould

Adding glib explicitly, seems to be failing for Jenkins

54. By Ted Gould

Trying to turn on -Wextra to figure out what's up with Jenkins. Don't think there's huge value, but might as well commit.

55. By Ted Gould

Same treatment for /src

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

g_io_channel_read_line() always nul-terminates the string, so you don't need to do it manually. The rest of the new dispose code is fine.

I've no opinion on -Wextra but looks like it's not hurting anything.... :)

review: Approve
56. By Ted Gould

Stop putting in terminators. You can have too much of a good thing

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

Sorry for the spam--the "passed" result is correct :) .

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbustest/Makefile.am'
2--- libdbustest/Makefile.am 2012-04-20 20:08:10 +0000
3+++ libdbustest/Makefile.am 2012-10-02 21:09:33 +0000
4@@ -29,7 +29,7 @@
5 -I$(top_srcdir) \
6 -DDEFAULT_SESSION_CONF="\"$(datadir)/dbus-test-runner/session.conf\"" \
7 -DG_LOG_DOMAIN=\"libdbustest\" \
8- -Wall -Werror
9+ -Wall -Werror -Wextra
10
11 libdbustest_la_LIBADD = \
12 $(DBUS_TEST_RUNNER_LIBS)
13
14=== modified file 'libdbustest/bustle.c'
15--- libdbustest/bustle.c 2012-04-19 15:54:50 +0000
16+++ libdbustest/bustle.c 2012-10-02 21:09:33 +0000
17@@ -21,6 +21,7 @@
18 #include "config.h"
19 #endif
20
21+#include <glib.h>
22 #include "dbus-test.h"
23
24 struct _DbusTestBustlePrivate {
25@@ -46,6 +47,12 @@
26 static void process_run (DbusTestTask * task);
27 static DbusTestTaskState get_state (DbusTestTask * task);
28 static gboolean get_passed (DbusTestTask * task);
29+static gboolean bustle_writes (GIOChannel * channel,
30+ GIOCondition condition,
31+ gpointer data);
32+static gboolean bustle_write_error (GIOChannel * channel,
33+ GIOCondition condition,
34+ gpointer data);
35
36 G_DEFINE_TYPE (DbusTestBustle, dbus_test_bustle, DBUS_TEST_TYPE_TASK);
37
38@@ -105,18 +112,24 @@
39 }
40
41 if (bustler->priv->stdout != NULL) {
42- g_io_channel_shutdown(bustler->priv->stdout, TRUE, NULL);
43- bustler->priv->stdout = NULL;
44+ while (G_IO_IN & g_io_channel_get_buffer_condition(bustler->priv->stdout)) {
45+ bustle_writes(bustler->priv->stdout, 0 /* unused */, bustler->priv->file);
46+ }
47+
48+ g_clear_pointer(&bustler->priv->stdout, g_io_channel_unref);
49 }
50
51 if (bustler->priv->stderr != NULL) {
52- g_io_channel_shutdown(bustler->priv->stderr, TRUE, NULL);
53- bustler->priv->stderr = NULL;
54+ while (G_IO_IN & g_io_channel_get_buffer_condition(bustler->priv->stderr)) {
55+ bustle_write_error(bustler->priv->stderr, 0 /* unused */, bustler);
56+ }
57+
58+ g_clear_pointer(&bustler->priv->stderr, g_io_channel_unref);
59 }
60
61 if (bustler->priv->file != NULL) {
62 g_io_channel_shutdown(bustler->priv->file, TRUE, NULL);
63- bustler->priv->file = NULL;
64+ g_clear_pointer(&bustler->priv->file, g_io_channel_unref);
65 }
66
67 G_OBJECT_CLASS (dbus_test_bustle_parent_class)->dispose (object);
68@@ -165,7 +178,7 @@
69 }
70
71 static void
72-bustle_watcher (GPid pid, gint status, gpointer data)
73+bustle_watcher (GPid pid, G_GNUC_UNUSED gint status, gpointer data)
74 {
75 g_critical("Bustle Monitor exited abruptly!");
76 DbusTestBustle * bustler = DBUS_TEST_BUSTLE(data);
77@@ -182,7 +195,7 @@
78 }
79
80 static gboolean
81-bustle_write_error (GIOChannel * channel, GIOCondition condition, gpointer data)
82+bustle_write_error (GIOChannel * channel, G_GNUC_UNUSED GIOCondition condition, gpointer data)
83 {
84 gchar * line;
85 gsize termloc;
86@@ -208,7 +221,7 @@
87 }
88
89 static gboolean
90-bustle_writes (GIOChannel * channel, GIOCondition condition, gpointer data)
91+bustle_writes (GIOChannel * channel, G_GNUC_UNUSED GIOCondition condition, gpointer data)
92 {
93 gchar * line;
94 gsize termloc;
95
96=== modified file 'libdbustest/process.c'
97--- libdbustest/process.c 2012-04-23 03:38:09 +0000
98+++ libdbustest/process.c 2012-10-02 21:09:33 +0000
99@@ -30,6 +30,7 @@
100 GPid pid;
101 guint io_watch;
102 guint watcher;
103+ GIOChannel * io_chan;
104
105 gboolean complete;
106 gint status;
107@@ -74,6 +75,7 @@
108
109 self->priv->executable = NULL;
110 self->priv->parameters = NULL;
111+ self->priv->io_chan = NULL;
112
113 return;
114 }
115@@ -103,6 +105,26 @@
116 process->priv->pid = 0;
117 }
118
119+ if (process->priv->io_chan != NULL) {
120+ GIOStatus status = G_IO_STATUS_NORMAL;
121+
122+ while ((G_IO_IN & g_io_channel_get_buffer_condition(process->priv->io_chan)) && status == G_IO_STATUS_NORMAL) {
123+ gchar * line = NULL;
124+ gsize termloc;
125+
126+ status = g_io_channel_read_line (process->priv->io_chan, &line, NULL, &termloc, NULL);
127+
128+ if (status != G_IO_STATUS_NORMAL) {
129+ continue;
130+ }
131+
132+ dbus_test_task_print(DBUS_TEST_TASK(process), line);
133+ g_free(line);
134+ }
135+
136+ g_clear_pointer(&process->priv->io_chan, g_io_channel_unref);
137+ }
138+
139 G_OBJECT_CLASS (dbus_test_process_parent_class)->dispose (object);
140 return;
141 }
142@@ -143,7 +165,7 @@
143 }
144
145 static gboolean
146-proc_writes (GIOChannel * channel, GIOCondition condition, gpointer data)
147+proc_writes (GIOChannel * channel, G_GNUC_UNUSED GIOCondition condition, gpointer data)
148 {
149 g_return_val_if_fail(DBUS_TEST_IS_PROCESS(data), FALSE);
150 DbusTestProcess * process = DBUS_TEST_PROCESS(data);
151@@ -164,8 +186,6 @@
152 continue;
153 }
154
155- line[termloc] = '\0';
156-
157 dbus_test_task_print(DBUS_TEST_TASK(process), line);
158 g_free(line);
159 } while (G_IO_IN & g_io_channel_get_buffer_condition(channel));
160@@ -190,7 +210,7 @@
161 argv = g_new0(gchar *, g_list_length(process->priv->parameters) + 2);
162
163 argv[0] = process->priv->executable;
164- int i;
165+ guint i;
166 for (i = 0; i < g_list_length(process->priv->parameters); i++) {
167 argv[i + 1] = (gchar *)g_list_nth(process->priv->parameters, i)->data;
168 }
169@@ -224,13 +244,12 @@
170 g_free(message);
171 }
172
173- GIOChannel * iochan = g_io_channel_unix_new(proc_stdout);
174- g_io_channel_set_buffer_size(iochan, 10 * 1024 * 1024); /* 10 MB should be enough for anyone */
175- process->priv->io_watch = g_io_add_watch(iochan,
176+ process->priv->io_chan = g_io_channel_unix_new(proc_stdout);
177+ g_io_channel_set_buffer_size(process->priv->io_chan, 10 * 1024 * 1024); /* 10 MB should be enough for anyone */
178+ process->priv->io_watch = g_io_add_watch(process->priv->io_chan,
179 G_IO_IN, /* conditions */
180 proc_writes, /* func */
181 process); /* func data */
182- g_io_channel_unref(iochan);
183
184 process->priv->watcher = g_child_watch_add(process->priv->pid, proc_watcher, process);
185
186
187=== modified file 'libdbustest/service.c'
188--- libdbustest/service.c 2012-04-23 03:39:53 +0000
189+++ libdbustest/service.c 2012-10-02 21:09:33 +0000
190@@ -106,7 +106,7 @@
191 }
192
193 static void
194-task_unref (gpointer data, gpointer user_data)
195+task_unref (gpointer data, G_GNUC_UNUSED gpointer user_data)
196 {
197 DbusTestTask * task = DBUS_TEST_TASK(data);
198
199@@ -190,7 +190,7 @@
200 }
201
202 DbusTestService *
203-dbus_test_service_new (const gchar * address)
204+dbus_test_service_new (G_GNUC_UNUSED const gchar * address)
205 {
206 DbusTestService * service = g_object_new(DBUS_TEST_TYPE_SERVICE,
207 NULL);
208@@ -296,7 +296,7 @@
209 }
210
211 static void
212-task_starter (gpointer data, gpointer user_data)
213+task_starter (gpointer data, G_GNUC_UNUSED gpointer user_data)
214 {
215 DbusTestTask * task = DBUS_TEST_TASK(data);
216
217@@ -341,7 +341,7 @@
218 }
219
220 static void
221-dbus_watcher (GPid pid, gint status, gpointer data)
222+dbus_watcher (GPid pid, G_GNUC_UNUSED gint status, gpointer data)
223 {
224 DbusTestService * service = DBUS_TEST_SERVICE(data);
225 g_critical("DBus Daemon exited abruptly!");
226@@ -495,7 +495,7 @@
227 }
228
229 static void
230-task_state_changed (DbusTestTask * task, DbusTestTaskState state, gpointer user_data)
231+task_state_changed (G_GNUC_UNUSED DbusTestTask * task, G_GNUC_UNUSED DbusTestTaskState state, gpointer user_data)
232 {
233 g_return_if_fail(DBUS_TEST_IS_SERVICE(user_data));
234 DbusTestService * service = DBUS_TEST_SERVICE(user_data);
235
236=== modified file 'libdbustest/task.c'
237--- libdbustest/task.c 2012-04-19 15:54:50 +0000
238+++ libdbustest/task.c 2012-10-02 21:09:33 +0000
239@@ -258,7 +258,7 @@
240 }
241
242 static void
243-wait_for_found (GDBusConnection * connection, const gchar * name, const gchar * name_owner, gpointer user_data)
244+wait_for_found (G_GNUC_UNUSED GDBusConnection * connection, G_GNUC_UNUSED const gchar * name, G_GNUC_UNUSED const gchar * name_owner, gpointer user_data)
245 {
246 g_return_if_fail(DBUS_TEST_IS_TASK(user_data));
247 DbusTestTask * task = DBUS_TEST_TASK(user_data);
248
249=== modified file 'src/Makefile.am'
250--- src/Makefile.am 2012-04-17 20:29:51 +0000
251+++ src/Makefile.am 2012-10-02 21:09:33 +0000
252@@ -6,7 +6,7 @@
253 $(COVERAGE_CFLAGS) \
254 -I$(top_srcdir) \
255 -DDEFAULT_SESSION_CONF="\"$(datadir)/dbus-test-runner/session.conf\"" \
256- -Wall -Werror
257+ -Wall -Werror -Wextra
258 dbus_test_runner_LDADD = $(DBUS_TEST_RUNNER_LIBS) \
259 $(top_builddir)/libdbustest/libdbustest.la
260 dbus_test_runner_LDFLAGS = $(COVERAGE_LDFLAGS)
261
262=== modified file 'src/dbus-test-runner.c'
263--- src/dbus-test-runner.c 2012-04-18 21:46:08 +0000
264+++ src/dbus-test-runner.c 2012-10-02 21:09:33 +0000
265@@ -31,7 +31,7 @@
266 #define NAME_SET "dbus-test-runner-name-set"
267
268 static gboolean
269-option_task (const gchar * arg, const gchar * value, gpointer data, GError ** error)
270+option_task (G_GNUC_UNUSED const gchar * arg, const gchar * value, G_GNUC_UNUSED gpointer data, G_GNUC_UNUSED GError ** error)
271 {
272 if (last_task != NULL) {
273 g_object_unref(last_task);
274@@ -44,7 +44,7 @@
275 }
276
277 static gboolean
278-option_taskname (const gchar * arg, const gchar * value, gpointer data, GError ** error)
279+option_taskname (G_GNUC_UNUSED const gchar * arg, const gchar * value, G_GNUC_UNUSED gpointer data, GError ** error)
280 {
281 if (last_task == NULL) {
282 g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, "No task to put the name %s on.", value);
283@@ -62,7 +62,7 @@
284 }
285
286 static gboolean
287-option_noreturn (const gchar * arg, const gchar * value, gpointer data, GError ** error)
288+option_noreturn (G_GNUC_UNUSED const gchar * arg, G_GNUC_UNUSED const gchar * value, G_GNUC_UNUSED gpointer data, GError ** error)
289 {
290 if (last_task == NULL) {
291 g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, "No task to put adjust return on.");
292@@ -79,7 +79,7 @@
293 }
294
295 static gboolean
296-option_invert (const gchar * arg, const gchar * value, gpointer data, GError ** error)
297+option_invert (G_GNUC_UNUSED const gchar * arg, G_GNUC_UNUSED const gchar * value, G_GNUC_UNUSED gpointer data, GError ** error)
298 {
299 if (last_task == NULL) {
300 g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, "No task to put adjust return on.");
301@@ -96,7 +96,7 @@
302 }
303
304 static gboolean
305-option_param (const gchar * arg, const gchar * value, gpointer data, GError ** error)
306+option_param (G_GNUC_UNUSED const gchar * arg, const gchar * value, G_GNUC_UNUSED gpointer data, GError ** error)
307 {
308 if (last_task == NULL) {
309 g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, "No task to put adjust return on.");
310@@ -108,7 +108,7 @@
311 }
312
313 static gboolean
314-option_wait (const gchar * arg, const gchar * value, gpointer data, GError ** error)
315+option_wait (G_GNUC_UNUSED const gchar * arg, const gchar * value, G_GNUC_UNUSED gpointer data, GError ** error)
316 {
317 if (last_task == NULL) {
318 g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, "No task to add a wait on %s for.", value);
319@@ -125,7 +125,7 @@
320 }
321
322 static gboolean
323-max_wait_hit (gpointer user_data)
324+max_wait_hit (G_GNUC_UNUSED gpointer user_data)
325 {
326 g_warning("Timing out at maximum wait of %d seconds.", max_wait);
327 dbus_test_service_stop(service);
328
329=== modified file 'tests/Makefile.am'
330--- tests/Makefile.am 2012-06-21 14:28:38 +0000
331+++ tests/Makefile.am 2012-10-02 21:09:33 +0000
332@@ -147,10 +147,7 @@
333 @chmod +x $@
334 XFAIL_TESTS += test-no-tasks
335
336-# This test is failing on Jenkins for an unknown reason, we're disabiling
337-# to unblock Jenkins. Result tracked in LP: #1010739
338-
339-# TESTS += test-output
340+TESTS += test-output
341 test-output: Makefile.am
342 @echo "#!/bin/sh -e" > $@
343 @echo "$(DBUS_RUNNER) --task cat --parameter \"$(top_srcdir)/src/dbus-test-runner.c\" --task-name \"cat1\" --task cat --parameter \"$(top_srcdir)/src/dbus-test-runner.c\" --task-name \"cat2\" > testcat.output.txt" >> $@
344@@ -173,7 +170,7 @@
345 test-bustle: Makefile.am test-bustle.reference
346 @echo "#!/bin/sh -e" > $@
347 @echo $(DBUS_RUNNER) --bustle-data \"$(builddir)/test-bustle.bustle\" --task $(srcdir)/test-bustle-list.sh >> $@
348- @echo "grep ^mc \"$(builddir)/test-bustle.bustle\" | grep ":1.1" | grep "ListNames" | cut -f 5-9 > test-bustle.filtered" >> $@
349+ @echo "grep ^sig \"$(builddir)/test-bustle.bustle\" | grep ":1.1" | grep "com.launchpad.dbustestrunner" | cut -f 5-9 > test-bustle.filtered" >> $@
350 @echo "diff \"$(srcdir)/test-bustle.reference\" \"$(builddir)/test-bustle.filtered\"" >> $@
351 @chmod +x $@
352 DISTCLEANFILES += test-bustle.bustle test-bustle.filtered
353@@ -216,7 +213,8 @@
354 @echo "--task $(srcdir)/test-bustle-list.sh \\" >> $@
355 @echo "--task $(srcdir)/test-bustle-list.sh \\" >> $@
356 @echo "--task $(srcdir)/test-bustle-list.sh \\" >> $@
357- @echo "--task $(srcdir)/test-bustle-list.sh \\" >> $@
358+ @echo "--task $(srcdir)/test-bustle-list.sh" >> $@
359+ @echo "$(srcdir)/test-bustle-data-check.sh \"$(builddir)/test-bustle-data.bustle\" 12" >> $@
360 @chmod +x $@
361 DISTCLEANFILES += test-bustle-data.bustle
362
363@@ -310,4 +308,5 @@
364 EXTRA_DIST = \
365 delayrm.sh \
366 test-bustle.reference \
367+ test-bustle-data-check.sh \
368 test-bustle-list.sh
369
370=== added file 'tests/test-bustle-data-check.sh'
371--- tests/test-bustle-data-check.sh 1970-01-01 00:00:00 +0000
372+++ tests/test-bustle-data-check.sh 2012-10-02 21:09:33 +0000
373@@ -0,0 +1,3 @@
374+#!/bin/bash -e
375+
376+[ `grep ^sig $1 | grep dbustestrunner | wc -l` -eq $2 ]
377
378=== modified file 'tests/test-bustle-list.sh'
379--- tests/test-bustle-list.sh 2011-01-28 14:58:51 +0000
380+++ tests/test-bustle-list.sh 2012-10-02 21:09:33 +0000
381@@ -1,3 +1,3 @@
382 #!/bin/sh
383 sleep 1
384-dbus-send --session --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
385+gdbus emit --session --object-path /test/dbustestrunner/signal --signal com.launchpad.dbustestrunner.signal
386
387=== modified file 'tests/test-bustle.reference'
388--- tests/test-bustle.reference 2009-12-08 05:22:06 +0000
389+++ tests/test-bustle.reference 2012-10-02 21:09:33 +0000
390@@ -1,1 +1,1 @@
391-:1.1 org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus ListNames
392+:1.1 /test/dbustestrunner/signal com.launchpad.dbustestrunner signal

Subscribers

People subscribed via source and target branches