mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 04:18:07 +02:00
platform/tests: implement nmtstp_assert_wait_for_link() as macro
Implement nmtstp_assert_wait_for_link() and nmtstp_assert_wait_for_link_until() as macros, based on nmtst_assert_nonnull(). This way, the assertion will report a more helpful file:line location, instead of being somewhere nested inside test-common.c.
This commit is contained in:
parent
770015f512
commit
dd2f5cf3d4
2 changed files with 5 additions and 18 deletions
|
|
@ -654,22 +654,6 @@ nmtstp_wait_for_link_until (NMPlatform *platform, const char *ifname, NMLinkType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const NMPlatformLink *
|
|
||||||
nmtstp_assert_wait_for_link (NMPlatform *platform, const char *ifname, NMLinkType expected_link_type, guint timeout_ms)
|
|
||||||
{
|
|
||||||
return nmtstp_assert_wait_for_link_until (platform, ifname, expected_link_type, nm_utils_get_monotonic_timestamp_ms () + timeout_ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
const NMPlatformLink *
|
|
||||||
nmtstp_assert_wait_for_link_until (NMPlatform *platform, const char *ifname, NMLinkType expected_link_type, gint64 until_ms)
|
|
||||||
{
|
|
||||||
const NMPlatformLink *plink;
|
|
||||||
|
|
||||||
plink = nmtstp_wait_for_link_until (platform, ifname, expected_link_type, until_ms);
|
|
||||||
g_assert (plink);
|
|
||||||
return plink;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,11 @@ const NMPlatformLink *nmtstp_wait_for_link_until (NMPlatform *platform, const ch
|
||||||
g_assert_not_reached (); \
|
g_assert_not_reached (); \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
const NMPlatformLink *nmtstp_assert_wait_for_link (NMPlatform *platform, const char *ifname, NMLinkType expected_link_type, guint timeout_ms);
|
#define nmtstp_assert_wait_for_link(platform, ifname, expected_link_type, timeout_ms) \
|
||||||
const NMPlatformLink *nmtstp_assert_wait_for_link_until (NMPlatform *platform, const char *ifname, NMLinkType expected_link_type, gint64 until_ms);
|
nmtst_assert_nonnull (nmtstp_wait_for_link (platform, ifname, expected_link_type, timeout_ms))
|
||||||
|
|
||||||
|
#define nmtstp_assert_wait_for_link_until(platform, ifname, expected_link_type, until_ms) \
|
||||||
|
nmtst_assert_nonnull (nmtstp_wait_for_link_until (platform, ifname, expected_link_type, until_ms))
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue