[2/4] zdtm: check enabled file systems

Submitted by Andrei Vagin on April 22, 2016, 5:58 a.m.

Details

Message ID 1461304725-25889-2-git-send-email-avagin@openvz.org
State Rejected
Series "Series without cover letter"
Headers show

Commit Message

Andrei Vagin April 22, 2016, 5:58 a.m.
From: Andrew Vagin <avagin@virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin@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

Patch hide | download patch | download mbox

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@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" }