summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-02 12:58:29 +0100
committerThomas Haller <thaller@redhat.com>2021-06-10 15:46:00 +0200
commitb4302981330995ef18f617df1d63a0d348760de8 (patch)
tree53982e2a3dffa7ed15999edaa692af02fe48ff56
parentfa82b663272067cb5174707379fbd4da31067ad3 (diff)
downloadNetworkManager-b4302981330995ef18f617df1d63a0d348760de8.tar.gz
tests: avoid race condition in nmtstc_service_cleanup()
It seems it can happen that the service is not yet unregistered from the D-Bus broker, even if we already reaped the PID. /builds/NetworkManager/NetworkManager/tools/run-nm-test.sh --called-from-make /builds/NetworkManager/NetworkManager/build --launch-dbus=auto /builds/NetworkManager/NetworkManager/build/libnm/tests/test-nm-client --- stdout --- /libnm/device-added: nmtst: initialize nmtst_get_rand() with NMTST_SEED_RAND=0 --- stderr --- ** test:ERROR:../shared/nm-test-utils-impl.c:216:nmtstc_service_cleanup: assertion failed: (!name_exists(info->bus, "org.freedesktop.NetworkManager")) Workaround by waiting a bit. We now iterate the main GMainContext, unlike before. But that should not cause any problems for the test. (cherry picked from commit 1b8ccacc5da943f6c460d06f42cceb00f390b2b0) (cherry picked from commit d10d14d7ba2bfc404e3862277fcc47f10b84255f) (cherry picked from commit d34e6193da7ec23da9c254c821ec8b4583c65be1)
-rw-r--r--shared/nm-test-utils-impl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/shared/nm-test-utils-impl.c b/shared/nm-test-utils-impl.c
index ce7cc8d179..5fbb701812 100644
--- a/shared/nm-test-utils-impl.c
+++ b/shared/nm-test-utils-impl.c
@@ -205,7 +205,10 @@ again_wait:
g_assert (ret == info->pid);
}
- g_assert (!name_exists (info->bus, "org.freedesktop.NetworkManager"));
+ nmtst_main_context_iterate_until_assert_full (NULL,
+ 1000,
+ 80,
+ (!name_exists (info->bus, "org.freedesktop.NetworkManager")));
g_clear_object (&info->bus);