nmtst: don't use G_STRLOC in test functions

Instead pass separate values for file and line. Otherwise, we create
a unique string for each occurance.
This commit is contained in:
Thomas Haller 2016-02-03 13:34:38 +01:00
parent 123747963a
commit 9fda0817ab

View file

@ -1578,7 +1578,7 @@ nmtst_assert_setting_verify_fails (NMSetting *setting,
#ifdef __NM_UTILS_H__
static inline void
nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const char *expected, const char *loc)
nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const char *expected, const char *file, int line)
{
guint8 buf2[NM_UTILS_HWADDR_LEN_MAX];
gsize hwaddr2_len = 1;
@ -1603,12 +1603,12 @@ nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const cha
if (success)
success = !memcmp (hwaddr1, buf2, hwaddr1_len);
if (!success) {
g_error ("assert: %s: hwaddr '%s' (%zd) expected, but got %s (%zd)",
loc, expected, hwaddr2_len, nm_utils_hwaddr_ntoa (hwaddr1, hwaddr1_len), hwaddr1_len);
g_error ("assert: %s:%d: hwaddr '%s' (%zd) expected, but got %s (%zd)",
file, line, expected, hwaddr2_len, nm_utils_hwaddr_ntoa (hwaddr1, hwaddr1_len), hwaddr1_len);
}
}
#define nmtst_assert_hwaddr_equals(hwaddr1, hwaddr1_len, expected) \
nmtst_assert_hwaddr_equals (hwaddr1, hwaddr1_len, expected, G_STRLOC)
nmtst_assert_hwaddr_equals (hwaddr1, hwaddr1_len, expected, __FILE__, __LINE__)
#endif
#if defined(__NM_SIMPLE_CONNECTION_H__) && defined(__NM_SETTING_CONNECTION_H__) && defined(__NM_KEYFILE_INTERNAL_H__)