From 764f8426d46b280a76633fb13f321aac6947a22d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 13 Mar 2023 11:21:17 +0000 Subject: [PATCH] tests: Remove explicit timeout handler from gdbus-auth tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The timeout runs for the entire duration of the test, which is a function that Meson’s test harness already provides for us. Meson’s timeout can be easily adjusted by a factor to allow for running tests more slowly under valgrind. The timeout in the code cannot, which leads to spurious failures like https://gitlab.gnome.org/GNOME/glib/-/jobs/2645271. Signed-off-by: Philip Withnall --- gio/tests/gdbus-auth.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/gio/tests/gdbus-auth.c b/gio/tests/gdbus-auth.c index 353de5346..657571be3 100644 --- a/gio/tests/gdbus-auth.c +++ b/gio/tests/gdbus-auth.c @@ -111,15 +111,6 @@ test_auth_on_new_connection (GDBusServer *server, return FALSE; } -static gboolean -test_auth_on_timeout (gpointer user_data) -{ - g_error ("Timeout waiting for client"); - g_assert_not_reached (); - return G_SOURCE_REMOVE; -} - - typedef struct { const gchar *address; @@ -162,7 +153,6 @@ test_auth_mechanism (const gchar *allowed_client_mechanism, GMainLoop *loop; GThread *client_thread; TestAuthData data; - guint timeout_id; server = server_new_for_mechanism (allowed_server_mechanism); @@ -173,13 +163,12 @@ test_auth_mechanism (const gchar *allowed_client_mechanism, G_CALLBACK (test_auth_on_new_connection), loop); - timeout_id = g_timeout_add_seconds (5, test_auth_on_timeout, NULL); - data.allowed_client_mechanism = allowed_client_mechanism; data.allowed_server_mechanism = allowed_server_mechanism; data.address = g_dbus_server_get_client_address (server); - /* run the D-Bus client in a thread */ + /* Run the D-Bus client in a thread. If this hangs forever, the test harness + * (typically Meson) will eventually kill the test. */ client_thread = g_thread_new ("gdbus-client-thread", test_auth_client_thread_func, &data); @@ -191,7 +180,6 @@ test_auth_mechanism (const gchar *allowed_client_mechanism, g_dbus_server_stop (server); g_thread_join (client_thread); - g_source_remove (timeout_id); while (g_main_context_iteration (NULL, FALSE)); g_main_loop_unref (loop);