diff mbox series

btrfs/011: use $_btrfs_profile_configs to limit the tests

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

Commit Message

An Long Jan. 10, 2023, 5:22 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 | 48 ++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 10 deletions(-)

Comments

David Disseldorp Jan. 11, 2023, 12:18 p.m. UTC | #1
Hi,

On Wed, 11 Jan 2023 01:22:21 +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 | 48 ++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 38 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/btrfs/011 b/tests/btrfs/011
> index 6c3d037f..b9d175d1 100755
> --- a/tests/btrfs/011
> +++ b/tests/btrfs/011
> @@ -22,6 +22,8 @@
>  . ./common/preamble
>  _begin_fstest auto replace volume
>  
> +_btrfs_get_profile_configs
...
> +	if [[ "${_btrfs_profile_configs[@]}" =~ "-m raid1 -d raid1" ]]; then
> +		workout "-m raid1 -d raid1" 2 no 2048
> +	fi

These regexes aren't anchored, so above could match "-m raid1 -d raid10"
- not a problem given current profiles, but still not ideal.

My preference would be to use a loop for filtering workout parameters
against _btrfs_profile_configs, e.g.

for i in "-m single -d single:1 no 64" \
	 "-m dup -d single:1 no 64" \
	 "-m dup -d single:1 cancel 1024" \
	 ...; do
	# confirm "${i%:*}" is in _btrfs_profile_configs...
	workout "${i%:*}" ${i#*:}
done

Cheers, David
diff mbox series

Patch

diff --git a/tests/btrfs/011 b/tests/btrfs/011
index 6c3d037f..b9d175d1 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,44 @@  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
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m dup -d single" ]]; then
+		workout "-m dup -d single" 1 no 64
+		workout "-m dup -d single" 1 cancel 1024
+	fi
+
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m raid0 -d raid0" ]]; then
+		workout "-m raid0 -d raid0" 2 no 64
+	fi
+
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m raid1 -d raid1" ]]; then
+		workout "-m raid1 -d raid1" 2 no 2048
+	fi
+
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m raid10 -d raid10" ]]; then
+		workout "-m raid10 -d raid10" 4 no 64
+	fi
+
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m single -d single" ]]; then
+		workout "-m single -d single -M" 1 no 64
+	fi
+
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m dup -d dup" ]]; then
+		workout "-m dup -d dup -M" 1 no 64
+	fi
+
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m raid5 -d raid5" ]]; then
+		workout "-m raid5 -d raid5" 2 no 64
+	fi
+
+	if [[ "${_btrfs_profile_configs[@]}" =~ "-m raid6 -d raid6" ]]; then
+		workout "-m raid6 -d raid6" 3 no 64
+	fi
 fi
 
 echo "*** done"