← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/dbus-test-runner/mass-bustling into lp:dbus-test-runner

 

Ted Gould has proposed merging lp:~ted/dbus-test-runner/mass-bustling into lp:dbus-test-runner.

    Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)


Fixes a bug where when enough bustle data accumulates it caused dbus-test-runner to hang.  Also added a test to generate enough data that it can be checked.
-- 
https://code.launchpad.net/~ted/dbus-test-runner/mass-bustling/+merge/15911
Your team ayatana-commits is subscribed to branch lp:dbus-test-runner.
=== modified file 'src/dbus-test-runner.c'
--- src/dbus-test-runner.c	2009-12-08 05:26:05 +0000
+++ src/dbus-test-runner.c	2009-12-10 02:37:10 +0000
@@ -66,34 +66,27 @@
 static gboolean
 bustle_writes (GIOChannel * channel, GIOCondition condition, gpointer data)
 {
-	g_debug("Bustle write");
 	gchar * line;
 	gsize termloc;
 
-	do {
-		GIOStatus status = g_io_channel_read_line (channel, &line, NULL, &termloc, NULL);
-
-		if (status == G_IO_STATUS_EOF) {
-			continue;
-		}
-
-		if (status != G_IO_STATUS_NORMAL) {
-			continue;
-		}
-
-		g_io_channel_write_chars((GIOChannel *)data,
-		                         line,
-		                         termloc,
-		                         NULL,
-		                         NULL);
-		g_io_channel_write_chars((GIOChannel *)data,
-		                         "\n",
-		                         1,
-		                         NULL,
-		                         NULL);
-
-		g_free(line);
-	} while ((G_IO_IN | G_IO_PRI) & g_io_channel_get_buffer_condition(channel));
+	GIOStatus status = g_io_channel_read_line (channel, &line, NULL, &termloc, NULL);
+
+	if (status != G_IO_STATUS_NORMAL) {
+		return FALSE;
+	}
+
+	g_io_channel_write_chars((GIOChannel *)data,
+							 line,
+							 termloc,
+							 NULL,
+							 NULL);
+	g_io_channel_write_chars((GIOChannel *)data,
+							 "\n",
+							 1,
+							 NULL,
+							 NULL);
+
+	g_free(line);
 
 	return TRUE;
 }

=== modified file 'tests/Makefile.am'
--- tests/Makefile.am	2009-12-08 05:22:06 +0000
+++ tests/Makefile.am	2009-12-10 02:37:10 +0000
@@ -73,6 +73,24 @@
 	@chmod +x $@
 DISTCLEANFILES += test-bustle.bustle test-bustle.filtered
 
+TESTS += test-bustle-data
+test-bustle-data: Makefile.am
+	@echo "#!/bin/sh -e" > $@
+	@echo "$(DBUS_RUNNER) --bustle-data \"$(builddir)/test-bustle-data.bustle\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@echo "--task dbus-send -p \"--session\" -p \"--print-reply\" -p \"--dest=org.freedesktop.DBus\" -p \"/org/freedesktop/DBus\" -p \"org.freedesktop.DBus.ListNames\" \\" >> $@
+	@chmod +x $@
+DISTCLEANFILES += test-bustle-data.bustle
+
 
 EXTRA_DIST = \
 	delayrm.sh \


Follow ups