Re: [PATCH blktests v2 02/11] common/xfs: Create common helper to check for XFS support

From: Logan Gunthorpe
Date: Tue Oct 06 2020 - 19:55:55 EST




On 2020-10-06 5:44 p.m., Chaitanya Kulkarni wrote:
> On 9/30/20 11:54, Logan Gunthorpe wrote:
>>
>> requires() {
>> _nvme_requires
>> - _have_program mkfs.xfs && _have_fio
>> + _have_xfs
>> + _have_fio
> Can you make _have_xfs return true false ? so it can be used with && ?

_have_xfs() does return true/false and can be used with && or in a
conditional.

Per [1], my opinion is that using && in the requires() function where
the return value is ignored is confusing so I prefer not to do it in new
code.

If we want to reconsider this we, should add a check to ensure the
return value of requires() matches the expectation of the global
variable it uses.

Logan

[1]
https://lore.kernel.org/linux-block/92478e6f-622a-a1ae-6189-4009f9a307bc@xxxxxxxxxxxx/