diff mbox series

[2/4] generic/594: Fix test failure for xfs on older quota-tools

Message ID 20211011075552.196688-3-anju@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show
Series Random fixes for xfstest | expand

Commit Message

Anju T Sudhakar Oct. 11, 2021, 7:55 a.m. UTC
For xfs we need the quota-tools containing commit fdd774bf08e568
("quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT")to run this
test. Otherwise this test will fail on xfs, as the grace time is not set
correctly. So check for the quota-tool with the required commit before
running this test on xfs.

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
---
 tests/generic/594 | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Dave Chinner Oct. 11, 2021, 8:32 a.m. UTC | #1
On Mon, Oct 11, 2021 at 01:25:50PM +0530, Anju T Sudhakar wrote:
> For xfs we need the quota-tools containing commit fdd774bf08e568
> ("quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT")to run this
> test. Otherwise this test will fail on xfs, as the grace time is not set
> correctly. So check for the quota-tool with the required commit before
> running this test on xfs.
> 
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> ---
>  tests/generic/594 | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/generic/594 b/tests/generic/594
> index 88f9a0dc..668c1fae 100755
> --- a/tests/generic/594
> +++ b/tests/generic/594
> @@ -6,6 +6,8 @@
>  #
>  # Test per-type(user, group and project) filesystem quota timers, make sure
>  # each of grace time can be set/get properly.
> +# For xfs, you need a quota-tools containing commit fdd774bf08e568 for this
> +# test to run properly- v4.06 should do.
>  #
>  . ./common/preamble
>  _begin_fstest auto quick quota
> @@ -18,9 +20,13 @@ _begin_fstest auto quick quota
>  _supported_fs generic
>  _require_scratch
>  _require_setquota_project
> +version=$(setquota -V | head -n1 | cut -d" " -f4)
>  # V4 XFS doesn't support to mount project and group quota together
>  if [ "$FSTYP" = "xfs" ];then
>  	_require_scratch_xfs_crc
> +	if [ "$version" \< "4.06" ];then
> +		_notrun "This test requires quota-tools 4.06 or greater"
> +	fi

We don't test for version numbers, because feature and bug fix back
ports make testing version numbers unreliable. What needs to be done
here is to test whether the feature is available of not via a
_require_setquota_xfs_getqstat() rule that encapsulates the feature
test and _notrun call if the feature is not supported.

Cheers,

Dave.
Darrick J. Wong Oct. 11, 2021, 4:46 p.m. UTC | #2
On Mon, Oct 11, 2021 at 01:25:50PM +0530, Anju T Sudhakar wrote:
> For xfs we need the quota-tools containing commit fdd774bf08e568
> ("quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT")to run this
> test. Otherwise this test will fail on xfs, as the grace time is not set
> correctly. So check for the quota-tool with the required commit before
> running this test on xfs.

This is a regression test for a kernel bug where Q_XGETQSTAT[V] ignores
the quota type that userspace specifies in the system call and instead
returns information about the first enabled quotatype.  It just so
happens that quota-tools /also/ had a bug where it would never send the
user's quota type to the kernel, so nobody noticed the nested herp and
derp.

The test should probably have mentioned kernel commit 555b2c3da1fc
("quota: honor quota type in Q_XGETQSTAT[V] calls") directly to make
this more obvious.

--D

> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> ---
>  tests/generic/594 | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/generic/594 b/tests/generic/594
> index 88f9a0dc..668c1fae 100755
> --- a/tests/generic/594
> +++ b/tests/generic/594
> @@ -6,6 +6,8 @@
>  #
>  # Test per-type(user, group and project) filesystem quota timers, make sure
>  # each of grace time can be set/get properly.
> +# For xfs, you need a quota-tools containing commit fdd774bf08e568 for this
> +# test to run properly- v4.06 should do.
>  #
>  . ./common/preamble
>  _begin_fstest auto quick quota
> @@ -18,9 +20,13 @@ _begin_fstest auto quick quota
>  _supported_fs generic
>  _require_scratch
>  _require_setquota_project
> +version=$(setquota -V | head -n1 | cut -d" " -f4)
>  # V4 XFS doesn't support to mount project and group quota together
>  if [ "$FSTYP" = "xfs" ];then
>  	_require_scratch_xfs_crc
> +	if [ "$version" \< "4.06" ];then
> +		_notrun "This test requires quota-tools 4.06 or greater"
> +	fi
>  fi
>  _require_quota
>  
> -- 
> 2.24.1
>
Eryu Guan Oct. 12, 2021, 2:57 a.m. UTC | #3
On Mon, Oct 11, 2021 at 09:46:52AM -0700, Darrick J. Wong wrote:
> On Mon, Oct 11, 2021 at 01:25:50PM +0530, Anju T Sudhakar wrote:
> > For xfs we need the quota-tools containing commit fdd774bf08e568
> > ("quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT")to run this
> > test. Otherwise this test will fail on xfs, as the grace time is not set
> > correctly. So check for the quota-tool with the required commit before
> > running this test on xfs.
> 
> This is a regression test for a kernel bug where Q_XGETQSTAT[V] ignores
> the quota type that userspace specifies in the system call and instead
> returns information about the first enabled quotatype.  It just so
> happens that quota-tools /also/ had a bug where it would never send the
> user's quota type to the kernel, so nobody noticed the nested herp and
> derp.
> 
> The test should probably have mentioned kernel commit 555b2c3da1fc
> ("quota: honor quota type in Q_XGETQSTAT[V] calls") directly to make
> this more obvious.

