diff options
author | Thomas Haller <thaller@redhat.com> | 2016-03-24 17:05:39 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-03-24 17:49:15 +0100 |
commit | 12e6984b8763418856218ee8b3a8d3498c44f7f5 (patch) | |
tree | 8f77e2221d44300f63ce6507ae247c30d6b8d8a7 | |
parent | 76b79df1555c4e8c05dee94bc3eb88bfb49f3fbf (diff) | |
download | NetworkManager-12e6984b8763418856218ee8b3a8d3498c44f7f5.tar.gz |
platform/tests: fix bug in netns test which can cause mounting tmpfs over /run
The root-test "/general/netns/bind-to-path" mounts a tmpfs
over /var/run for the duration of the test and unmounts it at
the end.
Due to a bug, we first mount the tmpfs, then switch to another
namespace, and finally unmount /var/run on that other namespace.
That means, when you run the tests as root, it will bork /run
on your system.
Fixes: 46f5c07643e6cbf920a44bebe9ac9d3435a5a7b6
-rw-r--r-- | src/platform/tests/test-link.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index 69627c4059..94695edcd1 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -2257,9 +2257,6 @@ test_netns_bind_to_path (gpointer fixture, gconstpointer test_data) if (_test_netns_check_skip ()) return; - g_assert_cmpint (mount ("tmpfs", P_VAR_RUN, "tmpfs", MS_NOATIME | MS_NODEV | MS_NOSUID, "mode=0755,size=32K"), ==, 0); - g_assert_cmpint (mkdir (P_VAR_RUN_NETNS, 755), ==, 0); - platforms[0] = platform_0 = g_object_new (NM_TYPE_LINUX_PLATFORM, NM_PLATFORM_NETNS_SUPPORT, TRUE, NULL); platforms[1] = platform_1 = _test_netns_create_platform (); platforms[2] = platform_2 = _test_netns_create_platform (); @@ -2268,6 +2265,9 @@ test_netns_bind_to_path (gpointer fixture, gconstpointer test_data) if (i != 3) g_assert (nm_platform_netns_push (platforms[i], &netns_pop)); + g_assert_cmpint (mount ("tmpfs", P_VAR_RUN, "tmpfs", MS_NOATIME | MS_NODEV | MS_NOSUID, "mode=0755,size=32K"), ==, 0); + g_assert_cmpint (mkdir (P_VAR_RUN_NETNS, 755), ==, 0); + i = (nmtst_get_rand_int () % 2) + 1; netns = nm_platform_netns_get (platforms[i]); |