diff mbox

[v3] xfstests: update xfs/096 for new behaviour

Message ID 1467389674-5341-1-git-send-email-jtulak@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Tulak July 1, 2016, 4:14 p.m. UTC
Because we recently changed how mkfs behaves when it gets incorrect/invalid
values, add a feature check to run this test only on older binaries, which
accepts invalid sunit values.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
UPDATE:
Change it to _notrun on newer binaries. Commit message updated respectivvely.
---
 tests/xfs/096 | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Comments

Eryu Guan July 13, 2016, 10:38 a.m. UTC | #1
On Fri, Jul 01, 2016 at 06:14:34PM +0200, Jan Tulak wrote:
> Because we recently changed how mkfs behaves when it gets incorrect/invalid
> values, add a feature check to run this test only on older binaries, which
> accepts invalid sunit values.
> 
> Signed-off-by: Jan Tulak <jtulak@redhat.com>
> ---
> UPDATE:
> Change it to _notrun on newer binaries. Commit message updated respectivvely.
> ---
>  tests/xfs/096 | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/xfs/096 b/tests/xfs/096
> index f949e83..803b49d 100755
> --- a/tests/xfs/096
> +++ b/tests/xfs/096
> @@ -39,6 +39,20 @@ _cleanup()
>      rm -f $tmp.*
>  }
>  
> +# maximum log record size
> +max_lr_size=`expr 256 \* 1024`
> +big_su=`expr $max_lr_size + 4096`
> +
> +requires_mkfs_accept_invalid_log_sunit()
> +{
> +	accepts=`mkfs.xfs -N -l version=2,su=$big_su 2>&1 | \
> +		grep -ci "No device name"`
> +	if [ "$accepts" -eq 0 ];then
> +		_notrun "Runs only on older xfsprogs accepting invalid log sunit"
> +	fi

You're counting the number of "No device name" string, which doesn't
seem reliable to me. I'd prefer to rely on whether mkfs.xfs really
accepts invalid log sunit, so how about:

require_mkfs_accept_invalid_log_sunit()
{
	local fsimg=$tmp.img
	touch $fsimg

	$MKFS_XFS_PROG -N -l version=2,su=$big_su -d name=$fsimg,size=1g >/dev/null 2>&1
	if [ $? -ne 0 ]; then
		_notrun "This test requires v4.5 or older xfsprogs"
	fi
}

(These mkfs argument checks went to v4.7-rc1, and v4.5 is the latest
"older" xfsprogs, right?)

Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Tulak July 14, 2016, 10:25 a.m. UTC | #2
On Wed, Jul 13, 2016 at 12:38 PM, Eryu Guan <eguan@redhat.com> wrote:
> On Fri, Jul 01, 2016 at 06:14:34PM +0200, Jan Tulak wrote:
>> Because we recently changed how mkfs behaves when it gets incorrect/invalid
>> values, add a feature check to run this test only on older binaries, which
>> accepts invalid sunit values.
>>
>> Signed-off-by: Jan Tulak <jtulak@redhat.com>
>> ---
>> UPDATE:
>> Change it to _notrun on newer binaries. Commit message updated respectivvely.
>> ---
>>  tests/xfs/096 | 22 ++++++++++++++++++----
>>  1 file changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/tests/xfs/096 b/tests/xfs/096
>> index f949e83..803b49d 100755
>> --- a/tests/xfs/096
>> +++ b/tests/xfs/096
>> @@ -39,6 +39,20 @@ _cleanup()
>>      rm -f $tmp.*
>>  }
>>
>> +# maximum log record size
>> +max_lr_size=`expr 256 \* 1024`
>> +big_su=`expr $max_lr_size + 4096`
>> +
>> +requires_mkfs_accept_invalid_log_sunit()
>> +{
>> +     accepts=`mkfs.xfs -N -l version=2,su=$big_su 2>&1 | \
>> +             grep -ci "No device name"`
>> +     if [ "$accepts" -eq 0 ];then
>> +             _notrun "Runs only on older xfsprogs accepting invalid log sunit"
>> +     fi
>
> You're counting the number of "No device name" string, which doesn't
> seem reliable to me. I'd prefer to rely on whether mkfs.xfs really
> accepts invalid log sunit, so how about:
>
> require_mkfs_accept_invalid_log_sunit()
> {
>         local fsimg=$tmp.img
>         touch $fsimg
>
>         $MKFS_XFS_PROG -N -l version=2,su=$big_su -d name=$fsimg,size=1g >/dev/null 2>&1
>         if [ $? -ne 0 ]; then
>                 _notrun "This test requires v4.5 or older xfsprogs"
>         fi
> }

This looks better, but I'm ditching this detection entirely. I will go
for the common/rc solution and use the code from xfs/400, only
inverted. That seems to me like a better way in long term, and it
makes the new common/rc _requires a bit more useful.

>
> (These mkfs argument checks went to v4.7-rc1, and v4.5 is the latest
> "older" xfsprogs, right?)

Yes, according to VERSION file and tags in the repo.


Thanks,
Jan
diff mbox

Patch

diff --git a/tests/xfs/096 b/tests/xfs/096
index f949e83..803b49d 100755
--- a/tests/xfs/096
+++ b/tests/xfs/096
@@ -39,6 +39,20 @@  _cleanup()
     rm -f $tmp.*
 }
 
+# maximum log record size
+max_lr_size=`expr 256 \* 1024`
+big_su=`expr $max_lr_size + 4096`
+
+requires_mkfs_accept_invalid_log_sunit()
+{
+	accepts=`mkfs.xfs -N -l version=2,su=$big_su 2>&1 | \
+		grep -ci "No device name"`
+	if [ "$accepts" -eq 0 ];then
+		_notrun "Runs only on older xfsprogs accepting invalid log sunit"
+	fi
+	return 1
+}
+
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/filter
@@ -97,6 +111,9 @@  mkfs_filter()
    | grep -v parent
 }
 
+# skip on newer versions
+requires_mkfs_accept_invalid_log_sunit
+
 # real QA test starts here
 rm -f $seqres.full
 
@@ -108,16 +125,13 @@  _require_v2log
 
 # choose .out file based on internal/external log
 rm -f $seqfull.out
+
 if [ "$USE_EXTERNAL" = yes ]; then
 	ln -s $seq.out.external $seqfull.out
 else
 	ln -s $seq.out.internal $seqfull.out
 fi
 
-# maximum log record size
-max_lr_size=`expr 256 \* 1024`
-
-big_su=`expr $max_lr_size + 4096`
 
 #
 # Test out various mkfs param combinations