summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shared/nm-test-utils.h274
-rw-r--r--src/Makefile.am1
-rw-r--r--src/devices/tests/test-lldp.c2
-rw-r--r--src/devices/wifi/tests/test-wifi-ap-utils.c2
-rw-r--r--src/dhcp-manager/tests/test-dhcp-dhclient.c2
-rw-r--r--src/dhcp-manager/tests/test-dhcp-utils.c2
-rw-r--r--src/dnsmasq-manager/tests/test-dnsmasq-utils.c2
-rw-r--r--src/nm-test-utils-core.h296
-rw-r--r--src/platform/nm-fake-platform.c2
-rw-r--r--src/platform/tests/monitor.c2
-rw-r--r--src/platform/tests/test-common.h2
-rw-r--r--src/platform/tests/test-general.c2
-rw-r--r--src/platform/tests/test-link.c2
-rw-r--r--src/platform/tests/test-nmp-object.c2
-rw-r--r--src/rdisc/tests/test-rdisc-fake.c2
-rw-r--r--src/rdisc/tests/test-rdisc-linux.c2
-rw-r--r--src/settings/plugins/ibft/tests/test-ibft.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c2
-rw-r--r--src/settings/plugins/ifnet/tests/test-ifnet.c2
-rw-r--r--src/settings/plugins/ifupdown/tests/test-ifupdown.c2
-rw-r--r--src/settings/plugins/keyfile/tests/test-keyfile.c2
-rw-r--r--src/supplicant-manager/tests/test-supplicant-config.c2
-rw-r--r--src/tests/config/test-config.c2
-rw-r--r--src/tests/test-dcb.c2
-rw-r--r--src/tests/test-general-with-expect.c2
-rw-r--r--src/tests/test-general.c2
-rw-r--r--src/tests/test-ip4-config.c2
-rw-r--r--src/tests/test-ip6-config.c2
-rw-r--r--src/tests/test-resolvconf-capture.c2
-rw-r--r--src/tests/test-systemd.c2
-rw-r--r--src/tests/test-utils.c2
-rw-r--r--src/tests/test-wired-defname.c2
33 files changed, 330 insertions, 301 deletions
diff --git a/shared/nm-test-utils.h b/shared/nm-test-utils.h
index 0875518cdd..ad3cad650f 100644
--- a/shared/nm-test-utils.h
+++ b/shared/nm-test-utils.h
@@ -101,13 +101,6 @@
#include "nm-utils.h"
-#ifdef __NETWORKMANAGER_LOGGING_H__
-/* We are running tests under src/. Let's include some files by default.
- * They are useful, and affect how nm-test-utils.h itself behaves. */
-#include "NetworkManagerUtils.h"
-#include "nm-keyfile-internal.h"
-#endif
-
/*******************************************************************************/
/* general purpose functions that have no dependency on other nmtst functions */
@@ -510,7 +503,7 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
if (!__nmtst_internal.assert_logging) {
gboolean success = TRUE;
-#ifdef __NETWORKMANAGER_LOGGING_H__
+#ifdef _NMTST_INSIDE_CORE
success = nm_logging_setup (log_level, log_domains, NULL, NULL);
*out_set_logging = TRUE;
#endif
@@ -527,7 +520,7 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
* This transforms g_test_expect_message() into a NOP, but we also have to relax
* g_log_set_always_fatal(), which was set by g_test_init(). */
g_log_set_always_fatal (G_LOG_FATAL_MASK);
-#ifdef __NETWORKMANAGER_LOGGING_H__
+#ifdef _NMTST_INSIDE_CORE
if (c_log_domains || c_log_level) {
/* Normally, tests with assert_logging do not overwrite the logging level/domains because
* the logging statements are part of the assertions. But if the test is run with
@@ -588,27 +581,7 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
#endif
}
-#ifdef __NETWORKMANAGER_LOGGING_H__
-inline static void
-nmtst_init_with_logging (int *argc, char ***argv, const char *log_level, const char *log_domains)
-{
- __nmtst_init (argc, argv, FALSE, log_level, log_domains, NULL);
-}
-inline static void
-nmtst_init_assert_logging (int *argc, char ***argv, const char *log_level, const char *log_domains)
-{
- gboolean set_logging;
-
- __nmtst_init (argc, argv, TRUE, NULL, NULL, &set_logging);
-
- if (!set_logging) {
- gboolean success;
-
- success = nm_logging_setup (log_level, log_domains, NULL, NULL);
- g_assert (success);
- }
-}
-#else
+#ifndef _NMTST_INSIDE_CORE
inline static void
nmtst_init (int *argc, char ***argv, gboolean assert_logging)
{
@@ -1175,247 +1148,6 @@ _nmtst_assert_resolve_relative_path_equals (const char *f1, const char *f2, cons
/*******************************************************************************/
-#ifdef __NETWORKMANAGER_PLATFORM_H__
-
-inline static NMPlatformIP4Address *
-nmtst_platform_ip4_address (const char *address, const char *peer_address, guint plen)
-{
- static NMPlatformIP4Address addr;
-
- g_assert (plen <= 32);
-
- memset (&addr, 0, sizeof (addr));
- addr.address = nmtst_inet4_from_string (address);
- if (peer_address)
- addr.peer_address = nmtst_inet4_from_string (peer_address);
- else
- addr.peer_address = addr.address;
- addr.plen = plen;
-
- return &addr;
-}
-
-inline static NMPlatformIP4Address *
-nmtst_platform_ip4_address_full (const char *address, const char *peer_address, guint plen,
- int ifindex, NMIPConfigSource source, guint32 timestamp,
- guint32 lifetime, guint32 preferred, guint32 flags,
- const char *label)
-{
- NMPlatformIP4Address *addr = nmtst_platform_ip4_address (address, peer_address, plen);
-
- G_STATIC_ASSERT (IFNAMSIZ == sizeof (addr->label));
- g_assert (!label || strlen (label) < IFNAMSIZ);
-
- addr->ifindex = ifindex;
- addr->addr_source = source;
- addr->timestamp = timestamp;
- addr->lifetime = lifetime;
- addr->preferred = preferred;
- addr->n_ifa_flags = flags;
- if (label)
- g_strlcpy (addr->label, label, sizeof (addr->label));
-
- return addr;
-}
-
-inline static NMPlatformIP6Address *
-nmtst_platform_ip6_address (const char *address, const char *peer_address, guint plen)
-{
- static NMPlatformIP6Address addr;
-
- g_assert (plen <= 128);
-
- memset (&addr, 0, sizeof (addr));
- addr.address = *nmtst_inet6_from_string (address);
- addr.peer_address = *nmtst_inet6_from_string (peer_address);
- addr.plen = plen;
-
- return &addr;
-}
-
-inline static NMPlatformIP6Address *
-nmtst_platform_ip6_address_full (const char *address, const char *peer_address, guint plen,
- int ifindex, NMIPConfigSource source, guint32 timestamp,
- guint32 lifetime, guint32 preferred, guint32 flags)
-{
- NMPlatformIP6Address *addr = nmtst_platform_ip6_address (address, peer_address, plen);
-
- addr->ifindex = ifindex;
- addr->addr_source = source;
- addr->timestamp = timestamp;
- addr->lifetime = lifetime;
- addr->preferred = preferred;
- addr->n_ifa_flags = flags;
-
- return addr;
-}
-
-inline static NMPlatformIP4Route *
-nmtst_platform_ip4_route (const char *network, guint plen, const char *gateway)
-{
- static NMPlatformIP4Route route;
-
- g_assert (plen <= 32);
-
- memset (&route, 0, sizeof (route));
- route.network = nmtst_inet4_from_string (network);
- route.plen = plen;
- route.gateway = nmtst_inet4_from_string (gateway);
-
- return &route;
-}
-
-inline static NMPlatformIP4Route *
-nmtst_platform_ip4_route_full (const char *network, guint plen, const char *gateway,
- int ifindex, NMIPConfigSource source,
- guint metric, guint mss,
- guint8 scope,
- const char *pref_src)
-{
- NMPlatformIP4Route *route = nmtst_platform_ip4_route (network, plen, gateway);
-
- route->ifindex = ifindex;
- route->rt_source = source;
- route->metric = metric;
- route->mss = mss;
- route->scope_inv = nm_platform_route_scope_inv (scope);
- route->pref_src = nmtst_inet4_from_string (pref_src);
-
- return route;
-}
-
-inline static NMPlatformIP6Route *
-nmtst_platform_ip6_route (const char *network, guint plen, const char *gateway)
-{
- static NMPlatformIP6Route route;
-
- nm_assert (plen <= 128);
-
- memset (&route, 0, sizeof (route));
- route.network = *nmtst_inet6_from_string (network);
- route.plen = plen;
- route.gateway = *nmtst_inet6_from_string (gateway);
-
- return &route;
-}
-
-inline static NMPlatformIP6Route *
-nmtst_platform_ip6_route_full (const char *network, guint plen, const char *gateway,
- int ifindex, NMIPConfigSource source,
- guint metric, guint mss)
-{
- NMPlatformIP6Route *route = nmtst_platform_ip6_route (network, plen, gateway);
-
- route->ifindex = ifindex;
- route->rt_source = source;
- route->metric = metric;
- route->mss = mss;
-
- return route;
-}
-
-inline static int
-_nmtst_platform_ip4_routes_equal_sort (gconstpointer a, gconstpointer b, gpointer user_data)
-{
- return nm_platform_ip4_route_cmp ((const NMPlatformIP4Route *) a, (const NMPlatformIP4Route *) b);
-}
-
-inline static void
-nmtst_platform_ip4_routes_equal (const NMPlatformIP4Route *a, const NMPlatformIP4Route *b, gsize len, gboolean ignore_order)
-{
- gsize i;
- gs_free const NMPlatformIP4Route *c_a = NULL, *c_b = NULL;
-
- g_assert (a);
- g_assert (b);
-
- if (ignore_order) {
- a = c_a = g_memdup (a, sizeof (NMPlatformIP4Route) * len);
- b = c_b = g_memdup (b, sizeof (NMPlatformIP4Route) * len);
- g_qsort_with_data (c_a, len, sizeof (NMPlatformIP4Route), _nmtst_platform_ip4_routes_equal_sort, NULL);
- g_qsort_with_data (c_b, len, sizeof (NMPlatformIP4Route), _nmtst_platform_ip4_routes_equal_sort, NULL);
- }
-
- for (i = 0; i < len; i++) {
- if (nm_platform_ip4_route_cmp (&a[i], &b[i]) != 0) {
- char buf[sizeof (_nm_utils_to_string_buffer)];
-
- g_error ("Error comparing IPv4 route[%lu]: %s vs %s", (long unsigned) i,
- nm_platform_ip4_route_to_string (&a[i], NULL, 0),
- nm_platform_ip4_route_to_string (&b[i], buf, sizeof (buf)));
- g_assert_not_reached ();
- }
- }
-}
-
-inline static int
-_nmtst_platform_ip6_routes_equal_sort (gconstpointer a, gconstpointer b, gpointer user_data)
-{
- return nm_platform_ip6_route_cmp ((const NMPlatformIP6Route *) a, (const NMPlatformIP6Route *) b);
-}
-
-inline static void
-nmtst_platform_ip6_routes_equal (const NMPlatformIP6Route *a, const NMPlatformIP6Route *b, gsize len, gboolean ignore_order)
-{
- gsize i;
- gs_free const NMPlatformIP6Route *c_a = NULL, *c_b = NULL;
-
- g_assert (a);
- g_assert (b);
-
- if (ignore_order) {
- a = c_a = g_memdup (a, sizeof (NMPlatformIP6Route) * len);
- b = c_b = g_memdup (b, sizeof (NMPlatformIP6Route) * len);
- g_qsort_with_data (c_a, len, sizeof (NMPlatformIP6Route), _nmtst_platform_ip6_routes_equal_sort, NULL);
- g_qsort_with_data (c_b, len, sizeof (NMPlatformIP6Route), _nmtst_platform_ip6_routes_equal_sort, NULL);
- }
-
- for (i = 0; i < len; i++) {
- if (nm_platform_ip6_route_cmp (&a[i], &b[i]) != 0) {
- char buf[sizeof (_nm_utils_to_string_buffer)];
-
- g_error ("Error comparing IPv6 route[%lu]: %s vs %s", (long unsigned) i,
- nm_platform_ip6_route_to_string (&a[i], NULL, 0),
- nm_platform_ip6_route_to_string (&b[i], buf, sizeof (buf)));
- g_assert_not_reached ();
- }
- }
-}
-
-#endif
-
-
-#ifdef __NETWORKMANAGER_IP4_CONFIG_H__
-
-inline static NMIP4Config *
-nmtst_ip4_config_clone (NMIP4Config *config)
-{
- NMIP4Config *copy = nm_ip4_config_new (-1);
-
- g_assert (copy);
- g_assert (config);
- nm_ip4_config_replace (copy, config, NULL);
- return copy;
-}
-
-#endif
-
-
-#ifdef __NETWORKMANAGER_IP6_CONFIG_H__
-
-inline static NMIP6Config *
-nmtst_ip6_config_clone (NMIP6Config *config)
-{
- NMIP6Config *copy = nm_ip6_config_new (-1);
-
- g_assert (copy);
- g_assert (config);
- nm_ip6_config_replace (copy, config, NULL);
- return copy;
-}
-
-#endif
-
#ifdef NM_SETTING_IP_CONFIG_H
inline static void
nmtst_setting_ip_config_add_address (NMSettingIPConfig *s_ip,
diff --git a/src/Makefile.am b/src/Makefile.am
index 1df9ce2806..1ff890ff56 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -632,6 +632,7 @@ dbusservice_DATA = org.freedesktop.NetworkManager.conf
EXTRA_DIST = \
$(dbusservice_DATA) \
$(NetworkManager_DATA) \
+ nm-test-utils-core.h \
NetworkManager.ver
rundir=$(runstatedir)/NetworkManager
diff --git a/src/devices/tests/test-lldp.c b/src/devices/tests/test-lldp.c
index bff85e6c94..ff6f42a970 100644
--- a/src/devices/tests/test-lldp.c
+++ b/src/devices/tests/test-lldp.c
@@ -33,7 +33,7 @@
#include "test-common.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/*****************************************************************************/
diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c
index 838368c479..dbe185b3a8 100644
--- a/src/devices/wifi/tests/test-wifi-ap-utils.c
+++ b/src/devices/wifi/tests/test-wifi-ap-utils.c
@@ -26,7 +26,7 @@
#include "nm-core-internal.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
#define DEBUG 1
diff --git a/src/dhcp-manager/tests/test-dhcp-dhclient.c b/src/dhcp-manager/tests/test-dhcp-dhclient.c
index 0561d43c14..76c9ff5002 100644
--- a/src/dhcp-manager/tests/test-dhcp-dhclient.c
+++ b/src/dhcp-manager/tests/test-dhcp-dhclient.c
@@ -31,7 +31,7 @@
#include "nm-ip4-config.h"
#include "nm-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
#define DEBUG 1
diff --git a/src/dhcp-manager/tests/test-dhcp-utils.c b/src/dhcp-manager/tests/test-dhcp-utils.c
index f477c061fb..89d693ed11 100644
--- a/src/dhcp-manager/tests/test-dhcp-utils.c
+++ b/src/dhcp-manager/tests/test-dhcp-utils.c
@@ -28,7 +28,7 @@
#include "nm-dhcp-utils.h"
#include "nm-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
typedef struct {
const char *name;
diff --git a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c
index aeec5879a1..cf6dab50bb 100644
--- a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c
+++ b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c
@@ -24,7 +24,7 @@
#include "nm-dnsmasq-utils.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static void
test_address_ranges (void)
diff --git a/src/nm-test-utils-core.h b/src/nm-test-utils-core.h
new file mode 100644
index 0000000000..8fd3be55ae
--- /dev/null
+++ b/src/nm-test-utils-core.h
@@ -0,0 +1,296 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2014 - 2016 Red Hat, Inc.
+ */
+
+#ifndef __NM_TEST_UTILS_CORE_H__
+#define __NM_TEST_UTILS_CORE_H__
+
+#include "NetworkManagerUtils.h"
+#include "nm-keyfile-internal.h"
+
+#define _NMTST_INSIDE_CORE 1
+
+#include "nm-test-utils.h"
+
+/*****************************************************************************/
+
+inline static void
+nmtst_init_with_logging (int *argc, char ***argv, const char *log_level, const char *log_domains)
+{
+ __nmtst_init (argc, argv, FALSE, log_level, log_domains, NULL);
+}
+inline static void
+nmtst_init_assert_logging (int *argc, char ***argv, const char *log_level, const char *log_domains)
+{
+ gboolean set_logging;
+
+ __nmtst_init (argc, argv, TRUE, NULL, NULL, &set_logging);
+
+ if (!set_logging) {
+ gboolean success;
+
+ success = nm_logging_setup (log_level, log_domains, NULL, NULL);
+ g_assert (success);
+ }
+}
+
+/*****************************************************************************/
+
+#ifdef __NETWORKMANAGER_PLATFORM_H__
+
+inline static NMPlatformIP4Address *
+nmtst_platform_ip4_address (const char *address, const char *peer_address, guint plen)
+{
+ static NMPlatformIP4Address addr;
+
+ g_assert (plen <= 32);
+
+ memset (&addr, 0, sizeof (addr));
+ addr.address = nmtst_inet4_from_string (address);
+ if (peer_address)
+ addr.peer_address = nmtst_inet4_from_string (peer_address);
+ else
+ addr.peer_address = addr.address;
+ addr.plen = plen;
+
+ return &addr;
+}
+
+inline static NMPlatformIP4Address *
+nmtst_platform_ip4_address_full (const char *address, const char *peer_address, guint plen,
+ int ifindex, NMIPConfigSource source, guint32 timestamp,
+ guint32 lifetime, guint32 preferred, guint32 flags,
+ const char *label)
+{
+ NMPlatformIP4Address *addr = nmtst_platform_ip4_address (address, peer_address, plen);
+
+ G_STATIC_ASSERT (IFNAMSIZ == sizeof (addr->label));
+ g_assert (!label || strlen (label) < IFNAMSIZ);
+
+ addr->ifindex = ifindex;
+ addr->addr_source = source;
+ addr->timestamp = timestamp;
+ addr->lifetime = lifetime;
+ addr->preferred = preferred;
+ addr->n_ifa_flags = flags;
+ if (label)
+ g_strlcpy (addr->label, label, sizeof (addr->label));
+
+ return addr;
+}
+
+inline static NMPlatformIP6Address *
+nmtst_platform_ip6_address (const char *address, const char *peer_address, guint plen)
+{
+ static NMPlatformIP6Address addr;
+
+ g_assert (plen <= 128);
+
+ memset (&addr, 0, sizeof (addr));
+ addr.address = *nmtst_inet6_from_string (address);
+ addr.peer_address = *nmtst_inet6_from_string (peer_address);
+ addr.plen = plen;
+
+ return &addr;
+}
+
+inline static NMPlatformIP6Address *
+nmtst_platform_ip6_address_full (const char *address, const char *peer_address, guint plen,
+ int ifindex, NMIPConfigSource source, guint32 timestamp,
+ guint32 lifetime, guint32 preferred, guint32 flags)
+{
+ NMPlatformIP6Address *addr = nmtst_platform_ip6_address (address, peer_address, plen);
+
+ addr->ifindex = ifindex;
+ addr->addr_source = source;
+ addr->timestamp = timestamp;
+ addr->lifetime = lifetime;
+ addr->preferred = preferred;
+ addr->n_ifa_flags = flags;
+
+ return addr;
+}
+
+inline static NMPlatformIP4Route *
+nmtst_platform_ip4_route (const char *network, guint plen, const char *gateway)
+{
+ static NMPlatformIP4Route route;
+
+ g_assert (plen <= 32);
+
+ memset (&route, 0, sizeof (route));
+ route.network = nmtst_inet4_from_string (network);
+ route.plen = plen;
+ route.gateway = nmtst_inet4_from_string (gateway);
+
+ return &route;
+}
+
+inline static NMPlatformIP4Route *
+nmtst_platform_ip4_route_full (const char *network, guint plen, const char *gateway,
+ int ifindex, NMIPConfigSource source,
+ guint metric, guint mss,
+ guint8 scope,
+ const char *pref_src)
+{
+ NMPlatformIP4Route *route = nmtst_platform_ip4_route (network, plen, gateway);
+
+ route->ifindex = ifindex;
+ route->rt_source = source;
+ route->metric = metric;
+ route->mss = mss;
+ route->scope_inv = nm_platform_route_scope_inv (scope);
+ route->pref_src = nmtst_inet4_from_string (pref_src);
+
+ return route;
+}
+
+inline static NMPlatformIP6Route *
+nmtst_platform_ip6_route (const char *network, guint plen, const char *gateway)
+{
+ static NMPlatformIP6Route route;
+
+ nm_assert (plen <= 128);
+
+ memset (&route, 0, sizeof (route));
+ route.network = *nmtst_inet6_from_string (network);
+ route.plen = plen;
+ route.gateway = *nmtst_inet6_from_string (gateway);
+
+ return &route;
+}
+
+inline static NMPlatformIP6Route *
+nmtst_platform_ip6_route_full (const char *network, guint plen, const char *gateway,
+ int ifindex, NMIPConfigSource source,
+ guint metric, guint mss)
+{
+ NMPlatformIP6Route *route = nmtst_platform_ip6_route (network, plen, gateway);
+
+ route->ifindex = ifindex;
+ route->rt_source = source;
+ route->metric = metric;
+ route->mss = mss;
+
+ return route;
+}
+
+inline static int
+_nmtst_platform_ip4_routes_equal_sort (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ return nm_platform_ip4_route_cmp ((const NMPlatformIP4Route *) a, (const NMPlatformIP4Route *) b);
+}
+
+inline static void
+nmtst_platform_ip4_routes_equal (const NMPlatformIP4Route *a, const NMPlatformIP4Route *b, gsize len, gboolean ignore_order)
+{
+ gsize i;
+ gs_free const NMPlatformIP4Route *c_a = NULL, *c_b = NULL;
+
+ g_assert (a);
+ g_assert (b);
+
+ if (ignore_order) {
+ a = c_a = g_memdup (a, sizeof (NMPlatformIP4Route) * len);
+ b = c_b = g_memdup (b, sizeof (NMPlatformIP4Route) * len);
+ g_qsort_with_data (c_a, len, sizeof (NMPlatformIP4Route), _nmtst_platform_ip4_routes_equal_sort, NULL);
+ g_qsort_with_data (c_b, len, sizeof (NMPlatformIP4Route), _nmtst_platform_ip4_routes_equal_sort, NULL);
+ }
+
+ for (i = 0; i < len; i++) {
+ if (nm_platform_ip4_route_cmp (&a[i], &b[i]) != 0) {
+ char buf[sizeof (_nm_utils_to_string_buffer)];
+
+ g_error ("Error comparing IPv4 route[%lu]: %s vs %s", (long unsigned) i,
+ nm_platform_ip4_route_to_string (&a[i], NULL, 0),
+ nm_platform_ip4_route_to_string (&b[i], buf, sizeof (buf)));
+ g_assert_not_reached ();
+ }
+ }
+}
+
+inline static int
+_nmtst_platform_ip6_routes_equal_sort (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ return nm_platform_ip6_route_cmp ((const NMPlatformIP6Route *) a, (const NMPlatformIP6Route *) b);
+}
+
+inline static void
+nmtst_platform_ip6_routes_equal (const NMPlatformIP6Route *a, const NMPlatformIP6Route *b, gsize len, gboolean ignore_order)
+{
+ gsize i;
+ gs_free const NMPlatformIP6Route *c_a = NULL, *c_b = NULL;
+
+ g_assert (a);
+ g_assert (b);
+
+ if (ignore_order) {
+ a = c_a = g_memdup (a, sizeof (NMPlatformIP6Route) * len);
+ b = c_b = g_memdup (b, sizeof (NMPlatformIP6Route) * len);
+ g_qsort_with_data (c_a, len, sizeof (NMPlatformIP6Route), _nmtst_platform_ip6_routes_equal_sort, NULL);
+ g_qsort_with_data (c_b, len, sizeof (NMPlatformIP6Route), _nmtst_platform_ip6_routes_equal_sort, NULL);
+ }
+
+ for (i = 0; i < len; i++) {
+ if (nm_platform_ip6_route_cmp (&a[i], &b[i]) != 0) {
+ char buf[sizeof (_nm_utils_to_string_buffer)];
+
+ g_error ("Error comparing IPv6 route[%lu]: %s vs %s", (long unsigned) i,
+ nm_platform_ip6_route_to_string (&a[i], NULL, 0),
+ nm_platform_ip6_route_to_string (&b[i], buf, sizeof (buf)));
+ g_assert_not_reached ();
+ }
+ }
+}
+
+#endif
+
+
+#ifdef __NETWORKMANAGER_IP4_CONFIG_H__
+
+inline static NMIP4Config *
+nmtst_ip4_config_clone (NMIP4Config *config)
+{
+ NMIP4Config *copy = nm_ip4_config_new (-1);
+
+ g_assert (copy);
+ g_assert (config);
+ nm_ip4_config_replace (copy, config, NULL);
+ return copy;
+}
+
+#endif
+
+
+#ifdef __NETWORKMANAGER_IP6_CONFIG_H__
+
+inline static NMIP6Config *
+nmtst_ip6_config_clone (NMIP6Config *config)
+{
+ NMIP6Config *copy = nm_ip6_config_new (-1);
+
+ g_assert (copy);
+ g_assert (config);
+ nm_ip6_config_replace (copy, config, NULL);
+ return copy;
+}
+
+#endif
+
+#endif /* __NM_TEST_UTILS_CORE_H__ */
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 6582b0cf03..d0fb277462 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -34,7 +34,7 @@
#include "nm-platform-utils.h"
#include "nmp-object.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/*********************************************************************************************/
diff --git a/src/platform/tests/monitor.c b/src/platform/tests/monitor.c
index 3af34be42c..937eea1154 100644
--- a/src/platform/tests/monitor.c
+++ b/src/platform/tests/monitor.c
@@ -25,7 +25,7 @@
#include "nm-linux-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
NMTST_DEFINE ();
diff --git a/src/platform/tests/test-common.h b/src/platform/tests/test-common.h
index 0e3cf10ba4..143b9b5272 100644
--- a/src/platform/tests/test-common.h
+++ b/src/platform/tests/test-common.h
@@ -8,7 +8,7 @@
#include "nm-fake-platform.h"
#include "nm-linux-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
#define DEVICE_NAME "nm-test-device"
diff --git a/src/platform/tests/test-general.c b/src/platform/tests/test-general.c
index d8d925614b..f67f00892f 100644
--- a/src/platform/tests/test-general.c
+++ b/src/platform/tests/test-general.c
@@ -25,7 +25,7 @@
#include "nm-platform-utils.h"
#include "nm-linux-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/******************************************************************/
diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c
index 9d548aabdb..5f8b04a915 100644
--- a/src/platform/tests/test-link.c
+++ b/src/platform/tests/test-link.c
@@ -30,7 +30,7 @@
#include "nm-platform-utils.h"
#include "test-common.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
#define LO_INDEX 1
#define LO_NAME "lo"
diff --git a/src/platform/tests/test-nmp-object.c b/src/platform/tests/test-nmp-object.c
index d77170b364..9d4f69de4c 100644
--- a/src/platform/tests/test-nmp-object.c
+++ b/src/platform/tests/test-nmp-object.c
@@ -22,7 +22,7 @@
#include "nmp-object.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
struct {
GList *udev_devices;
diff --git a/src/rdisc/tests/test-rdisc-fake.c b/src/rdisc/tests/test-rdisc-fake.c
index 1c514b9042..dec698d6bf 100644
--- a/src/rdisc/tests/test-rdisc-fake.c
+++ b/src/rdisc/tests/test-rdisc-fake.c
@@ -28,7 +28,7 @@
#include "nm-fake-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static NMFakeRDisc *
rdisc_new (void)
diff --git a/src/rdisc/tests/test-rdisc-linux.c b/src/rdisc/tests/test-rdisc-linux.c
index e22eb1ade1..c3eadf4eab 100644
--- a/src/rdisc/tests/test-rdisc-linux.c
+++ b/src/rdisc/tests/test-rdisc-linux.c
@@ -28,7 +28,7 @@
#include "nm-linux-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
NMTST_DEFINE ();
diff --git a/src/settings/plugins/ibft/tests/test-ibft.c b/src/settings/plugins/ibft/tests/test-ibft.c
index 9c98d8912c..cab468dec9 100644
--- a/src/settings/plugins/ibft/tests/test-ibft.c
+++ b/src/settings/plugins/ibft/tests/test-ibft.c
@@ -34,7 +34,7 @@
#include "reader.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static GPtrArray *
read_block (const char *iscsiadm_path, const char *expected_mac)
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c
index 5a0f6451a4..d2a348bb8b 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.c
@@ -28,7 +28,7 @@
#include "common.h"
#include "utils.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static void
test_get_ifcfg_name (const char *desc,
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 5ed25fda10..c7e741f996 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -55,7 +55,7 @@
#include "writer.h"
#include "utils.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/*****************************************************************************/
diff --git a/src/settings/plugins/ifnet/tests/test-ifnet.c b/src/settings/plugins/ifnet/tests/test-ifnet.c
index 3035fdb156..89df9af806 100644
--- a/src/settings/plugins/ifnet/tests/test-ifnet.c
+++ b/src/settings/plugins/ifnet/tests/test-ifnet.c
@@ -38,7 +38,7 @@
#include "connection_parser.h"
#include "nm-config.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/* Fake NMConfig handling; the values it returns don't matter, so this
* is easier than forcing it to read our own config file, etc.
diff --git a/src/settings/plugins/ifupdown/tests/test-ifupdown.c b/src/settings/plugins/ifupdown/tests/test-ifupdown.c
index f383821c39..ad483fa856 100644
--- a/src/settings/plugins/ifupdown/tests/test-ifupdown.c
+++ b/src/settings/plugins/ifupdown/tests/test-ifupdown.c
@@ -26,7 +26,7 @@
#include "interface_parser.h"
#include "parser.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
typedef struct {
char *key;
diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c
index 7b66e19861..00ab140bef 100644
--- a/src/settings/plugins/keyfile/tests/test-keyfile.c
+++ b/src/settings/plugins/keyfile/tests/test-keyfile.c
@@ -34,7 +34,7 @@
#include "writer.h"
#include "utils.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static void
check_ip_address (NMSettingIPConfig *config, int idx, const char *address, int plen)
diff --git a/src/supplicant-manager/tests/test-supplicant-config.c b/src/supplicant-manager/tests/test-supplicant-config.c
index 881f44f6bf..fd603f3b81 100644
--- a/src/supplicant-manager/tests/test-supplicant-config.c
+++ b/src/supplicant-manager/tests/test-supplicant-config.c
@@ -35,7 +35,7 @@
#include "nm-supplicant-config.h"
#include "nm-supplicant-settings-verify.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static gboolean
validate_opt (const char *detail,
diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c
index 27e513c35a..defead0540 100644
--- a/src/tests/config/test-config.c
+++ b/src/tests/config/test-config.c
@@ -27,7 +27,7 @@
#include "nm-fake-platform.h"
#include "nm-bus-manager.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/********************************************************************************/
diff --git a/src/tests/test-dcb.c b/src/tests/test-dcb.c
index e8e1ec860b..0a133de369 100644
--- a/src/tests/test-dcb.c
+++ b/src/tests/test-dcb.c
@@ -24,7 +24,7 @@
#include "nm-dcb.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
typedef struct {
guint num;
diff --git a/src/tests/test-general-with-expect.c b/src/tests/test-general-with-expect.c
index 64b47bd38c..ab2b15b5f2 100644
--- a/src/tests/test-general-with-expect.c
+++ b/src/tests/test-general-with-expect.c
@@ -30,7 +30,7 @@
#include "NetworkManagerUtils.h"
#include "nm-multi-index.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
#ifndef CLOCK_BOOTTIME
#define CLOCK_BOOTTIME 7
diff --git a/src/tests/test-general.c b/src/tests/test-general.c
index a45357e810..d29cdc0eed 100644
--- a/src/tests/test-general.c
+++ b/src/tests/test-general.c
@@ -26,7 +26,7 @@
#include "NetworkManagerUtils.h"
#include "nm-core-internal.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/* Reference implementation for nm_utils_ip6_address_clear_host_address.
* Taken originally from set_address_masked(), src/rdisc/nm-lndp-rdisc.c
diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c
index c1a8e69b5e..95b221bc0c 100644
--- a/src/tests/test-ip4-config.c
+++ b/src/tests/test-ip4-config.c
@@ -26,7 +26,7 @@
#include "nm-ip4-config.h"
#include "nm-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static NMIP4Config *
build_test_config (void)
diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c
index 8abec412fa..3eceec0cbe 100644
--- a/src/tests/test-ip6-config.c
+++ b/src/tests/test-ip6-config.c
@@ -26,7 +26,7 @@
#include "nm-ip6-config.h"
#include "nm-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static NMIP6Config *
build_test_config (void)
diff --git a/src/tests/test-resolvconf-capture.c b/src/tests/test-resolvconf-capture.c
index 31b6e1777f..32bc97342a 100644
--- a/src/tests/test-resolvconf-capture.c
+++ b/src/tests/test-resolvconf-capture.c
@@ -28,7 +28,7 @@
#include "nm-ip6-config.h"
#include "nm-platform.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static void
test_capture_empty (void)
diff --git a/src/tests/test-systemd.c b/src/tests/test-systemd.c
index 936bff204f..2dcb7af632 100644
--- a/src/tests/test-systemd.c
+++ b/src/tests/test-systemd.c
@@ -25,7 +25,7 @@
#include "sd-lldp.h"
#include "sd-event.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
/*****************************************************************************/
diff --git a/src/tests/test-utils.c b/src/tests/test-utils.c
index 6fc3978b9c..2cd8b8588d 100644
--- a/src/tests/test-utils.c
+++ b/src/tests/test-utils.c
@@ -26,7 +26,7 @@
#include "nm-core-utils.c"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static void
test_stable_privacy (void)
diff --git a/src/tests/test-wired-defname.c b/src/tests/test-wired-defname.c
index 6edd5ff246..bed1bb5ad1 100644
--- a/src/tests/test-wired-defname.c
+++ b/src/tests/test-wired-defname.c
@@ -24,7 +24,7 @@
#include "nm-setting-connection.h"
#include "nm-device-ethernet-utils.h"
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
static NMConnection *
_new_connection (const char *id)