diff options
author | Thomas Haller <thaller@redhat.com> | 2018-06-20 14:11:15 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-11-30 11:56:21 +0100 |
commit | 8cabe9335c439f174980b772ee867df813e130d5 (patch) | |
tree | 58b960eebaaf1952f28161b8f1092c322eb153d4 | |
parent | e8b1a2613e538fbfcd30ceb46a6744893214a474 (diff) | |
download | NetworkManager-8cabe9335c439f174980b772ee867df813e130d5.tar.gz |
platform/tests: fix race in tests
Otherwise, we easily get a failure
test:ERROR:src/platform/tests/test-cleanup.c:78:test_cleanup_internal: assertion failed (addresses6->len == 2): (1 == 2)
Avoid that by waiting for kernel to add the link-local
address.
(cherry picked from commit fb63d8d7068e6c1575b255dc2a962c5bcc1036cf)
(cherry picked from commit b6ff26fb2fb5af77b338718f7902ecf551f73beb)
(cherry picked from commit 1de5f1a73df0483564f87ca75b266ab58a5c261a)
-rw-r--r-- | src/platform/tests/test-cleanup.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c index 71a92cbfae..2e95928a52 100644 --- a/src/platform/tests/test-cleanup.c +++ b/src/platform/tests/test-cleanup.c @@ -62,6 +62,22 @@ test_cleanup_internal (void) ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME); g_assert (ifindex > 0); + /* wait for kernel to add the IPv6 link local address... it takes a bit. */ + NMTST_WAIT_ASSERT (100, { + gs_unref_array GArray *addrs = NULL; + const NMPlatformIP6Address *a; + + if (nmtst_wait_iteration > 0) { + nmtstp_wait_for_signal (NM_PLATFORM_GET, nmtst_wait_remaining_us / 1000); + nm_platform_process_events (NM_PLATFORM_GET); + } + addrs = nm_platform_ip6_address_get_all (NM_PLATFORM_GET, ifindex); + if ( addrs->len == 1 + && (a = &g_array_index (addrs, NMPlatformIP6Address, 0)) + && IN6_IS_ADDR_LINKLOCAL (&a->address)) + break; + }); + /* Add routes and addresses */ g_assert (nm_platform_ip4_address_add (NM_PLATFORM_GET, ifindex, addr4, plen4, addr4, lifetime, preferred, 0, NULL)); g_assert (nm_platform_ip6_address_add (NM_PLATFORM_GET, ifindex, addr6, plen6, in6addr_any, lifetime, preferred, flags)); |