diff options
| author | Michael Biebl <biebl@debian.org> | 2015-05-05 17:48:57 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2015-05-05 17:48:57 +0200 |
| commit | f408e27bccfacf347605a8d98649975a68f38a17 (patch) | |
| tree | 654fd6695c31511baf919b1c0870d119a352ed75 /src/platform/tests | |
| parent | 2c032d8f1c6292c1338a615e6ec40252889ba85c (diff) | |
Imported Upstream version 1.0.2 upstream/1.0.2
Diffstat (limited to 'src/platform/tests')
| -rw-r--r-- | src/platform/tests/Makefile.am | 2 | ||||
| -rw-r--r-- | src/platform/tests/Makefile.in | 32 | ||||
| -rw-r--r-- | src/platform/tests/test-address.c | 6 | ||||
| -rw-r--r-- | src/platform/tests/test-cleanup.c | 6 | ||||
| -rw-r--r-- | src/platform/tests/test-common.c | 115 | ||||
| -rw-r--r-- | src/platform/tests/test-common.h | 8 | ||||
| -rw-r--r-- | src/platform/tests/test-link.c | 8 | ||||
| -rw-r--r-- | src/platform/tests/test-route.c | 97 |
8 files changed, 251 insertions, 23 deletions
diff --git a/src/platform/tests/Makefile.am b/src/platform/tests/Makefile.am index b06e25e0..c10600eb 100644 --- a/src/platform/tests/Makefile.am +++ b/src/platform/tests/Makefile.am @@ -109,7 +109,7 @@ test_cleanup_linux_CPPFLAGS = \ -DKERNEL_HACKS=1 test_cleanup_linux_LDADD = $(PLATFORM_LDADD) -#@VALGRIND_RULES@ +@VALGRIND_RULES@ TESTS = test-link-fake test-address-fake test-route-fake test-cleanup-fake test-address-linux test-route-linux test-cleanup-linux diff --git a/src/platform/tests/Makefile.in b/src/platform/tests/Makefile.in index 052636ab..16a48430 100644 --- a/src/platform/tests/Makefile.in +++ b/src/platform/tests/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -89,8 +99,6 @@ TESTS = test-link-fake$(EXEEXT) test-address-fake$(EXEEXT) \ test-address-linux$(EXEEXT) test-route-linux$(EXEEXT) \ test-cleanup-linux$(EXEEXT) subdir = src/platform/tests -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/build-aux/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/compiler_warnings.m4 \ @@ -107,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -289,6 +298,8 @@ am__tty_colors = { \ std='[m'; \ fi; \ } +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/build-aux/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ @@ -315,7 +326,6 @@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@ DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@ @@ -350,6 +360,7 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -647,7 +658,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/platform/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/platform/tests/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -777,14 +787,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -1698,9 +1708,13 @@ uninstall-am: mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am +.PRECIOUS: Makefile + @GNOME_CODE_COVERAGE_RULES@ +@VALGRIND_RULES@ + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c index 3ef13b8e..5561038d 100644 --- a/src/platform/tests/test-address.c +++ b/src/platform/tests/test-address.c @@ -247,6 +247,12 @@ test_ip6_address_external (void) } void +init_tests (int *argc, char ***argv) +{ + nmtst_init_with_logging (argc, argv, NULL, "ALL"); +} + +void setup_tests (void) { SignalData *link_added = add_signal_ifname (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, DEVICE_NAME); diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c index afbb438c..0d0f3f63 100644 --- a/src/platform/tests/test-cleanup.c +++ b/src/platform/tests/test-cleanup.c @@ -87,6 +87,12 @@ test_cleanup_internal (void) } void +init_tests (int *argc, char ***argv) +{ + nmtst_init_with_logging (argc, argv, NULL, "ALL"); +} + +void setup_tests (void) { nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME)); diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c index ab40f652..1980282d 100644 --- a/src/platform/tests/test-common.c +++ b/src/platform/tests/test-common.c @@ -125,6 +125,113 @@ link_callback (NMPlatform *platform, int ifindex, NMPlatformLink *received, NMPl g_error ("Added/changed link not found in the local cache."); } +gboolean +ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric) +{ + gs_free char *arg_network = NULL; + const char *argv[] = { + NULL, + "route", + "list", + "dev", + ifname, + "exact", + NULL, + NULL, + }; + int exit_status; + gs_free char *std_out = NULL, *std_err = NULL; + char *out; + gboolean success; + gs_free_error GError *error = NULL; + gs_free char *metric_pattern = NULL; + + g_assert (ifname && nm_utils_iface_valid_name (ifname)); + g_assert (!strstr (ifname, " metric ")); + g_assert (plen >= 0 && plen <= 32); + + if (!NM_IS_LINUX_PLATFORM (nm_platform_get ())) { + /* If we don't test against linux-platform, we don't actually configure any + * routes in the system. */ + return -1; + } + + argv[0] = nm_utils_file_search_in_paths ("ip", NULL, + (const char *[]) { "/sbin", "/usr/sbin", NULL }, + G_FILE_TEST_IS_EXECUTABLE, NULL, NULL, NULL); + argv[6] = arg_network = g_strdup_printf ("%s/%d", nm_utils_inet4_ntop (network, NULL), plen); + + if (!argv[0]) { + /* Hm. There is no 'ip' binary. Return *unknown* */ + return -1; + } + + success = g_spawn_sync (NULL, + (char **) argv, + (char *[]) { NULL }, + 0, + NULL, + NULL, + &std_out, + &std_err, + &exit_status, + &error); + g_assert_no_error (error); + g_assert (success); + g_assert_cmpstr (std_err, ==, ""); + g_assert (std_out); + + metric_pattern = g_strdup_printf (" metric %u", metric); + out = std_out; + while (out) { + char *eol = strchr (out, '\n'); + gs_free char *line = eol ? g_strndup (out, eol - out) : g_strdup (out); + const char *p; + + out = eol ? &eol[1] : NULL; + if (!line[0]) + continue; + + if (metric == 0) { + if (!strstr (line, " metric ")) + return TRUE; + } + p = strstr (line, metric_pattern); + if (p && NM_IN_SET (p[strlen (metric_pattern)], ' ', '\0')) + return TRUE; + } + return FALSE; +} + +void +_assert_ip4_route_exists (const char *file, guint line, const char *func, gboolean exists, const char *ifname, guint32 network, int plen, guint32 metric) +{ + int ifindex; + gboolean exists_checked; + + /* Check for existance of the route by spawning iproute2. Do this because platform + * code might be entirely borked, but we expect ip-route to give a correct result. + * If the ip command cannot be found, we accept this as success. */ + exists_checked = ip4_route_exists (ifname, network, plen, metric); + if (exists_checked != -1 && !exists_checked != !exists) { + g_error ("[%s:%u] %s(): We expect the ip4 route %s/%d metric %u %s, but it %s", + file, line, func, + nm_utils_inet4_ntop (network, NULL), plen, metric, + exists ? "to exist" : "not to exist", + exists ? "doesn't" : "does"); + } + + ifindex = nm_platform_link_get_ifindex (ifname); + g_assert (ifindex > 0); + if (!nm_platform_ip4_route_exists (ifindex, network, plen, metric) != !exists) { + g_error ("[%s:%u] %s(): The ip4 route %s/%d metric %u %s, but platform thinks %s", + file, line, func, + nm_utils_inet4_ntop (network, NULL), plen, metric, + exists ? "exists" : "does not exist", + exists ? "it doesn't" : "it does"); + } +} + void run_command (const char *format, ...) { @@ -148,20 +255,22 @@ main (int argc, char **argv) int result; const char *program = *argv; - nmtst_init_with_logging (&argc, &argv, NULL, "ALL"); + init_tests (&argc, &argv); + NM_PRAGMA_WARNING_DISABLE("-Wtautological-compare") if (SETUP == nm_linux_platform_setup && getuid() != 0) { /* Try to exec as sudo, this function does not return, if a sudo-cmd is set. */ nmtst_reexec_sudo (); #ifdef REQUIRE_ROOT_TESTS - g_message ("Fail test: requires root privileges (%s)", program); + g_print ("Fail test: requires root privileges (%s)\n", program); return EXIT_FAILURE; #else - g_message ("Skipping test: requires root privileges (%s)", program); + g_print ("Skipping test: requires root privileges (%s)\n", program); return 77; #endif } + NM_PRAGMA_WARNING_REENABLE SETUP (); diff --git a/src/platform/tests/test-common.h b/src/platform/tests/test-common.h index 8f6b3912..367833d1 100644 --- a/src/platform/tests/test-common.h +++ b/src/platform/tests/test-common.h @@ -9,6 +9,8 @@ #include "nm-fake-platform.h" #include "nm-linux-platform.h" +#include "nm-test-utils.h" + #define DEVICE_NAME "nm-test-device" #define debug(...) nm_log_dbg (LOGD_PLATFORM, __VA_ARGS__) @@ -34,9 +36,15 @@ void accept_signal (SignalData *data); void wait_signal (SignalData *data); void free_signal (SignalData *data); +gboolean ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric); + +void _assert_ip4_route_exists (const char *file, guint line, const char *func, gboolean exists, const char *ifname, guint32 network, int plen, guint32 metric); +#define assert_ip4_route_exists(exists, ifname, network, plen, metric) _assert_ip4_route_exists (__FILE__, __LINE__, G_STRFUNC, exists, ifname, network, plen, metric) + void link_callback (NMPlatform *platform, int ifindex, NMPlatformLink *received, NMPlatformSignalChangeType change_type, NMPlatformReason reason, SignalData *data); void run_command (const char *format, ...); +void init_tests (int *argc, char ***argv); void setup_tests (void); diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index 8bd2ef44..99556e0a 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -365,12 +365,14 @@ test_bridge (void) static void test_bond (void) { + NM_PRAGMA_WARNING_DISABLE("-Wtautological-compare") if (SETUP == nm_linux_platform_setup && !g_file_test ("/proc/1/net/bonding", G_FILE_TEST_IS_DIR) && system("modprobe --show bonding") != 0) { g_test_skip ("Skipping test for bonding: bonding module not available"); return; } + NM_PRAGMA_WARNING_REENABLE test_software (NM_LINK_TYPE_BOND, "bond"); } @@ -538,6 +540,12 @@ test_external (void) } void +init_tests (int *argc, char ***argv) +{ + nmtst_init_with_logging (argc, argv, NULL, "ALL"); +} + +void setup_tests (void) { nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME)); diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c index 2c70b412..2d3caaf1 100644 --- a/src/platform/tests/test-route.c +++ b/src/platform/tests/test-route.c @@ -2,6 +2,7 @@ #include "test-common.h" #include "nm-test-utils.h" +#include "NetworkManagerUtils.h" #define DEVICE_NAME "nm-test-device" @@ -50,6 +51,75 @@ ip6_route_callback (NMPlatform *platform, int ifindex, NMPlatformIP6Route *recei } static void +test_ip4_route_metric0 (void) +{ + int ifindex = nm_platform_link_get_ifindex (DEVICE_NAME); + SignalData *route_added = add_signal (NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED, NM_PLATFORM_SIGNAL_ADDED, ip4_route_callback); + SignalData *route_changed = add_signal (NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED, NM_PLATFORM_SIGNAL_CHANGED, ip4_route_callback); + SignalData *route_removed = add_signal (NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED, NM_PLATFORM_SIGNAL_REMOVED, ip4_route_callback); + in_addr_t network = nmtst_inet4_from_string ("192.0.2.5"); /* from 192.0.2.0/24 (TEST-NET-1) (rfc5737) */ + int plen = 32; + int metric = 22987; + int mss = 1000; + + /* No routes initially */ + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); + + /* add the first route */ + g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, INADDR_ANY, 0, metric, mss)); + no_error (); + accept_signal (route_added); + + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + + /* Deleting route with metric 0 does nothing */ + g_assert (nm_platform_ip4_route_delete (ifindex, network, plen, 0)); + no_error (); + g_assert (!route_removed->received); + + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + + /* add the second route */ + g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, INADDR_ANY, 0, 0, mss)); + no_error (); + accept_signal (route_added); + + assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, 0); + assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + + /* Delete route with metric 0 */ + g_assert (nm_platform_ip4_route_delete (ifindex, network, plen, 0)); + no_error (); + accept_signal (route_removed); + + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + + /* Delete route with metric 0 again (we expect nothing to happen) */ + g_assert (nm_platform_ip4_route_delete (ifindex, network, plen, 0)); + no_error (); + g_assert (!route_removed->received); + + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + + /* Delete the other route */ + g_assert (nm_platform_ip4_route_delete (ifindex, network, plen, metric)); + no_error (); + accept_signal (route_removed); + + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); + + free_signal (route_added); + free_signal (route_changed); + free_signal (route_removed); +} + +static void test_ip4_route (void) { int ifindex = nm_platform_link_get_ifindex (DEVICE_NAME); @@ -74,11 +144,11 @@ test_ip4_route (void) accept_signal (route_added); /* Add route */ - g_assert (!nm_platform_ip4_route_exists (ifindex, network, plen, metric)); + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); no_error (); g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, 0, metric, mss)); no_error (); - g_assert (nm_platform_ip4_route_exists (ifindex, network, plen, metric)); + assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); no_error (); accept_signal (route_added); @@ -88,11 +158,11 @@ test_ip4_route (void) accept_signal (route_changed); /* Add default route */ - g_assert (!nm_platform_ip4_route_exists (ifindex, 0, 0, metric)); + assert_ip4_route_exists (FALSE, DEVICE_NAME, 0, 0, metric); no_error (); g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, 0, metric, mss)); no_error (); - g_assert (nm_platform_ip4_route_exists (ifindex, 0, 0, metric)); + assert_ip4_route_exists (TRUE, DEVICE_NAME, 0, 0, metric); no_error (); accept_signal (route_added); @@ -127,13 +197,13 @@ test_ip4_route (void) rts[2].mss = mss; g_assert_cmpint (routes->len, ==, 3); g_assert (!memcmp (routes->data, rts, sizeof (rts))); - nmtst_platform_ip4_routes_equal ((NMPlatformIP4Route *) routes->data, rts, routes->len); + nmtst_platform_ip4_routes_equal ((NMPlatformIP4Route *) routes->data, rts, routes->len, TRUE); g_array_unref (routes); /* Remove route */ g_assert (nm_platform_ip4_route_delete (ifindex, network, plen, metric)); no_error (); - g_assert (!nm_platform_ip4_route_exists (ifindex, network, plen, metric)); + assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); accept_signal (route_removed); /* Remove route again */ @@ -205,25 +275,25 @@ test_ip6_route (void) rts[0].plen = 128; rts[0].ifindex = ifindex; rts[0].gateway = in6addr_any; - rts[0].metric = metric; + rts[0].metric = nm_utils_ip6_route_metric_normalize (metric); rts[0].mss = mss; rts[1].source = NM_IP_CONFIG_SOURCE_USER; rts[1].network = network; rts[1].plen = plen; rts[1].ifindex = ifindex; rts[1].gateway = gateway; - rts[1].metric = metric; + rts[1].metric = nm_utils_ip6_route_metric_normalize (metric); rts[1].mss = mss; rts[2].source = NM_IP_CONFIG_SOURCE_USER; rts[2].network = in6addr_any; rts[2].plen = 0; rts[2].ifindex = ifindex; rts[2].gateway = gateway; - rts[2].metric = metric; + rts[2].metric = nm_utils_ip6_route_metric_normalize (metric); rts[2].mss = mss; g_assert_cmpint (routes->len, ==, 3); g_assert (!memcmp (routes->data, rts, sizeof (rts))); - nmtst_platform_ip6_routes_equal ((NMPlatformIP6Route *) routes->data, rts, routes->len); + nmtst_platform_ip6_routes_equal ((NMPlatformIP6Route *) routes->data, rts, routes->len, TRUE); g_array_unref (routes); /* Remove route */ @@ -242,6 +312,12 @@ test_ip6_route (void) } void +init_tests (int *argc, char ***argv) +{ + nmtst_init_with_logging (argc, argv, NULL, "ALL"); +} + +void setup_tests (void) { SignalData *link_added = add_signal_ifname (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, DEVICE_NAME); @@ -256,4 +332,5 @@ setup_tests (void) g_test_add_func ("/route/ip4", test_ip4_route); g_test_add_func ("/route/ip6", test_ip6_route); + g_test_add_func ("/route/ip4_metric0", test_ip4_route_metric0); } |