From 68800febf16a09051dd800b14f6fd4cf38347ad8 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 4 Jan 2020 08:57:47 +0100 Subject: [PATCH] shared/tests/trivial: rename nmtst_main_context_iterate_until() to nmtst_main_context_iterate_until_assert() nmtst_main_context_iterate_until*() iterates until the condition is satisfied. If that doesn't happen within timeout, it fails an assertion. Rename the function to make that clearer. (cherry picked from commit 90bb46c8ee9a25eaf541914f3e719285fbacb9e9) --- libnm-core/tests/test-general.c | 2 +- libnm/tests/test-remote-settings-client.c | 12 ++++++------ shared/nm-utils/nm-test-utils.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 05c484d59e..d6e03fe8c0 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -8269,7 +8269,7 @@ test_integrate_maincontext (gconstpointer test_data) g_source_set_callback (idle_source_1, _test_integrate_maincontext_cb_idle1, &count, NULL); g_source_attach (idle_source_1, c2); - nmtst_main_context_iterate_until (c1, 2000, count == 5); + nmtst_main_context_iterate_until_assert (c1, 2000, count == 5); } if (TEST_IDX == 2) { diff --git a/libnm/tests/test-remote-settings-client.c b/libnm/tests/test-remote-settings-client.c index 8483eca838..396684703a 100644 --- a/libnm/tests/test-remote-settings-client.c +++ b/libnm/tests/test-remote-settings-client.c @@ -62,7 +62,7 @@ test_add_connection (void) add_cb, &done); - nmtst_main_context_iterate_until (NULL, 5000, done); + nmtst_main_context_iterate_until_assert (NULL, 5000, done); g_assert (gl.remote != NULL); @@ -151,7 +151,7 @@ test_make_invisible (void) set_visible_cb, NULL); /* Wait for the connection to be removed */ - nmtst_main_context_iterate_until (NULL, 5000, visible_changed && connection_removed); + nmtst_main_context_iterate_until_assert (NULL, 5000, visible_changed && connection_removed); g_signal_handlers_disconnect_by_func (gl.remote, G_CALLBACK (visible_changed_cb), &visible_changed); g_signal_handlers_disconnect_by_func (gl.client, G_CALLBACK (connection_removed_cb), &connection_removed); @@ -225,7 +225,7 @@ test_make_visible (void) set_visible_cb, NULL); /* Wait for the settings service to announce the connection again */ - nmtst_main_context_iterate_until (NULL, 5000, new); + nmtst_main_context_iterate_until_assert (NULL, 5000, new); /* Ensure the new connection is the same as the one we made visible again */ g_assert (new == gl.remote); @@ -313,7 +313,7 @@ test_remove_connection (void) NULL, deleted_cb, NULL); - nmtst_main_context_iterate_until (NULL, 5000, done && !gl.remote); + nmtst_main_context_iterate_until_assert (NULL, 5000, done && !gl.remote); /* Ensure NMClient no longer has the connection */ conns = nm_client_get_connections (gl.client); @@ -378,7 +378,7 @@ test_add_remove_connection (void) add_remove_cb, &done); - nmtst_main_context_iterate_until (NULL, 5000, done); + nmtst_main_context_iterate_until_assert (NULL, 5000, done); } /*****************************************************************************/ @@ -417,7 +417,7 @@ test_add_bad_connection (void) &done); g_clear_object (&connection); - nmtst_main_context_iterate_until (NULL, 5000, done); + nmtst_main_context_iterate_until_assert (NULL, 5000, done); g_assert (gl.remote == NULL); } diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h index b4dd1b1965..bcd8fb6a66 100644 --- a/shared/nm-utils/nm-test-utils.h +++ b/shared/nm-utils/nm-test-utils.h @@ -1030,7 +1030,7 @@ _nmtst_main_loop_quit_on_notify (GObject *object, GParamSpec *pspec, gpointer us } #define nmtst_main_loop_quit_on_notify ((GCallback) _nmtst_main_loop_quit_on_notify) -#define nmtst_main_context_iterate_until(context, timeout_msec, condition) \ +#define nmtst_main_context_iterate_until_assert(context, timeout_msec, condition) \ G_STMT_START { \ nm_auto_destroy_and_unref_gsource GSource *_source = NULL; \ GMainContext *_context = (context); \