From aee6cca66a2e9056e30a64f0eb13f87ee530538f Mon Sep 17 00:00:00 2001 From: Andrew Vagin Date: Thu, 28 Apr 2016 19:53:00 +0300 Subject: [PATCH] zdtm: check enabled file systems Signed-off-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- 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 5fab7c923..1477227f9 100644 --- a/test/zdtm/static/Makefile +++ b/test/zdtm/static/Makefile @@ -233,6 +233,7 @@ TST_DIR = \ mnt_ext_dev \ mntns_deleted \ unlink_regular00 \ + 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 000000000..3de4c57eb --- /dev/null +++ b/test/zdtm/static/mnt_enablefs.c @@ -0,0 +1,43 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "zdtmtst.h" + +const char *test_doc = "Check enabled file systems (--enable-fs)"; +const char *test_author = "Andrei Vagin "; + +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 000000000..121f0578a --- /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 000000000..eb5767a68 --- /dev/null +++ b/test/zdtm/static/mnt_enablefs.desc @@ -0,0 +1 @@ +{'flavor': 'ns', 'feature': 'mnt_id', "flags": "suid", "opts" : "--enable-fs nfsd" }