diff mbox series

[3/3] xfs/515: Check xfsprogs version for testing xfs_quota commands

Message ID 20210628085259.120666-4-anju@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show
Series xfstest random fixes | expand

Commit Message

Anju T Sudhakar June 28, 2021, 8:52 a.m. UTC
xfs_quota command 'limit' is reformated in xfsprogs version v5.5.0, to
make it suitable for this(xfs/515) test case. So the test case will
flag failure while running with xfsprogs version less than v5.5, even
though `limit` is documented in xfs_quota manpage. So skip this test for
xfsprogs versions less than v5.5.

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
---
 tests/xfs/515 | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

Zorro Lang June 28, 2021, 2:19 p.m. UTC | #1
On Mon, Jun 28, 2021 at 02:22:59PM +0530, Anju T Sudhakar wrote:
> xfs_quota command 'limit' is reformated in xfsprogs version v5.5.0, to
> make it suitable for this(xfs/515) test case. So the test case will
> flag failure while running with xfsprogs version less than v5.5, even
> though `limit` is documented in xfs_quota manpage. So skip this test for
> xfsprogs versions less than v5.5.
> 
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> ---
>  tests/xfs/515 | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/xfs/515 b/tests/xfs/515
> index 32216fe6..5eb97aff 100755
> --- a/tests/xfs/515
> +++ b/tests/xfs/515
> @@ -27,6 +27,11 @@ _require_test
>  echo "Silence is golden"
>  
>  MANPAGE=$($MAN_PROG --path xfs_quota)
> +# xfs_quota command 'limit' is reformated in xfsprogs version v5.5.0,
> +# to make it suitable for this test case. For xfprogs versions less than
> +# v5.5.0, this test case can not detect the command 'limit'.
> +req_version=$($XFS_DB_PROG -V | cut -d" " -f3)
> +req_command="limit"

It's similar as the patch of [2/3], and I have similar review points. And
checking program version isn't a good way to judge the expect behavior of
a program, especially downstream always backport patches of upstream.

Thanks,
Zorro

>  
>  case "$MANPAGE" in
>  *.gz|*.z\|*.Z)	CAT=zcat;;
> @@ -36,8 +41,14 @@ case "$MANPAGE" in
>  esac
>  _require_command `which $CAT` $CAT
>  
> -for COMMAND in `$XFS_QUOTA_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`; do
> -  $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
> +for COMMAND in `$XFS_QUOTA_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`;
> +do
> +	if [ "$req_version" \< "5.5.0" ]; then
> +		if [ "$COMMAND" == "$req_command" ];then
> +			continue
> +		fi
> +	fi
> +	$CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
>  	echo "$COMMAND not documented in the xfs_quota manpage"
>  done
>  
> -- 
> 2.31.1
>
diff mbox series

Patch

diff --git a/tests/xfs/515 b/tests/xfs/515
index 32216fe6..5eb97aff 100755
--- a/tests/xfs/515
+++ b/tests/xfs/515
@@ -27,6 +27,11 @@  _require_test
 echo "Silence is golden"
 
 MANPAGE=$($MAN_PROG --path xfs_quota)
+# xfs_quota command 'limit' is reformated in xfsprogs version v5.5.0,
+# to make it suitable for this test case. For xfprogs versions less than
+# v5.5.0, this test case can not detect the command 'limit'.
+req_version=$($XFS_DB_PROG -V | cut -d" " -f3)
+req_command="limit"
 
 case "$MANPAGE" in
 *.gz|*.z\|*.Z)	CAT=zcat;;
@@ -36,8 +41,14 @@  case "$MANPAGE" in
 esac
 _require_command `which $CAT` $CAT
 
-for COMMAND in `$XFS_QUOTA_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`; do
-  $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
+for COMMAND in `$XFS_QUOTA_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`;
+do
+	if [ "$req_version" \< "5.5.0" ]; then
+		if [ "$COMMAND" == "$req_command" ];then
+			continue
+		fi
+	fi
+	$CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
 	echo "$COMMAND not documented in the xfs_quota manpage"
 done