From 792bab72d98a127a1735c0def5f80fadd2938342 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 5 Mar 2012 12:22:22 +0000 Subject: [PATCH] tests: wait for CONNECTED feature where we used to Commit 2be1aca4e3 caused an intermittent regression in tests/dbus/self-presence.c. The example Connection we use only makes its statuses available when the connection has connected, simulating a CM like Gabble where available statuses are discovered during connection. Previously, we used tp_connection_run_until_ready() which effectively waits for the CONNECTED feature; in that commit, I switched to using tp_tests_proxy_run_until_prepared() which does not, unless you ask for it. As a result, there was a race between Get(..., "Statuses") and the connecting process, leading to intermittent (1/10?) test failures. This commit updates all tests touched by 2be1aca4e3, except for invalidated-while-invoking-signals.c which doesn't actually need to reach the CONNECTED status. --- tests/dbus/channel-manager-request-properties.c | 3 ++- tests/dbus/message-mixin.c | 3 ++- tests/dbus/self-handle.c | 4 +++- tests/dbus/self-presence.c | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/dbus/channel-manager-request-properties.c b/tests/dbus/channel-manager-request-properties.c index ae8079d..6c5705a 100644 --- a/tests/dbus/channel-manager-request-properties.c +++ b/tests/dbus/channel-manager-request-properties.c @@ -41,6 +41,7 @@ setup (Test *test, TpBaseConnection *service_conn_as_base; gboolean ok; gchar *name, *conn_path; + GQuark connected_feature[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 }; g_type_init (); tp_debug_set_flags ("all"); @@ -75,7 +76,7 @@ setup (Test *test, g_assert_no_error (test->error); tp_cli_connection_call_connect (test->conn, -1, NULL, NULL, NULL, NULL); - tp_tests_proxy_run_until_prepared (test->conn, NULL); + tp_tests_proxy_run_until_prepared (test->conn, connected_feature); g_free (name); g_free (conn_path); diff --git a/tests/dbus/message-mixin.c b/tests/dbus/message-mixin.c index abefe04..d918d3c 100644 --- a/tests/dbus/message-mixin.c +++ b/tests/dbus/message-mixin.c @@ -158,6 +158,7 @@ main (int argc, TpHandle handle; gboolean ok; GHashTable *parameters; + GQuark connected_feature[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 }; tp_tests_abort_after (10); g_type_init (); @@ -194,7 +195,7 @@ main (int argc, g_assert_no_error (error); tp_cli_connection_call_connect (conn, -1, NULL, NULL, NULL, NULL); - tp_tests_proxy_run_until_prepared (conn, NULL); + tp_tests_proxy_run_until_prepared (conn, connected_feature); { GHashTable *properties = NULL; diff --git a/tests/dbus/self-handle.c b/tests/dbus/self-handle.c index 9af1a1c..d0d1105 100644 --- a/tests/dbus/self-handle.c +++ b/tests/dbus/self-handle.c @@ -69,10 +69,12 @@ static void setup_and_connect (Fixture *f, gconstpointer unused G_GNUC_UNUSED) { + GQuark connected_feature[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 }; + setup (f, unused); tp_cli_connection_call_connect (f->client_conn, -1, NULL, NULL, NULL, NULL); - tp_tests_proxy_run_until_prepared (f->client_conn, NULL); + tp_tests_proxy_run_until_prepared (f->client_conn, connected_feature); } /* we'll get more arguments, but just ignore them */ diff --git a/tests/dbus/self-presence.c b/tests/dbus/self-presence.c index 5ef7dfe..c448394 100644 --- a/tests/dbus/self-presence.c +++ b/tests/dbus/self-presence.c @@ -128,6 +128,7 @@ main (int argc, guint status; gchar **interfaces; GValue *value = NULL; + GQuark connected_feature[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 }; /* Setup */ @@ -181,7 +182,7 @@ main (int argc, g_free (value); tp_cli_connection_call_connect (client_conn, -1, NULL, NULL, NULL, NULL); - tp_tests_proxy_run_until_prepared (client_conn, NULL); + tp_tests_proxy_run_until_prepared (client_conn, connected_feature); /* Tests */ -- 1.7.9.1