summary refs log tree commit diff
path: root/src/tests/test-general.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test-general.c')
-rw-r--r--src/tests/test-general.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tests/test-general.c b/src/tests/test-general.c
index 37bbc5ca..d36a26ef 100644
--- a/src/tests/test-general.c
+++ b/src/tests/test-general.c
@@ -272,6 +272,32 @@ test_nm_utils_log_connection_diff (void)
 
 /*****************************************************************************/
 
+static void
+do_test_sysctl_ip_conf (int addr_family,
+                        const char *iface,
+                        const char *property)
+{
+	char path[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
+	const char *pp;
+
+	pp = nm_utils_sysctl_ip_conf_path (addr_family, path, iface, property);
+	g_assert (pp == path);
+	g_assert (path[0] == '/');
+
+	g_assert (nm_utils_sysctl_ip_conf_is_path (addr_family, path, iface, property));
+	g_assert (nm_utils_sysctl_ip_conf_is_path (addr_family, path, NULL, property));
+}
+
+static void
+test_nm_utils_sysctl_ip_conf_path (void)
+{
+	do_test_sysctl_ip_conf (AF_INET6, "a", "mtu");
+	do_test_sysctl_ip_conf (AF_INET6, "eth0", "mtu");
+	do_test_sysctl_ip_conf (AF_INET6, "e23456789012345", "mtu");
+}
+
+/*****************************************************************************/
+
 static NMConnection *
 _match_connection_new (void)
 {
@@ -1716,6 +1742,8 @@ main (int argc, char **argv)
 	g_test_add_func ("/general/nm_utils_ip6_address_same_prefix", test_nm_utils_ip6_address_same_prefix);
 	g_test_add_func ("/general/nm_utils_log_connection_diff", test_nm_utils_log_connection_diff);
 
+	g_test_add_func ("/general/nm_utils_sysctl_ip_conf_path", test_nm_utils_sysctl_ip_conf_path);
+
 	g_test_add_func ("/general/exp10", test_nm_utils_exp10);
 
 	g_test_add_func ("/general/connection-match/basic", test_connection_match_basic);