diff options
author | Dan Williams <dcbw@redhat.com> | 2014-08-09 22:19:50 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-08-18 16:57:14 -0500 |
commit | 34a25aeae0963f4dd68c1857c417c6cec2cb958c (patch) | |
tree | d8b79b374b2029a78f9060a68de0946e71c4ccf8 | |
parent | 26063c3af4a0654b99fcc259ac44c066bc77dde8 (diff) | |
download | NetworkManager-34a25aeae0963f4dd68c1857c417c6cec2cb958c.tar.gz |
fixup! ibft: add settings plugin for reading iBFT configuration (bgo #734009)
-rw-r--r-- | include/nm-test-utils.h | 12 | ||||
-rw-r--r-- | src/settings/plugins/ibft/tests/test-ibft.c | 6 |
2 files changed, 15 insertions, 3 deletions
diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index 036a1bec63..4bf4cde41d 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -946,4 +946,16 @@ nmtst_assert_ip4_address_equals (guint32 addr, const char *expected, const char #define nmtst_assert_ip4_address_equals(addr, expected) \ nmtst_assert_ip4_address_equals (addr, expected, G_STRLOC) +static inline void +nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const char *expected, const char *loc) +{ + if (!nm_utils_hwaddr_matches (hwaddr1, hwaddr1_len, expected, -1)) { + g_error ("assert: %s: hwaddr '%s' expected, but got %s", + loc, expected ? expected : "any", + nm_utils_hwaddr_ntoa (hwaddr1, hwaddr1_len)); + } +} +#define nmtst_assert_hwaddr_equals(hwaddr1, hwaddr1_len, expected) \ + nmtst_assert_hwaddr_equals (hwaddr1, hwaddr1_len, expected, G_STRLOC) + #endif /* __NM_TEST_UTILS_H__ */ diff --git a/src/settings/plugins/ibft/tests/test-ibft.c b/src/settings/plugins/ibft/tests/test-ibft.c index a2fcce4547..45c8d1f697 100644 --- a/src/settings/plugins/ibft/tests/test-ibft.c +++ b/src/settings/plugins/ibft/tests/test-ibft.c @@ -105,7 +105,7 @@ test_read_ibft_dhcp (void) g_assert (s_wired); array = nm_setting_wired_get_mac_address (s_wired); g_assert (array); - g_assert (nm_utils_hwaddr_matches (array->data, array->len, expected_mac_address, -1)); + nmtst_assert_hwaddr_equals (array->data, array->len, expected_mac_address); g_assert_cmpint (nm_setting_wired_get_mtu (s_wired), ==, 0); /* ===== IPv4 SETTING ===== */ @@ -151,7 +151,7 @@ test_read_ibft_static (void) g_assert (s_wired); array = nm_setting_wired_get_mac_address (s_wired); g_assert (array); - g_assert (nm_utils_hwaddr_matches (array->data, array->len, expected_mac_address, -1)); + nmtst_assert_hwaddr_equals (array->data, array->len, expected_mac_address); g_assert_cmpint (nm_setting_wired_get_mtu (s_wired), ==, 0); /* ===== IPv4 SETTING ===== */ @@ -245,7 +245,7 @@ test_read_ibft_vlan (void) g_assert (s_wired); array = nm_setting_wired_get_mac_address (s_wired); g_assert (array); - g_assert (nm_utils_hwaddr_matches (array->data, array->len, expected_mac_address, -1)); + nmtst_assert_hwaddr_equals (array->data, array->len, expected_mac_address); /* ===== VLAN SETTING ===== */ s_vlan = nm_connection_get_setting_vlan (connection); |