]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: introduce _exclude_scratch_mount_option helper
authorEryu Guan <eguan@redhat.com>
Thu, 23 Jun 2016 06:09:46 +0000 (14:09 +0800)
committerEryu Guan <eguan@redhat.com>
Fri, 24 Jun 2016 04:54:01 +0000 (12:54 +0800)
Some tests require that there's no certain mount option in
MKFS_OPTIONS, so introduce a new helper
_exclude_scratch_mount_option() to do the check on $MOUNT_OPTIONS.

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

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/rc
tests/generic/192
tests/xfs/134

index 3a9c4d1cff128a032b6b8a2b6f264278118820ee..883bd7b9ce9a7d3ea40aaeddb5f81e75ebbab343 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2926,8 +2926,17 @@ _require_cloner()
                _notrun "cloner binary not present at $CLONER_PROG"
 }
 
+# skip test if MKFS_OPTIONS contains the given string
+_exclude_scratch_mount_option()
+{
+       if echo $MOUNT_OPTIONS | grep -q "$1"; then
+               _notrun "mount option \"$1\" not allowed in this test"
+       fi
+}
+
 _require_atime()
 {
+       _exclude_scratch_mount_option "noatime"
        if [ "$FSTYP" == "nfs" ]; then
                _notrun "atime related mount options have no effect on NFS"
        fi
index 6bbc87cec89af57112af41299a56978e494d768b..d3ed0ec080631fadcb253e00ad2c617ded498731 100755 (executable)
@@ -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
index cd470691c307d8185b4ba68528e52dd8b5adeeab..b3a110732dd49aa9869eba910dae1fb0568c33ed 100755 (executable)
@@ -50,6 +50,9 @@ _supported_os Linux IRIX
 
 _require_test
 _require_xfs_quota
+# we can't run with group quotas
+_exclude_scratch_mount_option "gquota"
+_exclude_scratch_mount_option "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