diff options
-rw-r--r-- | src/platform/tests/test-common.c | 13 | ||||
-rw-r--r-- | src/platform/tests/test-common.h | 4 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c index 98280b4527..5e2e819988 100644 --- a/src/platform/tests/test-common.c +++ b/src/platform/tests/test-common.c @@ -367,13 +367,13 @@ nmtstp_wait_for_signal_until (gint64 until_ms) } const NMPlatformLink * -nmtstp_wait_for_link (const char *ifname, guint timeout_ms) +nmtstp_wait_for_link (const char *ifname, NMLinkType expected_link_type, guint timeout_ms) { - return nmtstp_wait_for_link_until (ifname, nm_utils_get_monotonic_timestamp_ms () + timeout_ms); + return nmtstp_wait_for_link_until (ifname, expected_link_type, nm_utils_get_monotonic_timestamp_ms () + timeout_ms); } const NMPlatformLink * -nmtstp_wait_for_link_until (const char *ifname, gint64 until_ms) +nmtstp_wait_for_link_until (const char *ifname, NMLinkType expected_link_type, gint64 until_ms) { const NMPlatformLink *plink; gint64 now; @@ -382,7 +382,8 @@ nmtstp_wait_for_link_until (const char *ifname, gint64 until_ms) now = nm_utils_get_monotonic_timestamp_ms (); plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, ifname); - if (plink) + if ( plink + && (expected_link_type == NM_LINK_TYPE_NONE || plink->type == expected_link_type)) return plink; if (until_ms < now) @@ -403,10 +404,8 @@ nmtstp_assert_wait_for_link_until (const char *ifname, NMLinkType expected_link_ { const NMPlatformLink *plink; - plink = nmtstp_wait_for_link_until (ifname, until_ms); + plink = nmtstp_wait_for_link_until (ifname, expected_link_type, until_ms); g_assert (plink); - if (expected_link_type != NM_LINK_TYPE_NONE) - g_assert_cmpint (plink->type, ==, expected_link_type); return plink; } diff --git a/src/platform/tests/test-common.h b/src/platform/tests/test-common.h index a2794af7e3..fbcb7bea2d 100644 --- a/src/platform/tests/test-common.h +++ b/src/platform/tests/test-common.h @@ -75,8 +75,8 @@ int nmtstp_run_command (const char *format, ...) __attribute__((__format__ (__pr gboolean nmtstp_wait_for_signal (guint timeout_ms); gboolean nmtstp_wait_for_signal_until (gint64 until_ms); -const NMPlatformLink *nmtstp_wait_for_link (const char *ifname, guint timeout_ms); -const NMPlatformLink *nmtstp_wait_for_link_until (const char *ifname, gint64 until_ms); +const NMPlatformLink *nmtstp_wait_for_link (const char *ifname, NMLinkType expected_link_type, guint timeout_ms); +const NMPlatformLink *nmtstp_wait_for_link_until (const char *ifname, NMLinkType expected_link_type, gint64 until_ms); const NMPlatformLink *nmtstp_assert_wait_for_link (const char *ifname, NMLinkType expected_link_type, guint timeout_ms); const NMPlatformLink *nmtstp_assert_wait_for_link_until (const char *ifname, NMLinkType expected_link_type, gint64 until_ms); |