diff mbox series

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

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

Commit Message

An Long Jan. 13, 2023, 4:35 p.m. UTC
Generally the tester need BTRFS_PROFILE_CONFIGS to test certain
profiles. For example, skip raid56 as it's not supported.

Signed-off-by: An Long <lan@suse.com>
---
 tests/btrfs/011 | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

Comments

Zorro Lang Jan. 13, 2023, 6:40 p.m. UTC | #1
On Sat, Jan 14, 2023 at 12:35:47AM +0800, An Long wrote:
> Generally the tester need BTRFS_PROFILE_CONFIGS to test certain
> profiles. For example, skip raid56 as it's not supported.
> 
> Signed-off-by: An Long <lan@suse.com>
> ---
>  tests/btrfs/011 | 31 +++++++++++++++++++++----------
>  1 file changed, 21 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/btrfs/011 b/tests/btrfs/011
> index 6c3d037f..6dfa1fd6 100755
> --- a/tests/btrfs/011
> +++ b/tests/btrfs/011
> @@ -22,6 +22,8 @@
>  . ./common/preamble
>  _begin_fstest auto replace volume
>  
> +_btrfs_get_profile_configs
> +

Do you need to call it such early? I think this helper should be called after
"_supported_fs btrfs" at least. Or maybe even after those _require_scratch_*
things?

>  noise_pid=0
>  
>  # Override the default cleanup function.
> @@ -237,18 +239,27 @@ btrfs_replace_test()
>  	fi
>  }
>  
> -workout "-m single -d single" 1 no 64
> +if [[ "${_btrfs_profile_configs[@]}" =~ "-m single -d single"( |$) ]]; then
> +	workout "-m single -d single" 1 no 64
> +fi
> +
>  # 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
> +	for t in "-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
>  fi
>  
>  echo "*** done"
> -- 
> 2.35.3
>
diff mbox series

Patch

diff --git a/tests/btrfs/011 b/tests/btrfs/011
index 6c3d037f..6dfa1fd6 100755
--- a/tests/btrfs/011
+++ b/tests/btrfs/011
@@ -22,6 +22,8 @@ 
 . ./common/preamble
 _begin_fstest auto replace volume
 
+_btrfs_get_profile_configs
+
 noise_pid=0
 
 # Override the default cleanup function.
@@ -237,18 +239,27 @@  btrfs_replace_test()
 	fi
 }
 
-workout "-m single -d single" 1 no 64
+if [[ "${_btrfs_profile_configs[@]}" =~ "-m single -d single"( |$) ]]; then
+	workout "-m single -d single" 1 no 64
+fi
+
 # 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
+	for t in "-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
 fi
 
 echo "*** done"