summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-19 09:12:37 +0200
committerThomas Haller <thaller@redhat.com>2015-04-22 17:12:51 +0200
commitf87b11a58ac358c240e572ee2633b77685a4bb05 (patch)
tree8720a8de2667f7c8939b811eed4a6929dffc12fd
parent2316d233e36d7c98e4ecad2016ed2467c853a6a0 (diff)
downloadNetworkManager-th/platform-tests-unshare.tar.gz
platform/test: unshare the netns namespace so that root tests don't mess with the systemth/platform-tests-unshare
Doesn't work yet...
-rw-r--r--src/platform/tests/test-common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index d1627058e9..ad457fa4e0 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -279,6 +279,14 @@ main (int argc, char **argv)
#endif
}
+ if (nmtst_platform_is_root_test () && !g_getenv ("NMTST_NO_UNSHARE")) {
+ if (unshare (CLONE_NEWNET) != 0) {
+ int errsv = errno;
+
+ g_error ("unshare(CLONE_NEWNET) failed with %s (%d)", strerror (errsv), errsv);
+ }
+ }
+
SETUP ();
setup_tests ();