platform/tests: disable tests touching sysctl when they're not writable

This is basically the case in the COPR build system where this
(mount -o bind,ro /proc/sys /proc/sys) is the case for reasons unknown.
This commit is contained in:
Lubomir Rintel 2018-02-12 18:06:33 +01:00
parent a25d2e0a17
commit 984e9d5655

View file

@ -1978,6 +1978,17 @@ _test_netns_check_skip (void)
return FALSE;
}
static gboolean
_check_sysctl_skip (void)
{
if (access ("/proc/sys/net/ipv4/ip_forward", W_OK) == -1) {
g_test_skip ("Can not write sysctls");
return TRUE;
}
return FALSE;
}
/*****************************************************************************/
#define _sysctl_assert_eq(plat, path, value) \
@ -2002,6 +2013,9 @@ test_netns_general (gpointer fixture, gconstpointer test_data)
if (_test_netns_check_skip ())
return;
if (_check_sysctl_skip ())
return;
platform_1 = nm_linux_platform_new (TRUE, TRUE);
platform_2 = _test_netns_create_platform ();
@ -2197,6 +2211,9 @@ test_netns_push (gpointer fixture, gconstpointer test_data)
if (_test_netns_check_skip ())
return;
if (_check_sysctl_skip ())
return;
pl[0].platform = platform_0 = nm_linux_platform_new (TRUE, TRUE);
pl[1].platform = platform_1 = _test_netns_create_platform ();
pl[2].platform = platform_2 = _test_netns_create_platform ();