diff mbox series

[v1] xfstests: test xfs_spaceman fsuuid command

Message ID 20221109222630.85053-1-catherine.hoang@oracle.com (mailing list archive)
State New, archived
Headers show
Series [v1] xfstests: test xfs_spaceman fsuuid command | expand

Commit Message

Catherine Hoang Nov. 9, 2022, 10:26 p.m. UTC
Add a test to verify the xfs_spaceman fsuuid functionality.

Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
---
 tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
 tests/xfs/557.out |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100755 tests/xfs/557
 create mode 100644 tests/xfs/557.out

Comments

Allison Henderson Nov. 11, 2022, 9:31 p.m. UTC | #1
On Wed, 2022-11-09 at 14:26 -0800, Catherine Hoang wrote:
> Add a test to verify the xfs_spaceman fsuuid functionality.
> 
> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Looks simple enough
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>

> ---
>  tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
>  tests/xfs/557.out |  2 ++
>  2 files changed, 33 insertions(+)
>  create mode 100755 tests/xfs/557
>  create mode 100644 tests/xfs/557.out
> 
> diff --git a/tests/xfs/557 b/tests/xfs/557
> new file mode 100755
> index 00000000..0b41e693
> --- /dev/null
> +++ b/tests/xfs/557
> @@ -0,0 +1,31 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 557
> +#
> +# Test to verify xfs_spaceman fsuuid functionality
> +#
> +. ./common/preamble
> +_begin_fstest auto quick spaceman
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_require_xfs_spaceman_command "fsuuid"
> +_require_scratch
> +
> +_scratch_mkfs >> $seqres.full
> +_scratch_mount >> $seqres.full
> +
> +expected_uuid="$(_scratch_xfs_admin -u)"
> +actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
> +
> +if [ "$expected_uuid" != "$actual_uuid" ]; then
> +        echo "expected UUID ($expected_uuid) != actual UUID
> ($actual_uuid)"
> +fi
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/557.out b/tests/xfs/557.out
> new file mode 100644
> index 00000000..1f1ae1d4
> --- /dev/null
> +++ b/tests/xfs/557.out
> @@ -0,0 +1,2 @@
> +QA output created by 557
> +Silence is golden
Zorro Lang Nov. 12, 2022, 2:24 p.m. UTC | #2
On Wed, Nov 09, 2022 at 02:26:30PM -0800, Catherine Hoang wrote:
> Add a test to verify the xfs_spaceman fsuuid functionality.
> 
> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
> ---

Hmm... I'm a little confused why we need this tool if we already has a
"xfs_admin -u", and we even expect they get same fsuuid. Even if "xfs_admin -u"
can't work with mountpoint, but it can work on the device which is mounted.
And why not let xfs_admin support that ?

Anyway, I'm care more about if this command is acked by xfs list? If xfs list
would like to have that command, then I'm OK to have this test coverage :)

Thanks,
Zorro

>  tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
>  tests/xfs/557.out |  2 ++
>  2 files changed, 33 insertions(+)
>  create mode 100755 tests/xfs/557
>  create mode 100644 tests/xfs/557.out
> 
> diff --git a/tests/xfs/557 b/tests/xfs/557
> new file mode 100755
> index 00000000..0b41e693
> --- /dev/null
> +++ b/tests/xfs/557
> @@ -0,0 +1,31 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 557
> +#
> +# Test to verify xfs_spaceman fsuuid functionality
> +#
> +. ./common/preamble
> +_begin_fstest auto quick spaceman
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_require_xfs_spaceman_command "fsuuid"
> +_require_scratch
> +
> +_scratch_mkfs >> $seqres.full
> +_scratch_mount >> $seqres.full
> +
> +expected_uuid="$(_scratch_xfs_admin -u)"
> +actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
> +
> +if [ "$expected_uuid" != "$actual_uuid" ]; then
> +        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
> +fi
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/557.out b/tests/xfs/557.out
> new file mode 100644
> index 00000000..1f1ae1d4
> --- /dev/null
> +++ b/tests/xfs/557.out
> @@ -0,0 +1,2 @@
> +QA output created by 557
> +Silence is golden
> -- 
> 2.25.1
>
Catherine Hoang Nov. 15, 2022, 11:03 p.m. UTC | #3
> On Nov 12, 2022, at 6:24 AM, Zorro Lang <zlang@redhat.com> wrote:
> 
> On Wed, Nov 09, 2022 at 02:26:30PM -0800, Catherine Hoang wrote:
>> Add a test to verify the xfs_spaceman fsuuid functionality.
>> 
>> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
>> ---
> 
> Hmm... I'm a little confused why we need this tool if we already has a
> "xfs_admin -u", and we even expect they get same fsuuid. Even if "xfs_admin -u"
> can't work with mountpoint, but it can work on the device which is mounted.
> And why not let xfs_admin support that ?

