diff mbox series

[v6] btrfs/011: use $_btrfs_profile_configs to limit the tests

Message ID 20230215051319.10327-1-lan@suse.com (mailing list archive)
State New, archived
Headers show
Series [v6] btrfs/011: use $_btrfs_profile_configs to limit the tests | expand

Commit Message

An Long Feb. 15, 2023, 5:13 a.m. UTC
Generally the tester need BTRFS_PROFILE_CONFIGS to test certain
profeils. For example, skip raid56 as it's not supported.

For dup profile, add dup to default profile configs.

Signed-off-by: An Long <lan@suse.com>
---
 common/btrfs    |  3 +++
 tests/btrfs/011 | 30 +++++++++++++++++-------------
 2 files changed, 20 insertions(+), 13 deletions(-)

Comments

Zorro Lang Feb. 16, 2023, 2:55 p.m. UTC | #1
On Wed, Feb 15, 2023 at 01:13:19PM +0800, An Long wrote:
> Generally the tester need BTRFS_PROFILE_CONFIGS to test certain
> profeils. For example, skip raid56 as it's not supported.
> 
> For dup profile, add dup to default profile configs.
> 
> Signed-off-by: An Long <lan@suse.com>
> ---

David has given his RVB to V5 patch, so if no other review points, I'll merge
this patch with:

Reviewed-by: David Disseldorp <ddiss@suse.de> 

>  common/btrfs    |  3 +++
>  tests/btrfs/011 | 30 +++++++++++++++++-------------
>  2 files changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index ee673a93..6557af86 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -213,6 +213,9 @@ _btrfs_get_profile_configs()
>  			"raid5:raid5"
>  			"raid6:raid6"
>  		)
> +		if [ "$1" == "dup" ]; then
> +			configs+=("dup:dup")
> +		fi
>  	else
>  		# User-provided configurations.
>  		local configs=(${BTRFS_PROFILE_CONFIGS[@]})
> diff --git a/tests/btrfs/011 b/tests/btrfs/011
> index 6c3d037f..852742ee 100755
> --- a/tests/btrfs/011
> +++ b/tests/btrfs/011
> @@ -48,6 +48,7 @@ _require_scratch_dev_pool 5
>  _require_scratch_dev_pool_equal_size
>  _require_scratch_size $((10 * 1024 * 1024)) #kB
>  _require_command "$WIPEFS_PROG" wipefs
> +_btrfs_get_profile_configs dup
>  
>  rm -f $tmp.*
>  
> @@ -237,19 +238,22 @@ btrfs_replace_test()
>  	fi
>  }
>  
> -workout "-m single -d single" 1 no 64
> -# Mixed BG & RAID/DUP profiles are not supported on zoned btrfs
> -if ! _scratch_btrfs_is_zoned; then
> -	workout "-m dup -d single" 1 no 64
> -	workout "-m dup -d single" 1 cancel 1024
> -	workout "-m raid0 -d raid0" 2 no 64
> -	workout "-m raid1 -d raid1" 2 no 2048
> -	workout "-m raid10 -d raid10" 4 no 64
> -	workout "-m single -d single -M" 1 no 64
> -	workout "-m dup -d dup -M" 1 no 64
> -	workout "-m raid5 -d raid5" 2 no 64
> -	workout "-m raid6 -d raid6" 3 no 64
> -fi
> +for t in "-m single -d single:1 no 64" \
> +	"-m dup -d single:1 no 64" \
> +	"-m dup -d single:1 cancel 1024" \
> +	"-m raid0 -d raid0:2 no 64" \
> +	"-m raid1 -d raid1:2 no 2048" \
> +	"-m raid10 -d raid10:4 no 64" \
> +	"-m single -d single -M:1 no 64" \
> +	"-m dup -d dup -M:1 no 64" \
> +	"-m raid5 -d raid5:2 no 64" \
> +	"-m raid6 -d raid6:3 no 64"; do
> +	mkfs_option=${t%:*}
> +	workout_option=${t#*:}
> +	if [[ "${_btrfs_profile_configs[@]}" =~ "${mkfs_option/ -M}"( |$) ]]; then
> +		workout "$mkfs_option" $workout_option
> +	fi
> +done
>  
>  echo "*** done"
>  status=0
> -- 
> 2.35.3
>
diff mbox series

Patch

diff --git a/common/btrfs b/common/btrfs
index ee673a93..6557af86 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -213,6 +213,9 @@  _btrfs_get_profile_configs()
 			"raid5:raid5"
 			"raid6:raid6"
 		)
+		if [ "$1" == "dup" ]; then
+			configs+=("dup:dup")
+		fi
 	else
 		# User-provided configurations.
 		local configs=(${BTRFS_PROFILE_CONFIGS[@]})
diff --git a/tests/btrfs/011 b/tests/btrfs/011
index 6c3d037f..852742ee 100755
--- a/tests/btrfs/011
+++ b/tests/btrfs/011
@@ -48,6 +48,7 @@  _require_scratch_dev_pool 5
 _require_scratch_dev_pool_equal_size
 _require_scratch_size $((10 * 1024 * 1024)) #kB
 _require_command "$WIPEFS_PROG" wipefs
+_btrfs_get_profile_configs dup
 
 rm -f $tmp.*
 
@@ -237,19 +238,22 @@  btrfs_replace_test()
 	fi
 }
 
-workout "-m single -d single" 1 no 64
-# Mixed BG & RAID/DUP profiles are not supported on zoned btrfs
-if ! _scratch_btrfs_is_zoned; then
-	workout "-m dup -d single" 1 no 64
-	workout "-m dup -d single" 1 cancel 1024
-	workout "-m raid0 -d raid0" 2 no 64
-	workout "-m raid1 -d raid1" 2 no 2048
-	workout "-m raid10 -d raid10" 4 no 64
-	workout "-m single -d single -M" 1 no 64
-	workout "-m dup -d dup -M" 1 no 64
-	workout "-m raid5 -d raid5" 2 no 64
-	workout "-m raid6 -d raid6" 3 no 64
-fi
+for t in "-m single -d single:1 no 64" \
+	"-m dup -d single:1 no 64" \
+	"-m dup -d single:1 cancel 1024" \
+	"-m raid0 -d raid0:2 no 64" \
+	"-m raid1 -d raid1:2 no 2048" \
+	"-m raid10 -d raid10:4 no 64" \
+	"-m single -d single -M:1 no 64" \
+	"-m dup -d dup -M:1 no 64" \
+	"-m raid5 -d raid5:2 no 64" \
+	"-m raid6 -d raid6:3 no 64"; do
+	mkfs_option=${t%:*}
+	workout_option=${t#*:}
+	if [[ "${_btrfs_profile_configs[@]}" =~ "${mkfs_option/ -M}"( |$) ]]; then
+		workout "$mkfs_option" $workout_option
+	fi
+done
 
 echo "*** done"
 status=0