mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
tests: Remove explicit timeout handler from gdbus-auth tests
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 <pwithnall@endlessos.org>
This commit is contained in:
parent
642ee744b8
commit
764f8426d4
@ -111,15 +111,6 @@ test_auth_on_new_connection (GDBusServer *server,
|
|||||||
return FALSE;
|
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
|
typedef struct
|
||||||
{
|
{
|
||||||
const gchar *address;
|
const gchar *address;
|
||||||
@ -162,7 +153,6 @@ test_auth_mechanism (const gchar *allowed_client_mechanism,
|
|||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GThread *client_thread;
|
GThread *client_thread;
|
||||||
TestAuthData data;
|
TestAuthData data;
|
||||||
guint timeout_id;
|
|
||||||
|
|
||||||
server = server_new_for_mechanism (allowed_server_mechanism);
|
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),
|
G_CALLBACK (test_auth_on_new_connection),
|
||||||
loop);
|
loop);
|
||||||
|
|
||||||
timeout_id = g_timeout_add_seconds (5, test_auth_on_timeout, NULL);
|
|
||||||
|
|
||||||
data.allowed_client_mechanism = allowed_client_mechanism;
|
data.allowed_client_mechanism = allowed_client_mechanism;
|
||||||
data.allowed_server_mechanism = allowed_server_mechanism;
|
data.allowed_server_mechanism = allowed_server_mechanism;
|
||||||
data.address = g_dbus_server_get_client_address (server);
|
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",
|
client_thread = g_thread_new ("gdbus-client-thread",
|
||||||
test_auth_client_thread_func,
|
test_auth_client_thread_func,
|
||||||
&data);
|
&data);
|
||||||
@ -191,7 +180,6 @@ test_auth_mechanism (const gchar *allowed_client_mechanism,
|
|||||||
g_dbus_server_stop (server);
|
g_dbus_server_stop (server);
|
||||||
|
|
||||||
g_thread_join (client_thread);
|
g_thread_join (client_thread);
|
||||||
g_source_remove (timeout_id);
|
|
||||||
|
|
||||||
while (g_main_context_iteration (NULL, FALSE));
|
while (g_main_context_iteration (NULL, FALSE));
|
||||||
g_main_loop_unref (loop);
|
g_main_loop_unref (loop);
|
||||||
|
Loading…
Reference in New Issue
Block a user