summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-07-03 13:59:44 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-07-21 16:52:23 +0100
commit27a6538d5bf1f41bb60b039a95a1b1b98728559f (patch)
tree22972d8bfffed50ef46dc920b4057a2486e63e5a
parentd9ee040d0bff2b421bca80c2339dcd9347d906db (diff)
Add test-case for the same situation as fd.o #90952
This does not directly test the code in the previous commit, but it does confirm that calling dbus_connection_set_route_peer_messages() is enough to fix the observed bug. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> [smcv: re-worded commit message in response to review]
-rw-r--r--test/monitor.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/monitor.c b/test/monitor.c
index 6c77babc..c099139a 100644
--- a/test/monitor.c
+++ b/test/monitor.c
@@ -454,6 +454,8 @@ become_monitor (Fixture *f)
int i;
dbus_uint32_t zero = 0;
+ dbus_connection_set_route_peer_messages (f->monitor, TRUE);
+
if (f->config != NULL && f->config->match_rules != NULL)
match_rules = f->config->match_rules;
else
@@ -928,6 +930,28 @@ test_method_call (Fixture *f,
become_monitor (f);
+ /* regression test for
+ * https://bugs.freedesktop.org/show_bug.cgi?id=90952 */
+ m = dbus_message_new_method_call (f->recipient_name, "/foo",
+ DBUS_INTERFACE_PEER, "Ping");
+ dbus_connection_send (f->sender, m, NULL);
+ dbus_message_unref (m);
+
+ while (g_queue_get_length (&f->monitored) < 2)
+ test_main_context_iterate (f->ctx, TRUE);
+
+ m = g_queue_pop_head (&f->monitored);
+ assert_method_call (m, f->sender_name, f->recipient_name, "/foo",
+ DBUS_INTERFACE_PEER, "Ping", "");
+ dbus_message_unref (m);
+
+ m = g_queue_pop_head (&f->monitored);
+ assert_method_reply (m, f->recipient_name, f->sender_name, "");
+ dbus_message_unref (m);
+
+ m = g_queue_pop_head (&f->monitored);
+ g_assert (m == NULL);
+
m = dbus_message_new_method_call (f->recipient_name, "/foo", "com.example.bar",
"Call1");
dbus_connection_send (f->sender, m, NULL);