From: Xiao Yang Date: Thu, 18 Aug 2016 03:09:16 +0000 (+0800) Subject: xfs/191: skip tests on older xfsprogs X-Git-Tag: v2022.05.01~2389 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6e21e45539c320c277c29a2c028b669f843f2160;p=users%2Fhch%2Fxfstests-dev.git xfs/191: skip tests on older xfsprogs 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 Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/common/rc b/common/rc index 3fb060090..e6831b502 100644 --- 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