[CRIU] [PATCH 4/4] zdtm: add a new test to check escaped charecter in mountinfo
Andrey Vagin
avagin at openvz.org
Fri Jul 17 07:40:25 PDT 2015
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm.sh | 3 ++
test/zdtm/live/static/Makefile | 1 +
test/zdtm/live/static/mount_paths.c | 57 +++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+)
create mode 100644 test/zdtm/live/static/mount_paths.c
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 6869a50..e7c0e6f 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -182,6 +182,7 @@ generate_test_list()
ns/static/session00
ns/static/session01
ns/static/tempfs
+ ns/static/mount_paths
ns/static/bind-mount
static/utsname
static/ipc_namespace
@@ -271,6 +272,7 @@ generate_test_list()
ns/static/dumpable02
ns/static/deleted_dev
ns/static/tempfs
+ ns/static/mount_paths
ns/static/clean_mntns
ns/static/mntns_link_remap
ns/static/mntns_link_ghost
@@ -339,6 +341,7 @@ mntns_shared_bind
mntns_shared_bind02
mntns_root_bind
mntns_rw_ro_rw
+mount_paths
netns-dev
sockets00
cow01
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index b245e46..8e98ac8 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -178,6 +178,7 @@ TST_DIR = \
overmount_fifo \
overmount_sock \
tempfs \
+ mount_paths \
bind-mount \
inotify00 \
cgroup00 \
diff --git a/test/zdtm/live/static/mount_paths.c b/test/zdtm/live/static/mount_paths.c
new file mode 100644
index 0000000..543d8b7
--- /dev/null
+++ b/test/zdtm/live/static/mount_paths.c
@@ -0,0 +1,57 @@
+#include <stdbool.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <linux/limits.h>
+
+#include "zdtmtst.h"
+
+const char *test_doc = "Check that special charecters in paths are handled correctly";
+const char *test_author = "Andrew Vagin <avagin at virtuozzo.com>";
+
+char *dirname;
+TEST_OPTION(dirname, string, "directory name", 1);
+
+#define TEST_DIR "tmpfs \t \t\\\\\t test \t\t\\\\ \t\\"
+
+int main(int argc, char **argv)
+{
+ int ret = 1;
+ char buf[1024], test_dir[PATH_MAX], fname[PATH_MAX];
+
+ test_init(argc, argv);
+
+ mkdir(dirname, 0700);
+
+ snprintf(test_dir, sizeof(test_dir), "%s/%s", dirname, TEST_DIR);
+ mkdir(test_dir, 0700);
+
+ if (mount("", test_dir, "tmpfs", 0, NULL)) {
+ err("mount");
+ return 1;
+ }
+
+ snprintf(fname, sizeof(buf), "%s/\\\t \\\\ \\tt", test_dir);
+ if (mkdir(fname, 0700)) {
+ err("mkdir");
+ return 1;
+ }
+
+ test_daemon();
+ test_waitsig();
+
+ if (access(fname, F_OK)) {
+ fail();
+ goto err;
+ }
+
+ pass();
+ ret = 0;
+err:
+ umount2(test_dir, MNT_DETACH);
+ rmdir(test_dir);
+ rmdir(dirname);
+ return ret;
+}
--
2.1.0
More information about the CRIU
mailing list