Commit 9997856e authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: check --ext-mount-map auto

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 46a0e74d
...@@ -559,6 +559,10 @@ start_test() ...@@ -559,6 +559,10 @@ start_test()
echo "Test failed to start" echo "Test failed to start"
return 1 return 1
fi fi
mount --make-private "$ZDTM_ROOT"
umount -l "$ZDTM_ROOT"
mount --make-private --bind . $ZDTM_ROOT || return 1
} }
stop_test() stop_test()
......
...@@ -36,7 +36,7 @@ static int prepare_mntns() ...@@ -36,7 +36,7 @@ static int prepare_mntns()
* under them. So we need to create another mount for the * under them. So we need to create another mount for the
* new root. * new root.
*/ */
if (mount("/", "/", NULL, MS_PRIVATE | MS_REC, NULL)) { if (mount(root, root, NULL, MS_SLAVE , NULL)) {
fprintf(stderr, "Can't bind-mount root: %m\n"); fprintf(stderr, "Can't bind-mount root: %m\n");
return -1; return -1;
} }
...@@ -72,6 +72,11 @@ static int prepare_mntns() ...@@ -72,6 +72,11 @@ static int prepare_mntns()
return -1; return -1;
} }
if (mount("./old", "./old", NULL, MS_PRIVATE | MS_REC , NULL)) {
fprintf(stderr, "Can't bind-mount root: %m\n");
return -1;
}
if (mkdir("proc", 0777) && errno != EEXIST) { if (mkdir("proc", 0777) && errno != EEXIST) {
fprintf(stderr, "mkdir(proc) failed: %m\n"); fprintf(stderr, "mkdir(proc) failed: %m\n");
return -1; return -1;
......
...@@ -187,6 +187,7 @@ TST_DIR = \ ...@@ -187,6 +187,7 @@ TST_DIR = \
mntns_shared_bind \ mntns_shared_bind \
mntns_shared_bind02 \ mntns_shared_bind02 \
mntns_root_bind \ mntns_root_bind \
mnt_ext_auto \
TST_DIR_FILE = \ TST_DIR_FILE = \
chroot \ chroot \
......
#include <sys/mount.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <linux/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "zdtmtst.h"
const char *test_doc = "Run busy loop while migrating";
const char *test_author = "Roman Kagan <rkagan@parallels.com>";
char *dirname = "mnt_ext_auto.test";
TEST_OPTION(dirname, string, "directory name", 1);
int main(int argc, char ** argv)
{
char src[PATH_MAX], dst[PATH_MAX], *root;
char *dname = "/tmp/zdtm_ext_auto.XXXXXX";
int status;
pid_t pid;
root = getenv("ZDTM_ROOT");
if (root == NULL) {
err("root");
return 1;
}
sprintf(dst, "%s/ext_mounts", getenv("ZDTM_ROOT"));
if (strcmp(getenv("ZDTM_NEWNS"), "1"))
goto test;
pid = fork();
if (pid < 0)
return 1;
if (pid == 0) {
test_ext_init(argc, argv);
mkdir(dname, 755);
sprintf(src, "%s/test", dname);
if (mount("zdtm_auto_ext_mnt", dname, "tmpfs", 0, NULL)) {
err("mount");
return 1;
}
mkdir(src, 755);
mkdir(dst, 755);
if (mount(src, dst, NULL, MS_BIND, NULL)) {
err("bind");
return 1;
}
return 0;
}
wait(&status);
if (status != 0)
return 1;
test:
test_init(argc, argv);
test_daemon();
test_waitsig();
pass();
return 0;
}
--ext-mount-map auto --enable-external-sharing
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment