diff mbox series

common/rc: Fix _require_batched_discard to skip test correctly

Message ID 20220531071252.30517-1-liuyd.fnst@fujitsu.com (mailing list archive)
State New, archived
Headers show
Series common/rc: Fix _require_batched_discard to skip test correctly | expand

Commit Message

liuyd.fnst@fujitsu.com May 31, 2022, 7:12 a.m. UTC
xfstest commit ee264b3f ("common/rc: Modify _require_batched_discard to
improve test coverage") changed the way of determing if discard is
supported by checking whether fstrim output contains "not supported"
keywords.

On RHEL, fstrim output below info when discard is not supported
"fstrim: /mnt/share0/: FITRIM ioctl failed: Function not implemented"

Supplyment unsupported keywords to _require_batched_discard.

Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Disseldorp June 1, 2022, 7:49 a.m. UTC | #1
On Tue, 31 May 2022 15:12:52 +0800, Liu Yiding wrote:

> xfstest commit ee264b3f ("common/rc: Modify _require_batched_discard to
> improve test coverage") changed the way of determing if discard is
> supported by checking whether fstrim output contains "not supported"
> keywords.
> 
> On RHEL, fstrim output below info when discard is not supported
> "fstrim: /mnt/share0/: FITRIM ioctl failed: Function not implemented"
> 
> Supplyment unsupported keywords to _require_batched_discard.
> 
> Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
> ---
>  common/rc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index 70a15f9c..eae9afc6 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4008,7 +4008,7 @@ _require_batched_discard()
>  	fi
>  	_require_fstrim
>  
> -	grep -q "not supported" <($FSTRIM_PROG $1 2>&1)
> +	grep -q -E "not supported|not implemented" <($FSTRIM_PROG $1 2>&1)
>  	if [ "$?" = "0" ]
>  	then
>  		_notrun "FITRIM not supported on $1"

Looks fine.
Reviewed-by: David Disseldorp <ddiss@suse.de>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 70a15f9c..eae9afc6 100644
--- a/common/rc
+++ b/common/rc
@@ -4008,7 +4008,7 @@  _require_batched_discard()
 	fi
 	_require_fstrim
 
-	grep -q "not supported" <($FSTRIM_PROG $1 2>&1)
+	grep -q -E "not supported|not implemented" <($FSTRIM_PROG $1 2>&1)
 	if [ "$?" = "0" ]
 	then
 		_notrun "FITRIM not supported on $1"