Skip to contentSkip to conversation

fstests: introduce _require_no_mount_opts helper

PATCH Superseded Eryu Guan 1 participant 2 messages Jan 18, 2016

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/2 fstests: introduce _require_no_mount_opts helper

Some tests require there's no certain mount option, so introduce a new helper _require_no_mount_opts() to do the check on $MOUNT_OPTIONS.

Also convert generic/192 and xfs/134 to use this helper.

---
 common/rc         |  8 ++++++++
 tests/generic/192 | 11 -----------
 tests/xfs/134     |  8 +++-----
 3 files changed, 11 insertions(+), 16 deletions(-)
common/rc +8 -0
index e3aa334..57e4403 100644
@@ -2794,8 +2794,16 @@ _require_cloner()
 		_notrun "cloner binary not present at $CLONER_PROG"
 }
 
+_require_no_mount_opts()
+{
+	if echo $MOUNT_OPTIONS | grep -q "$1"; then
+		_notrun "mount option \"$1\" not allowed in this test"
+	fi
+}
+
 _require_atime()
 {
+	_require_no_mount_opts "noatime"
 	if [ "$FSTYP" == "nfs" ]; then
 		_notrun "atime related mount options have no effect on NFS"
 	fi
tests/generic/192 +0 -11
index ebabea2..7298283 100755
@@ -38,13 +38,6 @@ _access_time()
 	stat -c %X $1
 }
 
-is_noatime_set() {
-	case "$MOUNT_OPTIONS" in
-		*noatime*) return 0;;
-	esac
-	return 1
-}
-
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/filter
@@ -61,10 +54,6 @@ _require_atime
 #delay=45
 delay=40
 
-if is_noatime_set; then
-	_notrun "this test makes no sense with noatime"
-fi
-
 testfile=$TEST_DIR/testfile
 rm -f $testfile
 rm -f $seqres.full
tests/xfs/134 +3 -5
index be18ee8..d6927bd 100755
@@ -50,6 +50,9 @@ _supported_os Linux IRIX
 
 _require_test
 _require_xfs_quota
+# we can't run with group quotas
+_require_no_mount_opts "gquota"
+_require_no_mount_opts "grpquota"
 
 dir=$SCRATCH_MNT/project
 
@@ -70,11 +73,6 @@ _scratch_mkfs_xfs >/dev/null 2>&1
 
 #if pquota's already in mount options then we dont need to enable
 
-# we can't run with group quotas
-if ( `echo $MOUNT_OPTIONS | grep -q gquota` || `echo $MOUNT_OPTIONS | grep -q grpquota` )
-then
-    _notrun "Can't run with group quotas enabled"
-fi
 EXTRA_MOUNT_OPTIONS="-o pquota"
 
 if ! _scratch_mount "$EXTRA_MOUNT_OPTIONS" >$tmp.out 2>&1
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 2/2 ext4/271: _notrun if there are journal related mount options

ext4/271 runs in no journal mode (-onoload), so running test with journal related mount options makes no sense, and test fails after kernel commit 1e381f60dad9 ("ext4: do not allow journal_opts for fs w/o journal") journal related mount options are not allowed in no journal mode. So just _notrun if there're journal related mount options.

---
 tests/ext4/271 | 5 +++++
 1 file changed, 5 insertions(+)
tests/ext4/271 +5 -0
index 217d0d8..c8e41e9 100755
@@ -40,6 +40,11 @@ _supported_fs ext4
 _supported_os Linux
 _need_to_be_root
 _require_scratch
+# this test needs no journal to be loaded, skip on journal related mount options
+_require_no_mount_opts "data="
+_require_no_mount_opts "commit="
+_require_no_mount_opts "journal_checksum"
+_require_no_mount_opts "journal_async_commit"
 
 rm -f $seqres.full
 _scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1
Signature · 1 line
1.8.3.1