summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-01-04 08:57:47 +0100
committerThomas Haller <thaller@redhat.com>2020-01-28 10:54:14 +0100
commit90bb46c8ee9a25eaf541914f3e719285fbacb9e9 (patch)
tree48b724a80268b38215f18cad2235302b9e15589a
parenteceaa39a1efd33e3bdf14fe04624245d591f6582 (diff)
downloadNetworkManager-90bb46c8ee9a25eaf541914f3e719285fbacb9e9.tar.gz
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.
-rw-r--r--libnm-core/tests/test-general.c2
-rw-r--r--libnm/tests/test-remote-settings-client.c12
-rw-r--r--shared/nm-utils/nm-test-utils.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index 1bdaf5bd62..9ea3079e83 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -8270,7 +8270,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 429eecb235..f8771a988e 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 38eddd975b..86dc9f9e56 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); \