diff mbox series

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

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

Commit Message

An Long Jan. 14, 2023, 3:19 a.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 | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

Comments

David Disseldorp Jan. 20, 2023, 11:49 a.m. UTC | #1
Hi,

On Sat, 14 Jan 2023 11:19:09 +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 | 30 ++++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/btrfs/011 b/tests/btrfs/011
> index 6c3d037f..ac45e735 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
>  
>  rm -f $tmp.*
>  
> @@ -237,18 +238,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" \

This dup/dup case no longer gets run with a default
_btrfs_profile_configs[]. Is that intentional?

Cheers, David
An Long Jan. 20, 2023, 3:59 p.m. UTC | #2
On Fri, 2023-01-20 at 12:49 +0100, David Disseldorp wrote:
> Hi,
> 
> On Sat, 14 Jan 2023 11:19:09 +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 | 30 ++++++++++++++++++++----------
> >  1 file changed, 20 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tests/btrfs/011 b/tests/btrfs/011
> > index 6c3d037f..ac45e735 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
> >  
> >  rm -f $tmp.*
> >  
> > @@ -237,18 +238,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" \
> 
> This dup/dup case no longer gets run with a default
> _btrfs_profile_configs[]. Is that intentional?
> 
> Cheers, David

I thought profiles from "BTRFS_PROFILE_CONFIGS" should be fine. But
this really changed behavior with default configs, and will get worse
if use "_btrfs_profile_configs replace".

In a brief, I just need a way to limit tests. If the default
config is not 
suitable, how about using a new argument to
"_btrfs_get_profile_configs"?

Thanks,
An Long
David Disseldorp Jan. 20, 2023, 5:19 p.m. UTC | #3
Hi,

On Fri, 20 Jan 2023 15:59:02 +0000, Long An wrote:

...
> > > +               "-m dup -d dup -M:1 no 64" \  
> > 
> > This dup/dup case no longer gets run with a default
> > _btrfs_profile_configs[]. Is that intentional?
> > 
> > Cheers, David  
> 
> I thought profiles from "BTRFS_PROFILE_CONFIGS" should be fine. But
> this really changed behavior with default configs, and will get worse
> if use "_btrfs_profile_configs replace".
> 
> In a brief, I just need a way to limit tests. If the default
> config is not 
> suitable, how about using a new argument to
> "_btrfs_get_profile_configs"?

Yes, a new parameter for _btrfs_get_profile_configs() which adds the
missing "dup:dup" entry sounds reasonable.

Cheers, David
diff mbox series

Patch

diff --git a/tests/btrfs/011 b/tests/btrfs/011
index 6c3d037f..ac45e735 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
 
 rm -f $tmp.*
 
@@ -237,18 +238,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"