diff options
author | Thomas Haller <thaller@redhat.com> | 2015-11-24 15:56:06 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-11-27 14:22:06 +0100 |
commit | d72fe89899f9b0d116b10c12c3814be75fe37857 (patch) | |
tree | 3c2f63c3bb11ea0fb7d1e51c05623fafa81fd8b4 | |
parent | f122879c83096ef7d045292787238b0e6d1db3a6 (diff) | |
download | NetworkManager-d72fe89899f9b0d116b10c12c3814be75fe37857.tar.gz |
platform/tests: add @expected_link_type to nmtstp_wait_for_link()
-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); |