]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
ext4: add _require_ext4_mkfs_feature to check different features
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Thu, 2 Mar 2017 06:03:12 +0000 (14:03 +0800)
committerEryu Guan <eguan@redhat.com>
Thu, 2 Mar 2017 06:51:56 +0000 (14:51 +0800)
1) We add _require_ext4_mkfs_feature to check the specified
   feature whether it is available in mkfs.ext4 or not.

2) We apply _require_ext4_mkfs_feature in ext4/003 and remove
   _require_mkfs_mkfs_bigalloc.

3) We add _require_ext4_mkfs_feature in ext4/306.  When 64bit
   feature is supported by mkfs.ext4, ext4/306 could skip.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/rc
tests/ext4/003
tests/ext4/306

index 27f7c041c139c91a888279f332d461c64072ff68..109325df714895d9c8c999d811a376d0f469f2f8 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1761,12 +1761,22 @@ _require_scratch_ext4_crc()
        _scratch_unmount
 }
 
-# this test requires the bigalloc feature to be available in mkfs.ext4
-#
-_require_ext4_mkfs_bigalloc()
+# Check the specified feature whether it is available in mkfs.ext4 or not.
+_require_ext4_mkfs_feature()
 {
-       $MKFS_EXT4_PROG -F -O bigalloc -n $SCRATCH_DEV 512m >/dev/null 2>&1 \
-          || _notrun "mkfs.ext4 doesn't have bigalloc feature"
+       local feature=$1
+       local testfile=/tmp/$$.ext4_mkfs
+
+       if [ -z "$feature" ]; then
+                echo "Usage: _require_ext4_mkfs_feature feature"
+                exit 1
+        fi
+
+       touch $testfile
+       local result=$($MKFS_EXT4_PROG -F -O $feature -n $testfile 512m 2>&1)
+       rm -f $testfile
+       echo $result | grep -q "Invalid filesystem option" && \
+               _notrun "mkfs.ext4 doesn't support $feature feature"
 }
 
 # this test requires the ext4 kernel support bigalloc feature
index 53875a94dd59ffd0f1c39437f2f72ff3c23f5588..9be401789fdc3cc56d9c1d4a97e56603636d9d4c 100755 (executable)
@@ -38,7 +38,7 @@ _supported_fs ext4
 _supported_os Linux
 
 _require_scratch
-_require_ext4_mkfs_bigalloc
+_require_ext4_mkfs_feature "bigalloc"
 _require_ext4_bigalloc
 
 rm -f $seqres.full
index fa3b782db8348af278cbfb6bac4d3383fd0816c1..be765e6a67b176528a6264ee79fbdb011fa38118 100755 (executable)
@@ -44,6 +44,7 @@ _supported_fs ext4
 _supported_os Linux
 
 _require_scratch
+_require_ext4_mkfs_feature "64bit"
 
 rm -f $seqres.full