diff mbox

common: use xfs_io to obtain the xfsprogs version

Message ID 20170111104820.7367-1-ddiss@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

David Disseldorp Jan. 11, 2017, 10:48 a.m. UTC
xfs_db is currently used for this, but is otherwise only used for XFS
specific tests. This change allows for the generic tests to be run on a
system without the xfs_db binary.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 common/config | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Eric Sandeen Jan. 11, 2017, 1:25 p.m. UTC | #1
On 1/11/17 4:48 AM, David Disseldorp wrote:
> xfs_db is currently used for this, but is otherwise only used for XFS
> specific tests. This change allows for the generic tests to be run on a
> system without the xfs_db binary.
> 
> Signed-off-by: David Disseldorp <ddiss@suse.de>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  common/config | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/common/config b/common/config
> index 6cce7ce..1604aa9 100644
> --- a/common/config
> +++ b/common/config
> @@ -226,11 +226,11 @@ export UDEV_SETTLE_PROG
>  # Generate a comparable xfsprogs version number in the form of
>  # major * 10000 + minor * 100 + release
>  #
> -# $ xfs_db -V
> -# xfs_db version 2.9.7
> +# $ xfs_io -V
> +# xfs_io version 2.9.7
>  #
>  # so, 2.9.7 = 20907
> -_version=`$XFS_DB_PROG -V | $AWK_PROG '
> +_version=`$XFS_IO_PROG -V | $AWK_PROG '
>  	/version/ {
>  		if (split($3,ver,".") == 3)
>  			print (ver[1] * 10000) + (ver[2] * 100) + ver[3];
> 
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan Jan. 12, 2017, 3:51 a.m. UTC | #2
On Wed, Jan 11, 2017 at 11:48:20AM +0100, David Disseldorp wrote:
> xfs_db is currently used for this, but is otherwise only used for XFS
> specific tests. This change allows for the generic tests to be run on a
> system without the xfs_db binary.
> 
> Signed-off-by: David Disseldorp <ddiss@suse.de>
> ---
>  common/config | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/common/config b/common/config
> index 6cce7ce..1604aa9 100644
> --- a/common/config
> +++ b/common/config
> @@ -226,11 +226,11 @@ export UDEV_SETTLE_PROG
>  # Generate a comparable xfsprogs version number in the form of
>  # major * 10000 + minor * 100 + release
>  #
> -# $ xfs_db -V
> -# xfs_db version 2.9.7
> +# $ xfs_io -V
> +# xfs_io version 2.9.7
>  #
>  # so, 2.9.7 = 20907
> -_version=`$XFS_DB_PROG -V | $AWK_PROG '
> +_version=`$XFS_IO_PROG -V | $AWK_PROG '

I noticed that this $_version is only assigned to XFSPROGS_VERSION, and
the only user of $XFSPROGS_VERSION is xfs/188.

if [ $XFSPROGS_VERSION -lt 21000 ]; then
    _notrun "this test requires case-insensitive support"
fi

That's a test added in 2008, now we avoid skipping tests by checking on
some version number, we tend to add new _require rules to actually test
for the requirements. e.g. for xfs/188, I think we can have:

in common/xfs:
# this test requires mkfs.xfs have case-insensitive naming support
_require_xfs_mkfs_ciname()
{
	_scratch_mkfs_xfs_supported -n version=ci >/dev/null 2>&1 \
		|| _notrun "need case-insensitive naming support in mkfs.xfs"
}

And remove all the version detection & checking code from common/config
and xfs/188, and call the new _require rule in the test.

Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Disseldorp Jan. 12, 2017, 12:26 p.m. UTC | #3
On Thu, 12 Jan 2017 11:51:24 +0800, Eryu Guan wrote:
...
> I noticed that this $_version is only assigned to XFSPROGS_VERSION, and
> the only user of $XFSPROGS_VERSION is xfs/188.
> 
> if [ $XFSPROGS_VERSION -lt 21000 ]; then
>     _notrun "this test requires case-insensitive support"
> fi
> 
> That's a test added in 2008, now we avoid skipping tests by checking on
> some version number, we tend to add new _require rules to actually test
> for the requirements. e.g. for xfs/188, I think we can have:
> 
> in common/xfs:
> # this test requires mkfs.xfs have case-insensitive naming support
> _require_xfs_mkfs_ciname()
> {
> 	_scratch_mkfs_xfs_supported -n version=ci >/dev/null 2>&1 \
> 		|| _notrun "need case-insensitive naming support in mkfs.xfs"
> }
> 
> And remove all the version detection & checking code from common/config
> and xfs/188, and call the new _require rule in the test.

This seems much nicer, Eryu. I'm giving it a spin now, and will send a
patch once tested - thanks for the feedback.

Cheers, David
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/config b/common/config
index 6cce7ce..1604aa9 100644
--- a/common/config
+++ b/common/config
@@ -226,11 +226,11 @@  export UDEV_SETTLE_PROG
 # Generate a comparable xfsprogs version number in the form of
 # major * 10000 + minor * 100 + release
 #
-# $ xfs_db -V
-# xfs_db version 2.9.7
+# $ xfs_io -V
+# xfs_io version 2.9.7
 #
 # so, 2.9.7 = 20907
-_version=`$XFS_DB_PROG -V | $AWK_PROG '
+_version=`$XFS_IO_PROG -V | $AWK_PROG '
 	/version/ {
 		if (split($3,ver,".") == 3)
 			print (ver[1] * 10000) + (ver[2] * 100) + ver[3];