diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c index f77734d5f5..2ff07b8dc4 100644 --- a/src/platform/tests/test-address.c +++ b/src/platform/tests/test-address.c @@ -22,7 +22,6 @@ #include "test-common.h" -#define DEVICE_NAME "nm-test-device" #define IP4_ADDRESS "192.0.2.1" #define IP4_ADDRESS_PEER "192.0.2.2" #define IP4_ADDRESS_PEER2 "192.0.3.1" diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c index 71a92cbfae..26c8c2b4bd 100644 --- a/src/platform/tests/test-cleanup.c +++ b/src/platform/tests/test-cleanup.c @@ -22,8 +22,6 @@ #include "test-common.h" -#define DEVICE_NAME "nm-test-device" - static void test_cleanup_internal (void) { diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c index 42aff043d8..258cfc1b25 100644 --- a/src/platform/tests/test-route.c +++ b/src/platform/tests/test-route.c @@ -27,9 +27,8 @@ #include "test-common.h" -#define DEVICE_NAME "nm-test-device" - -static int EX = -1; +#define DEVICE_IFINDEX NMTSTP_ENV1_IFINDEX +#define EX NMTSTP_ENV1_EX static void ip4_route_callback (NMPlatform *platform, int obj_type_i, int ifindex, const NMPlatformIP4Route *received, int change_type_i, SignalData *data) @@ -543,23 +542,15 @@ _nmtstp_init_tests (int *argc, char ***argv) void _nmtstp_setup_tests (void) { - SignalData *link_added = add_signal_ifname (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, DEVICE_NAME); - - nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME)); - g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, DEVICE_NAME)); - g_assert (nm_platform_link_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_SUCCESS); - accept_signal (link_added); - free_signal (link_added); - - g_assert (nm_platform_link_set_up (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME), NULL)); - - 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); - g_test_add_func ("/route/ip4_options", test_ip4_route_options); - g_test_add_data_func ("/route/ip6_options/1", GINT_TO_POINTER (1), test_ip6_route_options); - g_test_add_data_func ("/route/ip6_options/2", GINT_TO_POINTER (2), test_ip6_route_options); +#define add_test_func(testpath, test_func) nmtstp_env1_add_test_func(testpath, test_func, TRUE) +#define add_test_func_data(testpath, test_func, arg) nmtstp_env1_add_test_func_data(testpath, test_func, arg, TRUE) + add_test_func ("/route/ip4", test_ip4_route); + add_test_func ("/route/ip6", test_ip6_route); + add_test_func ("/route/ip4_metric0", test_ip4_route_metric0); + add_test_func ("/route/ip4_options", test_ip4_route_options); + add_test_func_data ("/route/ip6_options/1", test_ip6_route_options, GINT_TO_POINTER (1)); + add_test_func_data ("/route/ip6_options/2", test_ip6_route_options, GINT_TO_POINTER (2)); if (nmtstp_is_root_test ()) - g_test_add_func ("/route/ip4_zero_gateway", test_ip4_zero_gateway); + add_test_func ("/route/ip4_zero_gateway", test_ip4_zero_gateway); }