Add a simple way to skip a test if it is (or is not) run on mkfs correctly validating inputs. Signed-off-by: Jan Tulak <jtulak@xxxxxxxxxx> --- common/rc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/common/rc b/common/rc index 0c68e4f..72f9901 100644 --- a/common/rc +++ b/common/rc @@ -3843,6 +3843,35 @@ _get_fs_sysfs_attr() cat /sys/fs/${FSTYP}/${dname}/${attr} } +# Skip if we are running an older binary without the stricter input checks. +# Make multiple checks to be sure that there is no regression on the one +# selected feature check, which would skew the result. +_require_xfs_mkfs_validation() +{ + _require_scratch + $MKFS_XFS_PROG -f -N -s size=2s $SCRATCH_DEV >/dev/null 2>&1 + sum=$? + $MKFS_XFS_PROG -f -N -l version=2,su=$((256 * 1024 + 4096)) $SCRATCH_DEV >/dev/null 2>&1 + sum=`expr $sum + $?` + + if [ "$sum" -eq 0 ]; then + _notrun "Requires newer mkfs with stricter input checks." + fi +} + +# The oposite of _require_xfs_mkfs_validation. +_require_xfs_mkfs_without_validation() +{ + _require_scratch + $MKFS_XFS_PROG -f -N -s size=2s $SCRATCH_DEV >/dev/null 2>&1 + sum=$? + $MKFS_XFS_PROG -f -N -l version=2,su=$((256 * 1024 + 4096)) $SCRATCH_DEV >/dev/null 2>&1 + sum=`expr $sum + $?` + + if [ "$sum" -eq 2 ]; then + _notrun "Requires older mkfs without stricter input checks." + fi +} init_rc ################################################################################ -- 2.5.5 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html