]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs/191: skip tests on older xfsprogs
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Thu, 18 Aug 2016 03:09:16 +0000 (11:09 +0800)
committerEryu Guan <eguan@redhat.com>
Fri, 26 Aug 2016 07:29:49 +0000 (15:29 +0800)
If we don't have temp file used to test on xfsprogs 3.2.2,
_require_xfs_mkfs_validation will fail because mkfs.xfs can't create
this file. We need to skip tests before xfsprogs 4.7.0, so fix it.

This feature was introduced in xfsprogs 4.2.0 by commit 20cec860e16b
("mkfs.xfs: always use underlying fs sector size when mkfs'ing a
file")

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

index 3fb0600909f06e5266bdc698e7a9c5cff2a795c0..e6831b502d11ad7417fa0cf958befd33b47f5dd9 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -3894,21 +3894,25 @@ _get_fs_sysfs_attr()
 #
 # At first, make a common function that runs the tests and returns
 # number of failed cases.
-_mkfs_validation_check()
+_xfs_mkfs_validation_check()
 {
-       local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
+       local tmpfile=`mktemp`
+       local cmd="$MKFS_XFS_PROG -f -N -d file,name=$tmpfile,size=1g"
+
        $cmd -s size=2s >/dev/null 2>&1
        local sum=$?
-       $cmd -l version=2,su=$((256 * 1024 + 4096)) >/dev/null 2>&1
+
+       $cmd -l version=2,su=260k >/dev/null 2>&1
        sum=`expr $sum + $?`
-       rm -f /tmp/foo
+
+       rm -f $tmpfile
        return $sum
 }
 
 # Skip the test if all calls passed - mkfs accepts invalid input
 _require_xfs_mkfs_validation()
 {
-       _mkfs_validation_check
+       _xfs_mkfs_validation_check
        if [ "$?" -eq 0 ]; then
                _notrun "Requires newer mkfs with stricter input checks: the oldest supported version of xfsprogs is 4.7."
        fi
@@ -3917,7 +3921,7 @@ _require_xfs_mkfs_validation()
 # The oposite of _require_xfs_mkfs_validation.
 _require_xfs_mkfs_without_validation()
 {
-       _mkfs_validation_check
+       _xfs_mkfs_validation_check
        if [ "$?" -ne 0 ]; then
                _notrun "Requires older mkfs without strict input checks: the last supported version of xfsprogs is 4.5."
        fi