[CRIU] [PATCH 2/4] zdtm: check enabled file systems

Andrey Vagin avagin at openvz.org
Thu Apr 21 22:58:43 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 test/zdtm/static/Makefile               |  1 +
 test/zdtm/static/mnt_enablefs.c         | 43 +++++++++++++++++++++++++++++++++
 test/zdtm/static/mnt_enablefs.checkskip |  3 +++
 test/zdtm/static/mnt_enablefs.desc      |  1 +
 4 files changed, 48 insertions(+)
 create mode 100644 test/zdtm/static/mnt_enablefs.c
 create mode 100755 test/zdtm/static/mnt_enablefs.checkskip
 create mode 100644 test/zdtm/static/mnt_enablefs.desc

diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 8706e59..2811bac 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -233,6 +233,7 @@ TST_DIR		=				\
 		binfmt_misc			\
 		unlink_regular00		\
 		autofs				\
+		mnt_enablefs			\
 
 TST_DIR_FILE	=				\
 		chroot				\
diff --git a/test/zdtm/static/mnt_enablefs.c b/test/zdtm/static/mnt_enablefs.c
new file mode 100644
index 0000000..3de4c57
--- /dev/null
+++ b/test/zdtm/static/mnt_enablefs.c
@@ -0,0 +1,43 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <linux/limits.h>
+
+#include "zdtmtst.h"
+
+const char *test_doc	= "Check enabled file systems (--enable-fs)";
+const char *test_author	= "Andrei Vagin <avagin at virtuozzo.com>";
+
+char *dirname;
+TEST_OPTION(dirname, string, "directory name", 1);
+
+int main(int argc, char **argv)
+{
+	char fname[PATH_MAX];
+
+	test_init(argc, argv);
+
+	mkdir(dirname, 0777);
+
+	if (mount("zdtm_nfsd", dirname, "nfsd", 0, NULL) == -1) {
+		pr_perror("mount");
+		return -1;
+	}
+
+	snprintf(fname, sizeof(fname), "%s/exports", dirname);
+
+	test_daemon();
+	test_waitsig();
+
+	if (access(fname, F_OK))
+		fail();
+
+	pass();
+
+	return 0;
+}
diff --git a/test/zdtm/static/mnt_enablefs.checkskip b/test/zdtm/static/mnt_enablefs.checkskip
new file mode 100755
index 0000000..121f057
--- /dev/null
+++ b/test/zdtm/static/mnt_enablefs.checkskip
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+unshare -m --propagation private mount -t nfsd nfsd /mnt
diff --git a/test/zdtm/static/mnt_enablefs.desc b/test/zdtm/static/mnt_enablefs.desc
new file mode 100644
index 0000000..eb5767a
--- /dev/null
+++ b/test/zdtm/static/mnt_enablefs.desc
@@ -0,0 +1 @@
+{'flavor': 'ns', 'feature': 'mnt_id', "flags": "suid", "opts" : "--enable-fs nfsd" }
-- 
2.5.5



More information about the CRIU mailing list