mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 02:38:08 +02:00
platform/tests: skip netns tests if we fail to create a new NMPNetns instance
nmp_netns_new () might fail with:
netns: failed mount --make-rslave: Invalid argument
Skip the test in that case.
https://bugzilla.gnome.org/show_bug.cgi?id=790214
(cherry picked from commit b20384fac7)
This commit is contained in:
parent
f4cd75d422
commit
c449d9fe07
1 changed files with 13 additions and 2 deletions
|
|
@ -1916,6 +1916,7 @@ _test_netns_check_skip (void)
|
||||||
static int support = -1;
|
static int support = -1;
|
||||||
static int support_errsv = 0;
|
static int support_errsv = 0;
|
||||||
NMPNetns *netns;
|
NMPNetns *netns;
|
||||||
|
gs_unref_object NMPNetns *netns2 = NULL;
|
||||||
|
|
||||||
netns = nmp_netns_get_current ();
|
netns = nmp_netns_get_current ();
|
||||||
if (!netns) {
|
if (!netns) {
|
||||||
|
|
@ -1931,10 +1932,20 @@ _test_netns_check_skip (void)
|
||||||
support_errsv = errno;
|
support_errsv = errno;
|
||||||
}
|
}
|
||||||
if (!support) {
|
if (!support) {
|
||||||
_LOGD ("setns() failed with \"%s\". This indicates missing support (valgrind?)", g_strerror (support_errsv));
|
_LOGD ("setns() failed with \"%s\". This indicates missing support (valgrind?)", g_strerror (support_errsv));
|
||||||
g_test_skip ("No netns support (setns failed)");
|
g_test_skip ("No netns support (setns failed)");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
netns2 = nmp_netns_new ();
|
||||||
|
if (!netns2) {
|
||||||
|
/* skip tests for https://bugzilla.gnome.org/show_bug.cgi?id=790214 */
|
||||||
|
g_assert_cmpint (errno, ==, EINVAL);
|
||||||
|
g_test_skip ("No netns support to create another netns");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
nmp_netns_pop (netns2);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue