From 7990add49328dcc9cf86fda2f83deaa2bcc8f759 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 19 Dec 2014 12:46:03 +0100 Subject: [PATCH] libnm/tests: fix build failure on big-endian machines `make check` fails: make check-TESTS make[4]: Entering directory `/builddir/build/BUILD/NetworkManager-1.1.0/libnm-core/tests' ... /core/general/test_setting_802_1x_changed_signal: OK /core/general/test_setting_ip4_gateway: ** ERROR:test-general.c:3652:test_setting_ip4_gateway: assertion failed (nm_setting_ip_config_get_gateway (s_ip4) == "192.168.1.1"): ("1.1.168.192" == "192.168.1.1") /bin/sh: line 5: 44957 Aborted (core dumped) ${dir}$tst --- libnm-core/tests/test-general.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 44dc277d16..97c9b2f6f3 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -3560,11 +3560,13 @@ test_setting_ip4_gateway (void) GVariant *conn_dict, *ip4_dict, *value; GVariantIter iter; GVariant *addr_var; - guint32 addr_vals_0[] = { 0x0a01a8c0, 0x00000018, 0x00000000 }; - guint32 addr_vals_1[] = { 0x0b01a8c0, 0x00000018, 0x0101a8c0 }; + guint32 addr_vals_0[] = { htonl (0xc0a8010a), 0x00000018, htonl (0x00000000) }; + guint32 addr_vals_1[] = { htonl (0xc0a8010b), 0x00000018, htonl (0xc0a80101) }; GVariantBuilder addrs_builder; GError *error = NULL; + g_assert_cmpstr (nm_utils_inet4_ntop (addr_vals_0[0], NULL), ==, "192.168.1.10"); + /* When serializing on the daemon side, ipv4.gateway is copied to the first * entry of ipv4.addresses */