Agreed, and maybe mention the quota-tools commit as well.

Thanks,
Eryu

> 
> --D
> 
> > Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> > ---
> >  tests/generic/594 | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/tests/generic/594 b/tests/generic/594
> > index 88f9a0dc..668c1fae 100755
> > --- a/tests/generic/594
> > +++ b/tests/generic/594
> > @@ -6,6 +6,8 @@
> >  #
> >  # Test per-type(user, group and project) filesystem quota timers, make sure
> >  # each of grace time can be set/get properly.
> > +# For xfs, you need a quota-tools containing commit fdd774bf08e568 for this
> > +# test to run properly- v4.06 should do.
> >  #
> >  . ./common/preamble
> >  _begin_fstest auto quick quota
> > @@ -18,9 +20,13 @@ _begin_fstest auto quick quota
> >  _supported_fs generic
> >  _require_scratch
> >  _require_setquota_project
> > +version=$(setquota -V | head -n1 | cut -d" " -f4)
> >  # V4 XFS doesn't support to mount project and group quota together
> >  if [ "$FSTYP" = "xfs" ];then
> >  	_require_scratch_xfs_crc
> > +	if [ "$version" \< "4.06" ];then
> > +		_notrun "This test requires quota-tools 4.06 or greater"
> > +	fi
> >  fi
> >  _require_quota
> >  
> > -- 
> > 2.24.1
> >
Yang Xu (Fujitsu) Oct. 12, 2021, 5:25 a.m. UTC | #4
on 2021/10/12 10:57, Eryu Guan wrote:
> On Mon, Oct 11, 2021 at 09:46:52AM -0700, Darrick J. Wong wrote:
>> On Mon, Oct 11, 2021 at 01:25:50PM +0530, Anju T Sudhakar wrote:
>>> For xfs we need the quota-tools containing commit fdd774bf08e568
>>> ("quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT")to run this
>>> test. Otherwise this test will fail on xfs, as the grace time is not set
>>> correctly. So check for the quota-tool with the required commit before
>>> running this test on xfs.
>>
>> This is a regression test for a kernel bug where Q_XGETQSTAT[V] ignores
>> the quota type that userspace specifies in the system call and instead
>> returns information about the first enabled quotatype.  It just so
>> happens that quota-tools /also/ had a bug where it would never send the
>> user's quota type to the kernel, so nobody noticed the nested herp and
>> derp.
>>
>> The test should probably have mentioned kernel commit 555b2c3da1fc
>> ("quota: honor quota type in Q_XGETQSTAT[V] calls") directly to make
>> this more obvious.
>
> Agreed, and maybe mention the quota-tools commit as well.
I think recording kernel commit and package commit(not only in commit 
message but also in comment at the begin of test case) should become a 
habit when it is a regression test.  It is more friendly to user.

Best Regards
Yang Xu
>
> Thanks,
> Eryu
>
>>
>> --D
>>
>>> Signed-off-by: Anju T Sudhakar<anju@linux.vnet.ibm.com>
>>> ---
>>>   tests/generic/594 | 6 ++++++
>>>   1 file changed, 6 insertions(+)
>>>
>>> diff --git a/tests/generic/594 b/tests/generic/594
>>> index 88f9a0dc..668c1fae 100755
>>> --- a/tests/generic/594
>>> +++ b/tests/generic/594
>>> @@ -6,6 +6,8 @@
>>>   #
>>>   # Test per-type(user, group and project) filesystem quota timers, make sure
>>>   # each of grace time can be set/get properly.
>>> +# For xfs, you need a quota-tools containing commit fdd774bf08e568 for this
>>> +# test to run properly- v4.06 should do.
>>>   #
>>>   . ./common/preamble
>>>   _begin_fstest auto quick quota
>>> @@ -18,9 +20,13 @@ _begin_fstest auto quick quota
>>>   _supported_fs generic
>>>   _require_scratch
>>>   _require_setquota_project
>>> +version=$(setquota -V | head -n1 | cut -d" " -f4)
>>>   # V4 XFS doesn't support to mount project and group quota together
>>>   if [ "$FSTYP" = "xfs" ];then
>>>   	_require_scratch_xfs_crc
>>> +	if [ "$version" \<  "4.06" ];then
>>> +		_notrun "This test requires quota-tools 4.06 or greater"
>>> +	fi
>>>   fi
>>>   _require_quota
>>>
>>> --
>>> 2.24.1
>>>
>
>
diff mbox series

Patch

diff --git a/tests/generic/594 b/tests/generic/594
index 88f9a0dc..668c1fae 100755
--- a/tests/generic/594
+++ b/tests/generic/594
@@ -6,6 +6,8 @@ 
 #
 # Test per-type(user, group and project) filesystem quota timers, make sure
 # each of grace time can be set/get properly.
+# For xfs, you need a quota-tools containing commit fdd774bf08e568 for this
+# test to run properly- v4.06 should do.
 #
 . ./common/preamble
 _begin_fstest auto quick quota
@@ -18,9 +20,13 @@  _begin_fstest auto quick quota
 _supported_fs generic
 _require_scratch
 _require_setquota_project
+version=$(setquota -V | head -n1 | cut -d" " -f4)
 # V4 XFS doesn't support to mount project and group quota together
 if [ "$FSTYP" = "xfs" ];then
 	_require_scratch_xfs_crc
+	if [ "$version" \< "4.06" ];then
+		_notrun "This test requires quota-tools 4.06 or greater"
+	fi
 fi
 _require_quota