From 33491bc4279481db8ae47213e34a6d695a0e8830 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sun, 6 Jul 2014 02:16:10 +0200 Subject: Imported Upstream version 0.9.10.0 --- callouts/tests/Makefile.am | 10 +++--- callouts/tests/Makefile.in | 50 +++++++++++++++-------------- callouts/tests/dispatcher-old-down | 1 + callouts/tests/dispatcher-old-up | 1 + callouts/tests/dispatcher-old-vpn-down | 1 + callouts/tests/dispatcher-old-vpn-up | 1 + callouts/tests/test-dispatcher-envp.c | 58 +++++++++++++++++----------------- 7 files changed, 63 insertions(+), 59 deletions(-) (limited to 'callouts/tests') diff --git a/callouts/tests/Makefile.am b/callouts/tests/Makefile.am index d33d0f91..de4b5f52 100644 --- a/callouts/tests/Makefile.am +++ b/callouts/tests/Makefile.am @@ -5,7 +5,10 @@ AM_CPPFLAGS = \ -I${top_builddir}/include \ -I$(top_srcdir)/libnm-util \ -I$(top_builddir)/libnm-util \ - -I$(top_srcdir)/callouts + -I$(top_srcdir)/callouts \ + -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ + $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) noinst_PROGRAMS = \ test-dispatcher-envp @@ -15,11 +18,6 @@ noinst_PROGRAMS = \ test_dispatcher_envp_SOURCES = \ test-dispatcher-envp.c -test_dispatcher_envp_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(AM_CPPFLAGS) - test_dispatcher_envp_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/callouts/libtest-dispatcher-envp.la \ diff --git a/callouts/tests/Makefile.in b/callouts/tests/Makefile.in index c28aee5c..25255b59 100644 --- a/callouts/tests/Makefile.in +++ b/callouts/tests/Makefile.in @@ -83,7 +83,8 @@ subdir = callouts/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/compiler_warnings.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ + $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gnome-code-coverage.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ @@ -103,7 +104,8 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am__test_dispatcher_envp_SOURCES_DIST = test-dispatcher-envp.c -@ENABLE_TESTS_TRUE@am_test_dispatcher_envp_OBJECTS = test_dispatcher_envp-test-dispatcher-envp.$(OBJEXT) +@ENABLE_TESTS_TRUE@am_test_dispatcher_envp_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test-dispatcher-envp.$(OBJEXT) test_dispatcher_envp_OBJECTS = $(am_test_dispatcher_envp_OBJECTS) am__DEPENDENCIES_1 = @ENABLE_TESTS_TRUE@test_dispatcher_envp_DEPENDENCIES = \ @@ -200,12 +202,15 @@ 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@ DBUS_LIBS = @DBUS_LIBS@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ DHCPCD_PATH = @DHCPCD_PATH@ +DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ DLLTOOL = @DLLTOOL@ DNSMASQ_PATH = @DNSMASQ_PATH@ DSYMUTIL = @DSYMUTIL@ @@ -230,7 +235,6 @@ 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@ @@ -275,12 +279,16 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBM = @LIBM@ +LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ +LIBNDP_LIBS = @LIBNDP_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ LIBSOUP_LIBS = @LIBSOUP_LIBS@ +LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ +LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -297,6 +305,8 @@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ +NEWT_CFLAGS = @NEWT_CFLAGS@ +NEWT_LIBS = @NEWT_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ @@ -324,11 +334,16 @@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLKIT_CFLAGS = @POLKIT_CFLAGS@ POLKIT_LIBS = @POLKIT_LIBS@ POSUB = @POSUB@ +PPPD_PATH = @PPPD_PATH@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ +PPPOE_PATH = @PPPOE_PATH@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -343,6 +358,7 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VALGRIND_RULES = @VALGRIND_RULES@ VAPIGEN = @VAPIGEN@ VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ @@ -405,6 +421,7 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ systemdsystemunitdir = @systemdsystemunitdir@ target_alias = @target_alias@ @@ -415,23 +432,22 @@ with_dhclient = @with_dhclient@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ +with_valgrind = @with_valgrind@ @ENABLE_TESTS_TRUE@AM_CPPFLAGS = \ @ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ @ENABLE_TESTS_TRUE@ -I${top_builddir}/include \ @ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ @ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ -@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/callouts +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/callouts \ +@ENABLE_TESTS_TRUE@ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) ####### dispatcher envp ####### @ENABLE_TESTS_TRUE@test_dispatcher_envp_SOURCES = \ @ENABLE_TESTS_TRUE@ test-dispatcher-envp.c -@ENABLE_TESTS_TRUE@test_dispatcher_envp_CPPFLAGS = \ -@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ -@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ -@ENABLE_TESTS_TRUE@ $(AM_CPPFLAGS) - @ENABLE_TESTS_TRUE@test_dispatcher_envp_LDADD = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @ENABLE_TESTS_TRUE@ $(top_builddir)/callouts/libtest-dispatcher-envp.la \ @@ -498,7 +514,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dispatcher_envp-test-dispatcher-envp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dispatcher-envp.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -521,20 +537,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -test_dispatcher_envp-test-dispatcher-envp.o: test-dispatcher-envp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_dispatcher_envp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_dispatcher_envp-test-dispatcher-envp.o -MD -MP -MF $(DEPDIR)/test_dispatcher_envp-test-dispatcher-envp.Tpo -c -o test_dispatcher_envp-test-dispatcher-envp.o `test -f 'test-dispatcher-envp.c' || echo '$(srcdir)/'`test-dispatcher-envp.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_dispatcher_envp-test-dispatcher-envp.Tpo $(DEPDIR)/test_dispatcher_envp-test-dispatcher-envp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-dispatcher-envp.c' object='test_dispatcher_envp-test-dispatcher-envp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_dispatcher_envp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_dispatcher_envp-test-dispatcher-envp.o `test -f 'test-dispatcher-envp.c' || echo '$(srcdir)/'`test-dispatcher-envp.c - -test_dispatcher_envp-test-dispatcher-envp.obj: test-dispatcher-envp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_dispatcher_envp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_dispatcher_envp-test-dispatcher-envp.obj -MD -MP -MF $(DEPDIR)/test_dispatcher_envp-test-dispatcher-envp.Tpo -c -o test_dispatcher_envp-test-dispatcher-envp.obj `if test -f 'test-dispatcher-envp.c'; then $(CYGPATH_W) 'test-dispatcher-envp.c'; else $(CYGPATH_W) '$(srcdir)/test-dispatcher-envp.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_dispatcher_envp-test-dispatcher-envp.Tpo $(DEPDIR)/test_dispatcher_envp-test-dispatcher-envp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-dispatcher-envp.c' object='test_dispatcher_envp-test-dispatcher-envp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_dispatcher_envp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_dispatcher_envp-test-dispatcher-envp.obj `if test -f 'test-dispatcher-envp.c'; then $(CYGPATH_W) 'test-dispatcher-envp.c'; else $(CYGPATH_W) '$(srcdir)/test-dispatcher-envp.c'; fi` - mostlyclean-libtool: -rm -f *.lo diff --git a/callouts/tests/dispatcher-old-down b/callouts/tests/dispatcher-old-down index 6396287f..836f3532 100644 --- a/callouts/tests/dispatcher-old-down +++ b/callouts/tests/dispatcher-old-down @@ -12,6 +12,7 @@ interface=wlan0 path=/org/freedesktop/NetworkManager/Devices/0 [env] +PATH= CONNECTION_UUID=3fd2a33a-d81b-423f-ae99-e6baba742311 CONNECTION_ID=Random Connection DEVICE_IFACE=wlan0 diff --git a/callouts/tests/dispatcher-old-up b/callouts/tests/dispatcher-old-up index 76e3be8d..a35812ee 100644 --- a/callouts/tests/dispatcher-old-up +++ b/callouts/tests/dispatcher-old-up @@ -31,6 +31,7 @@ nameservers=68.87.77.134 68.87.72.134 192.168.1.1 domains=hsd1.mn.comcast.net. [env] +PATH= CONNECTION_UUID=3fd2a33a-d81b-423f-ae99-e6baba742311 CONNECTION_ID=Random Connection DEVICE_IFACE=wlan0 diff --git a/callouts/tests/dispatcher-old-vpn-down b/callouts/tests/dispatcher-old-vpn-down index c11cbfd1..4fab5e95 100644 --- a/callouts/tests/dispatcher-old-vpn-down +++ b/callouts/tests/dispatcher-old-vpn-down @@ -31,6 +31,7 @@ nameservers=68.87.77.134 68.87.72.134 192.168.1.1 domains=hsd1.mn.comcast.net. [env] +PATH= CONNECTION_UUID=355653c0-34d3-4777-ad25-f9a498b7ef8e CONNECTION_ID=Random Connection DEVICE_IFACE=wlan0 diff --git a/callouts/tests/dispatcher-old-vpn-up b/callouts/tests/dispatcher-old-vpn-up index ad47c91d..3c350dbf 100644 --- a/callouts/tests/dispatcher-old-vpn-up +++ b/callouts/tests/dispatcher-old-vpn-up @@ -31,6 +31,7 @@ nameservers=68.87.77.134 68.87.72.134 192.168.1.1 domains=hsd1.mn.comcast.net. [env] +PATH= CONNECTION_UUID=355653c0-34d3-4777-ad25-f9a498b7ef8e CONNECTION_ID=Random Connection DEVICE_IFACE=wlan0 diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index 25b5f61d..a91ae2b2 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -29,7 +29,7 @@ #include "nm-setting-connection.h" #include "nm-dispatcher-utils.h" #include "nm-dbus-glib-types.h" -#include "nm-dispatcher-action.h" +#include "nm-dispatcher-api.h" #include "nm-utils.h" /*******************************************/ @@ -238,10 +238,10 @@ add_uint_array (GKeyFile *kf, items = g_array_sized_new (FALSE, TRUE, sizeof (guint32), g_strv_length (split)); for (iter = split; iter && *iter; iter++) { if (strlen (g_strstrip (*iter))) { - struct in_addr addr; + guint32 addr; g_assert_cmpint (inet_pton (AF_INET, *iter, &addr), ==, 1); - g_array_append_val (items, addr.s_addr); + g_array_append_val (items, addr); } } value_hash_add_uint_array (props, key, items); @@ -294,7 +294,7 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e list = NULL; for (iter = split; iter && *iter; iter++) { NMIP4Address *addr; - struct in_addr a; + guint32 a; char *p; if (strlen (g_strstrip (*iter)) == 0) @@ -307,7 +307,7 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e *p++ = '\0'; g_assert_cmpint (inet_pton (AF_INET, *iter, &a), ==, 1); - nm_ip4_address_set_address (addr, a.s_addr); + nm_ip4_address_set_address (addr, a); nm_ip4_address_set_prefix (addr, (guint) atoi (p)); p = strchr (p, ' '); @@ -315,7 +315,7 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e p++; g_assert_cmpint (inet_pton (AF_INET, p, &a), ==, 1); - nm_ip4_address_set_gateway (addr, a.s_addr); + nm_ip4_address_set_gateway (addr, a); list = g_slist_append (list, addr); } @@ -338,7 +338,7 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e list = NULL; for (iter = split; iter && *iter; iter++) { NMIP4Route *route; - struct in_addr a; + guint32 a; char *p; if (strlen (g_strstrip (*iter)) == 0) @@ -351,7 +351,7 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e *p++ = '\0'; g_assert_cmpint (inet_pton (AF_INET, *iter, &a), ==, 1); - nm_ip4_route_set_dest (route, a.s_addr); + nm_ip4_route_set_dest (route, a); nm_ip4_route_set_prefix (route, (guint) atoi (p)); p = strchr (p, ' '); @@ -359,7 +359,7 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e p++; g_assert_cmpint (inet_pton (AF_INET, p, &a), ==, 1); - nm_ip4_route_set_next_hop (route, a.s_addr); + nm_ip4_route_set_next_hop (route, a); p = strchr (p, ' '); g_assert (p); @@ -560,10 +560,18 @@ test_generic (const char *path, const char *file, const char *override_vpn_ip_if /* Compare dispatcher generated env and expected env */ for (iter = denv; iter && *iter; iter++) { gpointer foo; + const char *i_value = *iter; - foo = g_hash_table_lookup (expected_env, *iter); + if (strstr (i_value, "PATH=") == i_value) { + g_assert_cmpstr (&i_value[strlen("PATH=")], ==, g_getenv ("PATH")); + + /* The path is constructed dynamically. Ignore the actual value. */ + i_value = "PATH="; + } + + foo = g_hash_table_lookup (expected_env, i_value); if (!foo) - g_warning ("Failed to find %s in environment", *iter); + g_warning ("Failed to find %s in environment", i_value); g_assert (foo); } @@ -628,31 +636,23 @@ test_up_empty_vpn_iface (const char *path) /*******************************************/ -#if GLIB_CHECK_VERSION(2,25,12) -typedef GTestFixtureFunc TCFunc; -#else -typedef void (*TCFunc)(void); -#endif - -#define TESTCASE(t, d) g_test_create_case (#t, 0, d, NULL, (TCFunc) t, NULL) - -int main (int argc, char **argv) +int +main (int argc, char **argv) { - GTestSuite *suite; - g_assert (argc > 1); g_test_init (&argc, &argv, NULL); - g_type_init (); - suite = g_test_get_root (); +#if !GLIB_CHECK_VERSION (2, 35, 0) + g_type_init (); +#endif - g_test_suite_add (suite, TESTCASE (test_old_up, argv[1])); - g_test_suite_add (suite, TESTCASE (test_old_down, argv[1])); - g_test_suite_add (suite, TESTCASE (test_old_vpn_up, argv[1])); - g_test_suite_add (suite, TESTCASE (test_old_vpn_down, argv[1])); + g_test_add_data_func ("/dispatcher/old_up", argv[1], (GTestDataFunc) test_old_up); + g_test_add_data_func ("/dispatcher/old_down", argv[1], (GTestDataFunc) test_old_down); + g_test_add_data_func ("/dispatcher/old_vpn_up", argv[1], (GTestDataFunc) test_old_vpn_up); + g_test_add_data_func ("/dispatcher/old_vpn_down", argv[1], (GTestDataFunc) test_old_vpn_down); - g_test_suite_add (suite, TESTCASE (test_up_empty_vpn_iface, argv[1])); + g_test_add_data_func ("/dispatcher/up_empty_vpn_iface", argv[1], (GTestDataFunc) test_up_empty_vpn_iface); return g_test_run (); } -- cgit 1.3.0-6-gf8a5