We are trying to add a new ioctl to retrieve the uuid of a mounted filesystem. The
eventual goal is to have “xfs_admin -u" wrap around this command and use
it for cases when the filesystem is mounted.
> 
> Anyway, I'm care more about if this command is acked by xfs list? If xfs list
> would like to have that command, then I'm OK to have this test coverage :)

This is still under discussion on the xfs list so it will probably take some
more time before it is accepted. Thanks!
> 
> Thanks,
> Zorro
> 
>> tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
>> tests/xfs/557.out |  2 ++
>> 2 files changed, 33 insertions(+)
>> create mode 100755 tests/xfs/557
>> create mode 100644 tests/xfs/557.out
>> 
>> diff --git a/tests/xfs/557 b/tests/xfs/557
>> new file mode 100755
>> index 00000000..0b41e693
>> --- /dev/null
>> +++ b/tests/xfs/557
>> @@ -0,0 +1,31 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2022 Oracle.  All Rights Reserved.
>> +#
>> +# FS QA Test 557
>> +#
>> +# Test to verify xfs_spaceman fsuuid functionality
>> +#
>> +. ./common/preamble
>> +_begin_fstest auto quick spaceman
>> +
>> +# real QA test starts here
>> +_supported_fs xfs
>> +_require_xfs_spaceman_command "fsuuid"
>> +_require_scratch
>> +
>> +_scratch_mkfs >> $seqres.full
>> +_scratch_mount >> $seqres.full
>> +
>> +expected_uuid="$(_scratch_xfs_admin -u)"
>> +actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
>> +
>> +if [ "$expected_uuid" != "$actual_uuid" ]; then
>> +        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
>> +fi
>> +
>> +echo "Silence is golden"
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/xfs/557.out b/tests/xfs/557.out
>> new file mode 100644
>> index 00000000..1f1ae1d4
>> --- /dev/null
>> +++ b/tests/xfs/557.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 557
>> +Silence is golden
>> -- 
>> 2.25.1
>> 
>
Darrick J. Wong Nov. 17, 2022, 8:43 p.m. UTC | #4
On Wed, Nov 09, 2022 at 02:26:30PM -0800, Catherine Hoang wrote:
> Add a test to verify the xfs_spaceman fsuuid functionality.
> 
> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
> ---
>  tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
>  tests/xfs/557.out |  2 ++
>  2 files changed, 33 insertions(+)
>  create mode 100755 tests/xfs/557
>  create mode 100644 tests/xfs/557.out
> 
> diff --git a/tests/xfs/557 b/tests/xfs/557
> new file mode 100755
> index 00000000..0b41e693
> --- /dev/null
> +++ b/tests/xfs/557
> @@ -0,0 +1,31 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 557
> +#
> +# Test to verify xfs_spaceman fsuuid functionality
> +#
> +. ./common/preamble
> +_begin_fstest auto quick spaceman
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_require_xfs_spaceman_command "fsuuid"
> +_require_scratch
> +
> +_scratch_mkfs >> $seqres.full
> +_scratch_mount >> $seqres.full
> +
> +expected_uuid="$(_scratch_xfs_admin -u)"

A future xfs_admin.sh will be ported to call xfs_io if the filesystem is
mounted, so you really ought to read the ondisk uuid straight from the
debugger before mounting, and query the kernel after mounting:

_scratch_mkfs >> $seqres.full
expected_uuid=$(_scratch_xfs_get_sb_field uuid)

