diff options
Diffstat (limited to 'src/platform/tests/test-common.c')
-rw-r--r-- | src/platform/tests/test-common.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c index 8ab7642bbe..bb94debc78 100644 --- a/src/platform/tests/test-common.c +++ b/src/platform/tests/test-common.c @@ -283,25 +283,38 @@ main (int argc, char **argv) } if (nmtst_platform_is_root_test () && !g_getenv ("NMTST_NO_UNSHARE")) { - int errsv = errno; - if (unshare (CLONE_NEWNET | CLONE_NEWNS) != 0) + int errsv; + + if (unshare (CLONE_NEWNET | CLONE_NEWNS) != 0) { + errsv = errno; g_error ("unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)", strerror (errsv), errsv); + } /* Mount our /sys instance, so that gudev sees only our devices. * Needs to be read-only, because we don't run udev. */ - if (mount (NULL, "/sys", NULL, MS_SLAVE, NULL) != 0) + if (mount (NULL, "/sys", NULL, MS_SLAVE, NULL) != 0) { + errsv = errno; g_error ("mount(\"/\", MS_SLAVE) failed with %s (%d)", strerror (errsv), errsv); - if (mount ("sys", "/sys", "sysfs", MS_RDONLY, NULL) != 0) + } + if (mount ("sys", "/sys", "sysfs", MS_RDONLY, NULL) != 0) { + errsv = errno; g_error ("mount(\"/sys\") failed with %s (%d)", strerror (errsv), errsv); + } /* Create a writable /sys/devices tree. This makes it possible to run tests * that modify values via sysfs (such as bridge forward delay). */ - if (mount ("sys", "/sys/devices", "sysfs", 0, NULL) != 0) + if (mount ("sys", "/sys/devices", "sysfs", 0, NULL) != 0) { + errsv = errno; g_error ("mount(\"/sys/devices\") failed with %s (%d)", strerror (errsv), errsv); - if (mount (NULL, "/sys/devices", "sysfs", MS_REMOUNT, NULL) != 0) + } + if (mount (NULL, "/sys/devices", "sysfs", MS_REMOUNT, NULL) != 0) { + errsv = errno; g_error ("remount(\"/sys/devices\") failed with %s (%d)", strerror (errsv), errsv); - if (mount ("/sys/devices/devices", "/sys/devices", NULL, MS_BIND, NULL) != 0) + } + if (mount ("/sys/devices/devices", "/sys/devices", NULL, MS_BIND, NULL) != 0) { + errsv = errno; g_error ("mount(\"/sys\") failed with %s (%d)", strerror (errsv), errsv); + } } SETUP (); |