diff mbox series

[v2,3/3] fstests: update tests to skip unsupported raid profile types

Message ID 7111bf50942e0b72a43ceed010d8bab00c712a75.1712346845.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series fstests: various RAID56 related fixes for btrfs | expand

Commit Message

Josef Bacik April 5, 2024, 7:56 p.m. UTC
Tests btrfs/197, btrfs/198, and btrfs/297 test multiple raid types in
their workout() function.  We may not support some of the raid types, so
add a check in the workout() function to skip any incompatible raid
profiles.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/btrfs/197 | 10 ++++++++--
 tests/btrfs/198 | 10 ++++++++--
 tests/btrfs/297 | 10 ++++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

Comments

Anand Jain April 9, 2024, 3:40 a.m. UTC | #1
On 4/6/24 03:56, Josef Bacik wrote:
> Tests btrfs/197, btrfs/198, and btrfs/297 test multiple raid types in
> their workout() function.  We may not support some of the raid types, so
> add a check in the workout() function to skip any incompatible raid
> profiles.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thx
Anand

> ---
>   tests/btrfs/197 | 10 ++++++++--
>   tests/btrfs/198 | 10 ++++++++--
>   tests/btrfs/297 | 10 ++++++++++
>   3 files changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/btrfs/197 b/tests/btrfs/197
> index 2ce41b32..9ec4e9f0 100755
> --- a/tests/btrfs/197
> +++ b/tests/btrfs/197
> @@ -30,14 +30,20 @@ _supported_fs btrfs
>   _require_test
>   _require_scratch
>   _require_scratch_dev_pool 5
> -# Zoned btrfs only supports SINGLE profile
> -_require_non_zoned_device ${SCRATCH_DEV}
> +# We require at least one raid setup, raid1 is the easiest, use this to gate on
> +# wether or not we run this test
> +_require_btrfs_raid_type raid1
>   
>   workout()
>   {
>   	raid=$1
>   	device_nr=$2
>   
> +	if ! _check_btrfs_raid_type $raid; then
> +		echo "$raid isn't supported, skipping" >> $seqres.full
> +		return
> +	fi
> +
>   	echo $raid >> $seqres.full
>   	_scratch_dev_pool_get $device_nr
>   	_spare_dev_get
> diff --git a/tests/btrfs/198 b/tests/btrfs/198
> index a326a8ca..c5a8f392 100755
> --- a/tests/btrfs/198
> +++ b/tests/btrfs/198
> @@ -18,8 +18,9 @@ _supported_fs btrfs
>   _require_command "$WIPEFS_PROG" wipefs
>   _require_scratch
>   _require_scratch_dev_pool 4
> -# Zoned btrfs only supports SINGLE profile
> -_require_non_zoned_device ${SCRATCH_DEV}
> +# We require at least one raid setup, raid1 is the easiest, use this to gate on
> +# wether or not we run this test
> +_require_btrfs_raid_type raid1
>   _fixed_by_kernel_commit 96c2e067ed3e3e \
>   	"btrfs: skip devices without magic signature when mounting"
>   
> @@ -28,6 +29,11 @@ workout()
>   	raid=$1
>   	device_nr=$2
>   
> +	if ! _check_btrfs_raid_type $raid; then
> +		echo "$raid isn't supported, skipping" >> $seqres.full
> +		return
> +	fi
> +
>   	echo $raid >> $seqres.full
>   	_scratch_dev_pool_get $device_nr
>   
> diff --git a/tests/btrfs/297 b/tests/btrfs/297
> index a0023861..7afe854d 100755
> --- a/tests/btrfs/297
> +++ b/tests/btrfs/297
> @@ -18,11 +18,21 @@ _require_scratch_dev_pool 3
>   _fixed_by_kernel_commit 486c737f7fdc \
>   	"btrfs: raid56: always verify the P/Q contents for scrub"
>   
> +# If neither raid5 or raid6 are supported do _notrun
> +if ! _check_btrfs_raid_type raid5 && ! _check_btrfs_raid_type raid6; then
> +	_notrun "requires either raid5 or raid6 support"
> +fi
> +
>   workload()
>   {
>   	local profile=$1
>   	local nr_devs=$2
>   
> +	if ! _check_btrfs_raid_type $profile; then
> +		echo "$profile isn't supported, skipping" >> $seqres.full
> +		return
> +	fi
> +
>   	echo "=== Testing $nr_devs devices $profile ===" >> $seqres.full
>   	_scratch_dev_pool_get $nr_devs
>
diff mbox series

Patch

diff --git a/tests/btrfs/197 b/tests/btrfs/197
index 2ce41b32..9ec4e9f0 100755
--- a/tests/btrfs/197
+++ b/tests/btrfs/197
@@ -30,14 +30,20 @@  _supported_fs btrfs
 _require_test
 _require_scratch
 _require_scratch_dev_pool 5
-# Zoned btrfs only supports SINGLE profile
-_require_non_zoned_device ${SCRATCH_DEV}
+# We require at least one raid setup, raid1 is the easiest, use this to gate on
+# wether or not we run this test
+_require_btrfs_raid_type raid1
 
 workout()
 {
 	raid=$1
 	device_nr=$2
 
+	if ! _check_btrfs_raid_type $raid; then
+		echo "$raid isn't supported, skipping" >> $seqres.full
+		return
+	fi
+
 	echo $raid >> $seqres.full
 	_scratch_dev_pool_get $device_nr
 	_spare_dev_get
diff --git a/tests/btrfs/198 b/tests/btrfs/198
index a326a8ca..c5a8f392 100755
--- a/tests/btrfs/198
+++ b/tests/btrfs/198
@@ -18,8 +18,9 @@  _supported_fs btrfs
 _require_command "$WIPEFS_PROG" wipefs
 _require_scratch
 _require_scratch_dev_pool 4
-# Zoned btrfs only supports SINGLE profile
-_require_non_zoned_device ${SCRATCH_DEV}
+# We require at least one raid setup, raid1 is the easiest, use this to gate on
+# wether or not we run this test
+_require_btrfs_raid_type raid1
 _fixed_by_kernel_commit 96c2e067ed3e3e \
 	"btrfs: skip devices without magic signature when mounting"
 
@@ -28,6 +29,11 @@  workout()
 	raid=$1
 	device_nr=$2
 
+	if ! _check_btrfs_raid_type $raid; then
+		echo "$raid isn't supported, skipping" >> $seqres.full
+		return
+	fi
+
 	echo $raid >> $seqres.full
 	_scratch_dev_pool_get $device_nr
 
diff --git a/tests/btrfs/297 b/tests/btrfs/297
index a0023861..7afe854d 100755
--- a/tests/btrfs/297
+++ b/tests/btrfs/297
@@ -18,11 +18,21 @@  _require_scratch_dev_pool 3
 _fixed_by_kernel_commit 486c737f7fdc \
 	"btrfs: raid56: always verify the P/Q contents for scrub"
 
+# If neither raid5 or raid6 are supported do _notrun
+if ! _check_btrfs_raid_type raid5 && ! _check_btrfs_raid_type raid6; then
+	_notrun "requires either raid5 or raid6 support"
+fi
+
 workload()
 {
 	local profile=$1
 	local nr_devs=$2
 
+	if ! _check_btrfs_raid_type $profile; then
+		echo "$profile isn't supported, skipping" >> $seqres.full
+		return
+	fi
+
 	echo "=== Testing $nr_devs devices $profile ===" >> $seqres.full
 	_scratch_dev_pool_get $nr_devs