_scratch_mount >> $seqres.full
actual_uuid=$($XFS_IO_PROG -c fsuuid $SCRATCH_MNT)
if [ "$expected_uuid" != "$actual_uuid" ]; then
	...
fi

--D

> +actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
> +
> +if [ "$expected_uuid" != "$actual_uuid" ]; then
> +        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
> +fi
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/557.out b/tests/xfs/557.out
> new file mode 100644
> index 00000000..1f1ae1d4
> --- /dev/null
> +++ b/tests/xfs/557.out
> @@ -0,0 +1,2 @@
> +QA output created by 557
> +Silence is golden
> -- 
> 2.25.1
>
Darrick J. Wong Nov. 17, 2022, 8:50 p.m. UTC | #5
On Thu, Nov 17, 2022 at 12:43:04PM -0800, Darrick J. Wong wrote:
> On Wed, Nov 09, 2022 at 02:26:30PM -0800, Catherine Hoang wrote:
> > Add a test to verify the xfs_spaceman fsuuid functionality.
> > 
> > Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
> > ---
> >  tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
> >  tests/xfs/557.out |  2 ++
> >  2 files changed, 33 insertions(+)
> >  create mode 100755 tests/xfs/557
> >  create mode 100644 tests/xfs/557.out
> > 
> > diff --git a/tests/xfs/557 b/tests/xfs/557
> > new file mode 100755
> > index 00000000..0b41e693
> > --- /dev/null
> > +++ b/tests/xfs/557
> > @@ -0,0 +1,31 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test 557
> > +#
> > +# Test to verify xfs_spaceman fsuuid functionality
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto quick spaceman
> > +
> > +# real QA test starts here
> > +_supported_fs xfs
> > +_require_xfs_spaceman_command "fsuuid"

Also -- I think you need to patch _require_xfs_io_command to try the
fsuuid command on the test fs and _notrun if the kernel doesn't
understand the GETFSUUID ioctl.

(Assuming the command is moving from xfs_spaceman to xfs_io.)

--D

> > +_require_scratch
> > +
> > +_scratch_mkfs >> $seqres.full
> > +_scratch_mount >> $seqres.full
> > +
> > +expected_uuid="$(_scratch_xfs_admin -u)"
> 
> A future xfs_admin.sh will be ported to call xfs_io if the filesystem is
> mounted, so you really ought to read the ondisk uuid straight from the
> debugger before mounting, and query the kernel after mounting:
> 
> _scratch_mkfs >> $seqres.full
> expected_uuid=$(_scratch_xfs_get_sb_field uuid)
> 
> _scratch_mount >> $seqres.full
> actual_uuid=$($XFS_IO_PROG -c fsuuid $SCRATCH_MNT)
> if [ "$expected_uuid" != "$actual_uuid" ]; then
> 	...
> fi
> 
> --D
> 
> > +actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
> > +
> > +if [ "$expected_uuid" != "$actual_uuid" ]; then
> > +        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
> > +fi
> > +
> > +echo "Silence is golden"
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/557.out b/tests/xfs/557.out
> > new file mode 100644
> > index 00000000..1f1ae1d4
> > --- /dev/null
> > +++ b/tests/xfs/557.out
> > @@ -0,0 +1,2 @@
> > +QA output created by 557
> > +Silence is golden
> > -- 
> > 2.25.1
> >
diff mbox series

Patch

diff --git a/tests/xfs/557 b/tests/xfs/557
new file mode 100755
index 00000000..0b41e693
--- /dev/null
+++ b/tests/xfs/557
@@ -0,0 +1,31 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 557
+#
+# Test to verify xfs_spaceman fsuuid functionality
+#
+. ./common/preamble
+_begin_fstest auto quick spaceman
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_spaceman_command "fsuuid"
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+expected_uuid="$(_scratch_xfs_admin -u)"
+actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
+
+if [ "$expected_uuid" != "$actual_uuid" ]; then
+        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
+fi
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/557.out b/tests/xfs/557.out
new file mode 100644
index 00000000..1f1ae1d4
--- /dev/null
+++ b/tests/xfs/557.out
@@ -0,0 +1,2 @@ 
+QA output created by 557
+Silence is golden