diff mbox series

[2/3] xfs/514: Check xfsprogs version for verifying the xfs_db commands

Message ID 20210628085259.120666-3-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_db commands like `attr_remove, attr_set, btheight, and logformat`,
are documented only in xfsprogs version v5.5 and later. So skip checking
for these commands in xfs_db manpage,if the test is running with
xfsprogs version less than v5.5.

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
---
Query: The reason to add this check is, while running xfstest with an         
older version of xfsprogs, this test case flags as failure, though         
xfs_db is not expected to have those commands. Otherwise upon failure we   
should ask the user to use the latest version of xfsprogs.                 
OR is there any better solution for this?     

 tests/xfs/514 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Zorro Lang June 28, 2021, 2:16 p.m. UTC | #1
On Mon, Jun 28, 2021 at 02:22:58PM +0530, Anju T Sudhakar wrote:
> xfs_db commands like `attr_remove, attr_set, btheight, and logformat`,
> are documented only in xfsprogs version v5.5 and later. So skip checking
> for these commands in xfs_db manpage,if the test is running with
> xfsprogs version less than v5.5.
> 
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> ---
> Query: The reason to add this check is, while running xfstest with an         
> older version of xfsprogs, this test case flags as failure, though         
> xfs_db is not expected to have those commands. Otherwise upon failure we   
> should ask the user to use the latest version of xfsprogs.                 
> OR is there any better solution for this?     
> 
>  tests/xfs/514 | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/xfs/514 b/tests/xfs/514
> index a9c67645..8da66f41 100755
> --- a/tests/xfs/514
> +++ b/tests/xfs/514
> @@ -27,6 +27,11 @@ _require_test
>  echo "Silence is golden"
>  
>  MANPAGE=$($MAN_PROG --path xfs_db)
> +# xfs_db commands - attr_remove, attr_set, btheight, and logformat
> +# are documented in 5.5.0 and later versions only. So skip checking for
> +# those commands if the version is less than 5.5.0.
> +command_list="attr_set attr_remove btheight logformat"
> +req_version=$($XFS_DB_PROG -V | cut -d" " -f3)

Generally I think it's a known "bug"(doc missing), and this case hit this bug
in old xfsprogs, that's as expected.

Thanks,
Zorro

>  
>  case "$MANPAGE" in
>  *.gz|*.z\|*.Z)	CAT=zcat;;
> @@ -41,7 +46,12 @@ truncate -s 128m $file
>  $MKFS_XFS_PROG $file >> /dev/null
>  
>  for COMMAND in `$XFS_DB_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`; do
> -  $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
> +	if [ "$req_version" \< "5.5.0" ]; then
> +		if (echo $command_list | tr ' ' '\n' | grep -F -x -q "$COMMAND");then
> +			continue
> +		fi
> +	fi
> +	$CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
>  	echo "$COMMAND not documented in the xfs_db manpage"
>  done
>  
> -- 
> 2.31.1
>
Darrick J. Wong June 28, 2021, 3:35 p.m. UTC | #2
On Mon, Jun 28, 2021 at 02:22:58PM +0530, Anju T Sudhakar wrote:
> xfs_db commands like `attr_remove, attr_set, btheight, and logformat`,
> are documented only in xfsprogs version v5.5 and later. So skip checking
> for these commands in xfs_db manpage,if the test is running with
> xfsprogs version less than v5.5.
> 
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> ---
> Query: The reason to add this check is, while running xfstest with an         
> older version of xfsprogs, this test case flags as failure, though         
> xfs_db is not expected to have those commands. Otherwise upon failure we   
> should ask the user to use the latest version of xfsprogs.                 
> OR is there any better solution for this?     

If you're shipping xfsprogs 5.5 in a product, why not update the manpage
to document the functionality that's in your product?  If you aren't
shipping 5.5, then why run such an old version?

--D

> 
>  tests/xfs/514 | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/xfs/514 b/tests/xfs/514
> index a9c67645..8da66f41 100755
> --- a/tests/xfs/514
> +++ b/tests/xfs/514
> @@ -27,6 +27,11 @@ _require_test
>  echo "Silence is golden"
>  
>  MANPAGE=$($MAN_PROG --path xfs_db)
> +# xfs_db commands - attr_remove, attr_set, btheight, and logformat
> +# are documented in 5.5.0 and later versions only. So skip checking for
> +# those commands if the version is less than 5.5.0.
> +command_list="attr_set attr_remove btheight logformat"
> +req_version=$($XFS_DB_PROG -V | cut -d" " -f3)
>  
>  case "$MANPAGE" in
>  *.gz|*.z\|*.Z)	CAT=zcat;;
> @@ -41,7 +46,12 @@ truncate -s 128m $file
>  $MKFS_XFS_PROG $file >> /dev/null
>  
>  for COMMAND in `$XFS_DB_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`; do
> -  $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
> +	if [ "$req_version" \< "5.5.0" ]; then
> +		if (echo $command_list | tr ' ' '\n' | grep -F -x -q "$COMMAND");then
> +			continue
> +		fi
> +	fi
> +	$CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
>  	echo "$COMMAND not documented in the xfs_db manpage"
>  done
>  
> -- 
> 2.31.1
>
Anju T Sudhakar July 4, 2021, 7:29 a.m. UTC | #3
Hi,

On 6/28/21 9:05 PM, Darrick J. Wong wrote:
> On Mon, Jun 28, 2021 at 02:22:58PM +0530, Anju T Sudhakar wrote:
>> xfs_db commands like `attr_remove, attr_set, btheight, and logformat`,
>> are documented only in xfsprogs version v5.5 and later. So skip checking
>> for these commands in xfs_db manpage,if the test is running with
>> xfsprogs version less than v5.5.
>>
>> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
>> ---
>> Query: The reason to add this check is, while running xfstest with an
>> older version of xfsprogs, this test case flags as failure, though
>> xfs_db is not expected to have those commands. Otherwise upon failure we
>> should ask the user to use the latest version of xfsprogs.
>> OR is there any better solution for this?
> If you're shipping xfsprogs 5.5 in a product, why not update the manpage
> to document the functionality that's in your product?  If you aren't
> shipping 5.5, then why run such an old version?
>
> --D


OK. Then I think we can drop patch 2/3 and 3/3 in this series, as both 
checks for the

xfsprogs version to run the test.



Thanks,

Anju
diff mbox series

Patch

diff --git a/tests/xfs/514 b/tests/xfs/514
index a9c67645..8da66f41 100755
--- a/tests/xfs/514
+++ b/tests/xfs/514
@@ -27,6 +27,11 @@  _require_test
 echo "Silence is golden"
 
 MANPAGE=$($MAN_PROG --path xfs_db)
+# xfs_db commands - attr_remove, attr_set, btheight, and logformat
+# are documented in 5.5.0 and later versions only. So skip checking for
+# those commands if the version is less than 5.5.0.
+command_list="attr_set attr_remove btheight logformat"
+req_version=$($XFS_DB_PROG -V | cut -d" " -f3)
 
 case "$MANPAGE" in
 *.gz|*.z\|*.Z)	CAT=zcat;;
@@ -41,7 +46,12 @@  truncate -s 128m $file
 $MKFS_XFS_PROG $file >> /dev/null
 
 for COMMAND in `$XFS_DB_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`; do
-  $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
+	if [ "$req_version" \< "5.5.0" ]; then
+		if (echo $command_list | tr ' ' '\n' | grep -F -x -q "$COMMAND");then
+			continue
+		fi
+	fi
+	$CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
 	echo "$COMMAND not documented in the xfs_db manpage"
 done