diff mbox series

[v2,06/10] btrfs: test case prerequisite _require_btrfs_mkfs_uuid_option

Message ID 664d640d44d787f0b7c5cfba1b57abd2260b747c.1708362842.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: functional test cases for tempfsid | expand

Commit Message

Anand Jain Feb. 19, 2024, 7:48 p.m. UTC
For easier and more effective testing of btrfs tempfsid, newer versions
of mkfs.btrfs contain options such as --device-uuid. Check if the
currently running mkfs.btrfs contains this option.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2:
 Fix coding style, add space before grep
 Fix typp option -> options

 common/btrfs | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Filipe Manana Feb. 20, 2024, 4:47 p.m. UTC | #1
On Mon, Feb 19, 2024 at 7:49 PM Anand Jain <anand.jain@oracle.com> wrote:
>
> For easier and more effective testing of btrfs tempfsid, newer versions
> of mkfs.btrfs contain options such as --device-uuid. Check if the
> currently running mkfs.btrfs contains this option.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Looks good, thanks.

> ---
> v2:
>  Fix coding style, add space before grep
>  Fix typp option -> options
>
>  common/btrfs | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/common/btrfs b/common/btrfs
> index 797f6a794dfc..f694afac3d13 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -88,6 +88,17 @@ _require_btrfs_mkfs_feature()
>                 _notrun "Feature $feat not supported in the available version of mkfs.btrfs"
>  }
>
> +_require_btrfs_mkfs_uuid_option()
> +{
> +       local cnt
> +
> +       cnt=$($MKFS_BTRFS_PROG --help 2>&1 | \
> +                               grep -E --count "\-\-uuid|\-\-device-uuid")
> +       if [ $cnt != 2 ]; then
> +               _notrun "Require $MKFS_BTRFS_PROG with --uuid and --device-uuid options"
> +       fi
> +}
> +
>  _require_btrfs_fs_feature()
>  {
>         if [ -z $1 ]; then
> --
> 2.39.3
>
diff mbox series

Patch

diff --git a/common/btrfs b/common/btrfs
index 797f6a794dfc..f694afac3d13 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -88,6 +88,17 @@  _require_btrfs_mkfs_feature()
 		_notrun "Feature $feat not supported in the available version of mkfs.btrfs"
 }
 
+_require_btrfs_mkfs_uuid_option()
+{
+	local cnt
+
+	cnt=$($MKFS_BTRFS_PROG --help 2>&1 | \
+				grep -E --count "\-\-uuid|\-\-device-uuid")
+	if [ $cnt != 2 ]; then
+		_notrun "Require $MKFS_BTRFS_PROG with --uuid and --device-uuid options"
+	fi
+}
+
 _require_btrfs_fs_feature()
 {
 	if [ -z $1 ]; then