From bd76c1e2d0fd4b4dd850bc5b8480e3ae978798e7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 7 Apr 2016 11:54:28 +0200 Subject: [PATCH] platform/tests/trivial: rename ip4_route_exists() functions to have nmtstp prefix (cherry picked from commit f8f8c516e0a17abe2305ad06fa289edfbb094fc6) --- src/platform/tests/test-common.c | 6 ++--- src/platform/tests/test-common.h | 6 ++--- src/platform/tests/test-route.c | 38 ++++++++++++++++---------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c index 06daa07434..cfe3b57360 100644 --- a/src/platform/tests/test-common.c +++ b/src/platform/tests/test-common.c @@ -185,7 +185,7 @@ link_callback (NMPlatform *platform, NMPObjectType obj_type, int ifindex, NMPlat /*****************************************************************************/ gboolean -ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric) +nmtstp_ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric) { gs_free char *arg_network = NULL; const char *argv[] = { @@ -263,7 +263,7 @@ 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) +_nmtstp_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; @@ -271,7 +271,7 @@ _assert_ip4_route_exists (const char *file, guint line, const char *func, gboole /* 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); + exists_checked = nmtstp_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, diff --git a/src/platform/tests/test-common.h b/src/platform/tests/test-common.h index c7543a30af..9d4fe88225 100644 --- a/src/platform/tests/test-common.h +++ b/src/platform/tests/test-common.h @@ -104,10 +104,10 @@ gboolean nmtstp_run_command_check_external (int external_command); /*****************************************************************************/ -gboolean ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric); +gboolean nmtstp_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 _nmtstp_assert_ip4_route_exists (const char *file, guint line, const char *func, gboolean exists, const char *ifname, guint32 network, int plen, guint32 metric); +#define nmtstp_assert_ip4_route_exists(exists, ifname, network, plen, metric) _nmtstp_assert_ip4_route_exists (__FILE__, __LINE__, G_STRFUNC, exists, ifname, network, plen, metric) /*****************************************************************************/ diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c index ab1d578b15..20c68118c2 100644 --- a/src/platform/tests/test-route.c +++ b/src/platform/tests/test-route.c @@ -82,50 +82,50 @@ test_ip4_route_metric0 (void) 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); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); /* add the first route */ g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, INADDR_ANY, 0, metric, mss)); accept_signal (route_added); - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); - assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); /* Deleting route with metric 0 does nothing */ g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, 0)); ensure_no_signal (route_removed); - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); - assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); /* add the second route */ g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, INADDR_ANY, 0, 0, mss)); accept_signal (route_added); - assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, 0); - assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, 0); + nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); /* Delete route with metric 0 */ g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, 0)); accept_signal (route_removed); - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); - assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + nmtstp_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 (NM_PLATFORM_GET, ifindex, network, plen, 0)); ensure_no_signal (route_removed); - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); - assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); /* Delete the other route */ g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, metric)); accept_signal (route_removed); - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); free_signal (route_added); free_signal (route_changed); @@ -156,9 +156,9 @@ test_ip4_route (void) accept_signal (route_added); /* Add route */ - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, 0, metric, mss)); - assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric); accept_signal (route_added); /* Add route again */ @@ -166,9 +166,9 @@ test_ip4_route (void) accept_signals (route_changed, 0, 1); /* Add default route */ - assert_ip4_route_exists (FALSE, DEVICE_NAME, 0, 0, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, 0, 0, metric); g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, 0, metric, mss)); - assert_ip4_route_exists (TRUE, DEVICE_NAME, 0, 0, metric); + nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, 0, 0, metric); accept_signal (route_added); /* Add default route again */ @@ -208,7 +208,7 @@ test_ip4_route (void) /* Remove route */ g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, metric)); - assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); + nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric); accept_signal (route_removed); /* Remove route again */