]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
btrfs: test case prerequisite _require_btrfs_mkfs_uuid_option
authorAnand Jain <anand.jain@oracle.com>
Mon, 19 Feb 2024 19:48:46 +0000 (03:48 +0800)
committerZorro Lang <zlang@kernel.org>
Fri, 1 Mar 2024 11:22:36 +0000 (19:22 +0800)
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.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
common/btrfs

index 5dd0f705fd90ab0ed08faac4ed0c4af09e4430f9..fe6fc2196e6828d114be289d4ff58e46145677f4 100644 (file)
@@ -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