public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH v3 1/5] fstests: implement require of multiple overlayfs features
Date: Sun, 28 Jan 2018 11:22:32 +0200	[thread overview]
Message-ID: <1517131356-8048-2-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1517131356-8048-1-git-send-email-amir73il@gmail.com>

Some overlayfs features must be checked together, because they cannot
be enabled without a dependent feature (e.g. nfs_export and index).

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 common/overlay | 23 ++++++++++++++++++++---
 common/rc      | 15 +++++++++------
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/common/overlay b/common/overlay
index 1da4ab1..38fe994 100644
--- a/common/overlay
+++ b/common/overlay
@@ -138,9 +138,6 @@ _require_scratch_overlay_feature()
 	[ "$default" = Y ] || [ "$default" = N ] || \
 		_notrun "feature '${feature}' not supported by ${FSTYP}"
 
-	_scratch_mkfs > /dev/null 2>&1
-	_scratch_mount -o ${feature}=on || \
-		_notrun "${FSTYP} feature '${feature}' cannot be enabled on ${SCRATCH_DEV}"
 	# Check options to be sure. For example, Overlayfs will fallback to
 	# index=off if underlying fs does not support file handles.
 	# Overlayfs only displays mount option if it differs from the default.
@@ -149,5 +146,25 @@ _require_scratch_overlay_feature()
 	  ( [ "$default" = Y ] && ! _fs_options $SCRATCH_DEV | grep -q "${feature}=off" )) && \
 	    touch $SCRATCH_MNT/foo 2>/dev/null ) || \
 	        _notrun "${FSTYP} feature '${feature}' cannot be enabled on ${SCRATCH_DEV}"
+}
+
+# Require a set of overlayfs features
+_require_scratch_overlay_features()
+{
+	local features=( $* )
+	local opts="rw"
+
+	for feature in ${features[*]}; do
+		opts+=",${feature}=on"
+	done
+
+	_scratch_mkfs > /dev/null 2>&1
+	_scratch_mount -o $opts || \
+		_notrun "overlay options '$opts' cannot be enabled on ${SCRATCH_DEV}"
+
+	for feature in ${features[*]}; do
+		_require_scratch_overlay_feature ${feature}
+	done
+
 	_scratch_unmount
 }
diff --git a/common/rc b/common/rc
index 77a4eb4..3b81061 100644
--- a/common/rc
+++ b/common/rc
@@ -3658,22 +3658,25 @@ _get_fs_sysfs_attr()
 	cat /sys/fs/${FSTYP}/${dname}/${attr}
 }
 
-# Generic test for specific filesystem feature.
+# Generic test for specific filesystem features.
 # Currently only implemented to test overlayfs features.
-_require_scratch_feature()
+_require_scratch_features()
 {
-	local feature=$1
-
 	case "$FSTYP" in
 	overlay)
-		_require_scratch_overlay_feature ${feature}
+		_require_scratch_overlay_features $*
 		;;
 	*)
-		_fail "Test for feature '${feature}' of ${FSTYP} is not implemented"
+		_fail "Test for features '$*' of ${FSTYP} is not implemented"
 		;;
 	esac
 }
 
+_require_scratch_feature()
+{
+	_require_scratch_features $1
+}
+
 init_rc
 
 ################################################################################
-- 
2.7.4


  reply	other threads:[~2018-01-28  9:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-28  9:22 [PATCH v3 0/5] Overlayfs exportfs tests Amir Goldstein
2018-01-28  9:22 ` Amir Goldstein [this message]
2018-01-29 14:33   ` [PATCH v3 1/5] fstests: implement require of multiple overlayfs features Eryu Guan
2018-01-29 17:06     ` Amir Goldstein
2018-01-30  4:52       ` Eryu Guan
2018-01-28  9:22 ` [PATCH v3 2/5] overlay: test encode/decode overlay file handles Amir Goldstein
2018-01-29 14:39   ` Eryu Guan
2018-01-29 17:23     ` Amir Goldstein
2018-01-30  4:54       ` Eryu Guan
2018-01-28  9:22 ` [PATCH v3 3/5] overlay: test encode/decode of non-samefs " Amir Goldstein
2018-01-28  9:22 ` [PATCH v3 4/5] overlay: test encode/decode overlay file handles with renames Amir Goldstein
2018-01-28  9:22 ` [PATCH v3 5/5] overlay: test encode/decode of non-samefs " Amir Goldstein
2018-01-28 10:59 ` [PATCH v3 0/5] Overlayfs exportfs tests Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517131356-8048-2-git-send-email-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox