* [PATCH] btrfs/298: add test for showing qgroups include staled sorted by path
@ 2023-10-09 14:31 Sidong Yang
2023-10-09 15:41 ` David Sterba
2023-10-21 13:24 ` Zorro Lang
0 siblings, 2 replies; 3+ messages in thread
From: Sidong Yang @ 2023-10-09 14:31 UTC (permalink / raw)
To: linux-btrfs, fstests; +Cc: Sidong Yang
Test for showing qgroups include a staled qgroup list sorted by path.
It crashed without checking qgroup has empty path. It fixed by the
following commit in btrfs-progs:
cd7f1e48 ("btrfs-progs: qgroup: check null in comparing paths")
Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
tests/btrfs/298 | 34 ++++++++++++++++++++++++++++++++++
tests/btrfs/298.out | 2 ++
2 files changed, 36 insertions(+)
create mode 100755 tests/btrfs/298
create mode 100644 tests/btrfs/298.out
diff --git a/tests/btrfs/298 b/tests/btrfs/298
new file mode 100755
index 00000000..5457423d
--- /dev/null
+++ b/tests/btrfs/298
@@ -0,0 +1,34 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Sidong Yang. All Rights Reserved.
+#
+# FS QA Test 298
+#
+# Test that showing qgourps list includes a staled qgroup without crash.
+#
+. ./common/preamble
+_begin_fstest auto quick qgroup
+
+ . ./common/filter
+
+_supported_fs btrfs
+_require_test
+_require_scratch
+
+_scratch_mkfs > /dev/null 2>&1
+_scratch_mount
+
+# Create stale qgroup with creating and deleting a subvolume.
+$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT >> $seqres.full
+$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full
+$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/a >> $seqres.full
+
+# Show qgroups list with sorting path without crash.
+$BTRFS_UTIL_PROG qgroup show --sort path $SCRATCH_MNT >> $seqres.full
+
+_scratch_unmount
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/298.out b/tests/btrfs/298.out
new file mode 100644
index 00000000..63434267
--- /dev/null
+++ b/tests/btrfs/298.out
@@ -0,0 +1,2 @@
+QA output created by 298
+Silence is golden
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs/298: add test for showing qgroups include staled sorted by path
2023-10-09 14:31 [PATCH] btrfs/298: add test for showing qgroups include staled sorted by path Sidong Yang
@ 2023-10-09 15:41 ` David Sterba
2023-10-21 13:24 ` Zorro Lang
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2023-10-09 15:41 UTC (permalink / raw)
To: Sidong Yang; +Cc: linux-btrfs, fstests
On Mon, Oct 09, 2023 at 02:31:23PM +0000, Sidong Yang wrote:
> Test for showing qgroups include a staled qgroup list sorted by path.
> It crashed without checking qgroup has empty path. It fixed by the
> following commit in btrfs-progs:
>
> cd7f1e48 ("btrfs-progs: qgroup: check null in comparing paths")
This is a progs patch and I'd like to have the test case there, while it
does not hurt to have it in the fstests too but IMHO it's not very
useful there.
> Signed-off-by: Sidong Yang <realwakka@gmail.com>
> ---
> tests/btrfs/298 | 34 ++++++++++++++++++++++++++++++++++
> tests/btrfs/298.out | 2 ++
> 2 files changed, 36 insertions(+)
> create mode 100755 tests/btrfs/298
> create mode 100644 tests/btrfs/298.out
>
> diff --git a/tests/btrfs/298 b/tests/btrfs/298
> new file mode 100755
> index 00000000..5457423d
> --- /dev/null
> +++ b/tests/btrfs/298
> @@ -0,0 +1,34 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 Sidong Yang. All Rights Reserved.
> +#
> +# FS QA Test 298
> +#
> +# Test that showing qgourps list includes a staled qgroup without crash.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick qgroup
> +
> + . ./common/filter
> +
> +_supported_fs btrfs
> +_require_test
> +_require_scratch
> +
> +_scratch_mkfs > /dev/null 2>&1
> +_scratch_mount
> +
> +# Create stale qgroup with creating and deleting a subvolume.
> +$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT >> $seqres.full
> +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full
> +$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/a >> $seqres.full
> +
> +# Show qgroups list with sorting path without crash.
> +$BTRFS_UTIL_PROG qgroup show --sort path $SCRATCH_MNT >> $seqres.full
> +
> +_scratch_unmount
I've created a test case for btrfs-progs with the same commands, only
using the other wrappers to run them.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs/298: add test for showing qgroups include staled sorted by path
2023-10-09 14:31 [PATCH] btrfs/298: add test for showing qgroups include staled sorted by path Sidong Yang
2023-10-09 15:41 ` David Sterba
@ 2023-10-21 13:24 ` Zorro Lang
1 sibling, 0 replies; 3+ messages in thread
From: Zorro Lang @ 2023-10-21 13:24 UTC (permalink / raw)
To: Sidong Yang; +Cc: linux-btrfs, fstests
On Mon, Oct 09, 2023 at 02:31:23PM +0000, Sidong Yang wrote:
> Test for showing qgroups include a staled qgroup list sorted by path.
> It crashed without checking qgroup has empty path. It fixed by the
> following commit in btrfs-progs:
>
> cd7f1e48 ("btrfs-progs: qgroup: check null in comparing paths")
>
> Signed-off-by: Sidong Yang <realwakka@gmail.com>
> ---
> tests/btrfs/298 | 34 ++++++++++++++++++++++++++++++++++
> tests/btrfs/298.out | 2 ++
> 2 files changed, 36 insertions(+)
> create mode 100755 tests/btrfs/298
> create mode 100644 tests/btrfs/298.out
>
> diff --git a/tests/btrfs/298 b/tests/btrfs/298
> new file mode 100755
> index 00000000..5457423d
> --- /dev/null
> +++ b/tests/btrfs/298
> @@ -0,0 +1,34 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 Sidong Yang. All Rights Reserved.
> +#
> +# FS QA Test 298
> +#
> +# Test that showing qgourps list includes a staled qgroup without crash.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick qgroup
> +
> + . ./common/filter
> +
> +_supported_fs btrfs
> +_require_test
> +_require_scratch
> +
> +_scratch_mkfs > /dev/null 2>&1
> +_scratch_mount
> +
> +# Create stale qgroup with creating and deleting a subvolume.
> +$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT >> $seqres.full
> +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full
> +$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/a >> $seqres.full
> +
> +# Show qgroups list with sorting path without crash.
> +$BTRFS_UTIL_PROG qgroup show --sort path $SCRATCH_MNT >> $seqres.full
> +
> +_scratch_unmount
Is the umount a necessary part of this test? If not, this step isn't needed.
The SCRATCH_DEV will be unmounted later.
Others looks good to me. I don't mind merging this case, if btrfs list
feels good to take time to run it in fstests. If no objection from btrfs, then:
Reviewed-by: Zorro Lang <zlang@redhat.com>
Thanks,
Zorro
> +
> +# success, all done
> +echo "Silence is golden"
> +status=0
> +exit
> diff --git a/tests/btrfs/298.out b/tests/btrfs/298.out
> new file mode 100644
> index 00000000..63434267
> --- /dev/null
> +++ b/tests/btrfs/298.out
> @@ -0,0 +1,2 @@
> +QA output created by 298
> +Silence is golden
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-21 13:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09 14:31 [PATCH] btrfs/298: add test for showing qgroups include staled sorted by path Sidong Yang
2023-10-09 15:41 ` David Sterba
2023-10-21 13:24 ` Zorro Lang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox