[2/4] zdtm: check enabled file systems

Submitted by Andrei Vagin on April 28, 2016, 4:53 p.m.

Details

Message ID 1461862429-1032-2-git-send-email-avagin@openvz.org
State Accepted
Series "Series without cover letter"
Commit 2bad22d9738daabee1b558091c842115b8ddd995
Headers show

Commit Message

Andrei Vagin April 28, 2016, 4:53 p.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 43b01aa..63b2843 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -234,6 +234,7 @@  TST_DIR		=				\
 		mntns_deleted			\
 		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" }

Comments

Pavel Emelianov May 6, 2016, 12:11 p.m.
> 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

WTH is that?
Andrey Vagin May 6, 2016, 4:34 p.m.
On Fri, May 06, 2016 at 03:11:46PM +0300, Pavel Emelyanov wrote:
> 
> > 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
> 
> WTH is that?
>

nfsd is used to check --enable-fd. Here I check that it can be mounted
on this host.
Pavel Emelianov May 6, 2016, 5:22 p.m.
On 05/06/2016 07:34 PM, Andrew Vagin wrote:
> On Fri, May 06, 2016 at 03:11:46PM +0300, Pavel Emelyanov wrote:
>>
>>> 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
>>
>> WTH is that?
>>
> 
> nfsd is used to check --enable-fd. Here I check that it can be mounted
> on this host.

Isn't fgrep nfsd /proc/filesystems enough?
Andrey Vagin May 6, 2016, 11:08 p.m.
On Fri, May 06, 2016 at 08:22:33PM +0300, Pavel Emelyanov wrote:
> On 05/06/2016 07:34 PM, Andrew Vagin wrote:
> > On Fri, May 06, 2016 at 03:11:46PM +0300, Pavel Emelyanov wrote:
> >>
> >>> 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
> >>
> >> WTH is that?
> >>
> > 
> > nfsd is used to check --enable-fd. Here I check that it can be mounted
> > on this host.
> 
> Isn't fgrep nfsd /proc/filesystems enough?

the mount comman will try to load a module with this fs

>
Pavel Emelianov May 11, 2016, 1:11 p.m.
Applied