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 90bb46c8ee)
This commit is contained in:
Thomas Haller 2020-01-04 08:57:47 +01:00
parent 8673206f82
commit 68800febf1
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 8 additions and 8 deletions

View file

@ -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) {

View file

@ -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);
}

View file

@ -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); \