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 <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Xiao Yang
2016-08-18 11:09:16 +08:00
committed by Eryu Guan
parent 2a084ec451
commit 6e21e45539
+10 -6
View File
@@ -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