tests: Gate tests for linear flavor with variable LINEAR
Song Liu
maintainerPATCH 1/1 tests: Gate tests for linear flavor with variable LINEAR
linear flavor is being removed in the kernel [1], so tests for the linear flavor will fail. Gate tests for linear flavor with LINEAR=yes, so that we can still run these tests for older kernels.
[1] https://lore.kernel.org/linux-raid/[email protected]/
--- tests/00linear | 5 +++++ tests/00names | 8 +++++++- tests/00raid0 | 4 ++++ tests/00readonly | 8 +++++++- tests/02lineargrow | 5 +++++ tests/03assem-incr | 8 +++++++- tests/03r0assem | 4 ++++ tests/04r0update | 6 ++++++ 8 files changed, 45 insertions(+), 3 deletions(-)
tests/00linear +5 -0
@@ -1,6 +1,11 @@ # create a simple linear +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + mdadm -CR $md0 -l linear -n3 $dev0 $dev1 $dev2 check linear testdev $md0 3 $mdsize2_l 1
tests/00names +7 -1
@@ -4,7 +4,13 @@ set -x -e conf=$targetdir/mdadm.conf echo "CREATE names=yes" > $conf -for i in linear raid0 raid1 raid4 raid5 raid6 +levels=(raid0 raid1 raid4 raid5 raid6) + +if [ "$LINEAR" == "yes" ]; then + levels+=( linear ) +fi + +for i in ${levels[@]} do mdadm -CR --config $conf /dev/md/$i -l $i -n 4 $dev4 $dev3 $dev2 $dev1 check $i
tests/00raid0 +4 -0
@@ -16,6 +16,10 @@ check raid0 testdev $md0 5 $size 512 mdadm -S $md0 +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi # now same again with different chunk size for chunk in 4 32 256
tests/00readonly +7 -1
@@ -1,8 +1,14 @@ #!/bin/bash +levels=(raid0 raid1 raid4 raid5 raid6 raid10) + +if [ "$LINEAR" == "yes" ]; then + levels+=( linear ) +fi + for metadata in 0.9 1.0 1.1 1.2 do - for level in linear raid0 raid1 raid4 raid5 raid6 raid10 + for level in ${levels[@]} do if [[ $metadata == "0.9" && $level == "raid0" ]]; then
tests/02lineargrow +5 -0
@@ -1,6 +1,11 @@ # create a liner array, and add more drives to to. +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + for e in 0.90 1 1.1 1.2 do case $e in
tests/03assem-incr +7 -1
@@ -6,7 +6,13 @@ set -x -e # Here just test that a partly "-I" assembled array can # be completed with "-A" -for l in 0 1 5 linear +levels=(raid0 raid1 raid5) + +if [ "$LINEAR" == "yes" ]; then + levels+=( linear ) +fi + +for l in ${levels[@]} do mdadm -CR $md0 -l $l -n5 $dev0 $dev1 $dev2 $dev3 $dev4 --assume-clean mdadm -S md0
tests/03r0assem +4 -0
@@ -64,6 +64,10 @@ mdadm --assemble --scan --config=$conf $md2 $tst mdadm -S $md2 +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi ### Now for version 0...
tests/04r0update +6 -0
@@ -1,5 +1,11 @@ # create a raid0, re-assemble with a different super-minor + +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + mdadm -CR -e 0.90 $md0 -llinear -n3 $dev0 $dev1 $dev2 testdev $md0 3 $mdsize0 1 minor1=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
Signature · 1 line
2.34.1
Quoted 143 lines · Song Liu
linear flavor is being removed in the kernel [1], so tests for the linear flavor will fail. Gate tests for linear flavor with LINEAR=yes, so that we can still run these tests for older kernels.
[1] https://lore.kernel.org/linux-raid/[email protected]/
Signed-off-by Song Liu <[email protected]>--- tests/00linear | 5 +++++ tests/00names | 8 +++++++- tests/00raid0 | 4 ++++ tests/00readonly | 8 +++++++- tests/02lineargrow | 5 +++++ tests/03assem-incr | 8 +++++++- tests/03r0assem | 4 ++++ tests/04r0update | 6 ++++++ 8 files changed, 45 insertions(+), 3 deletions(-)tests/00linear +5
-0@@ -1,6 +1,11 @@ # create a simple linear +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + mdadm -CR $md0 -l linear -n3 $dev0 $dev1 $dev2 check linear testdev $md0 3 $mdsize2_l 1tests/00names +7
-1@@ -4,7 +4,13 @@ set -x -e conf=$targetdir/mdadm.conf echo "CREATE names=yes" > $conf -for i in linear raid0 raid1 raid4 raid5 raid6 +levels=(raid0 raid1 raid4 raid5 raid6) + +if [ "$LINEAR" == "yes" ]; then + levels+=( linear ) +fi + +for i in ${levels[@]} do mdadm -CR --config $conf /dev/md/$i -l $i -n 4 $dev4 $dev3 $dev2 $dev1 check $itests/00raid0 +4
-0@@ -16,6 +16,10 @@ check raid0 testdev $md0 5 $size 512 mdadm -S $md0 +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi # now same again with different chunk size for chunk in 4 32 256tests/00readonly +7
-1@@ -1,8 +1,14 @@ #!/bin/bash +levels=(raid0 raid1 raid4 raid5 raid6 raid10) + +if [ "$LINEAR" == "yes" ]; then + levels+=( linear ) +fi + for metadata in 0.9 1.0 1.1 1.2 do - for level in linear raid0 raid1 raid4 raid5 raid6 raid10 + for level in ${levels[@]} do if [[ $metadata == "0.9" && $level == "raid0" ]]; thentests/02lineargrow +5
-0@@ -1,6 +1,11 @@ # create a liner array, and add more drives to to. +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + for e in 0.90 1 1.1 1.2 do case $e intests/03assem-incr +7
-1@@ -6,7 +6,13 @@ set -x -e # Here just test that a partly "-I" assembled array can # be completed with "-A" -for l in 0 1 5 linear +levels=(raid0 raid1 raid5) + +if [ "$LINEAR" == "yes" ]; then + levels+=( linear ) +fi + +for l in ${levels[@]} do mdadm -CR $md0 -l $l -n5 $dev0 $dev1 $dev2 $dev3 $dev4 --assume-clean mdadm -S md0tests/03r0assem +4
-0@@ -64,6 +64,10 @@ mdadm --assemble --scan --config=$conf $md2 $tst mdadm -S $md2 +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi ### Now for version 0...tests/04r0update +0
-0@@ -1,5 +1,11 @@
tests/04r0update line 11
Quoted 10 lines
tests/04r0update +6
-0# create a raid0, re-assemble with a different super-minor + +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + mdadm -CR -e 0.90 $md0 -llinear -n3 $dev0 $dev1 $dev2 testdev $md0 3 $mdsize0 1 minor1=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
Hi Song, this approach looks a bit dirty to me as it's omitting what's already in the test suite. I would prefer adding additional param rather than setting environment variable, so test execution flow stays unified (as far as I'm aware we do not use flags for now). Adding param is also a good excuse to explain why linear is not tested by default in "--help".
Another thing is "--raidtype=linear" option, is probably redundant now.
Thanks, Mateusz
Song Liu
maintainerOn Thu, Dec 28, 2023 at 6:28 AM Mateusz Kusiak
<[email protected]> wrote:
[...]
Quoted 12 lines
# create a raid0, re-assemble with a different super-minortests/04r0update +6
-0+ +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + mdadm -CR -e 0.90 $md0 -llinear -n3 $dev0 $dev1 $dev2 testdev $md0 3 $mdsize0 1 minor1=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
Quoted 1 line
Hi Song, this approach looks a bit dirty to me as it's omitting what's already in the test suite. I would prefer adding additional param rather than setting environment variable, so test execution flow stays unified (as far as I'm aware we do not use flags for now). Adding param is also a good excuse to explain why linear is not tested by default in "--help".
We have something similar to this in tests/00multipath, so I used this pattern.
Thanks,
Song
Quoted 4 lines
Another thing is "--raidtype=linear" option, is probably redundant now.
Thanks, Mateusz
Quoted 15 lines · On Fri, 29 Dec 2023 00:12:43 -0800 Song Liu <[email protected]> wrote:
On Thu, Dec 28, 2023 at 6:28 AM Mateusz Kusiak
<[email protected]> wrote:
[...]Quoted 12 lines
# create a raid0, re-assemble with a different super-minortests/04r0update +6
-0+ +if [ "$LINEAR" != "yes" ]; then + echo -ne 'skipping... ' + exit 0 +fi + mdadm -CR -e 0.90 $md0 -llinear -n3 $dev0 $dev1 $dev2 testdev $md0 3 $mdsize0 1 minor1=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
Quoted 8 lines
Quoted 5 lines
Hi Song, this approach looks a bit dirty to me as it's omitting what's already in the test suite. I would prefer adding additional param rather than setting environment variable, so test execution flow stays unified (as far as I'm aware we do not use flags for now). Adding param is also a good excuse to explain why linear is not tested by default in "--help".
We have something similar to this in tests/00multipath, so I used this pattern.
Hi Song,
Please note that MULTIPATH env variable is handled inside testing framework. This variable is set to yes if multipath module is available. It can be also disabled by --disable-multipath. It is described in help.
it is invoked by main() -> do_setup() -> check_env().
Now we need to handle both linear and multipath same way. There are two options:
- disable them by default and add --enable-multipath and --enable-linear options,
- make linear to work same as multipath now, add --disable-linear flag.
I don't have strong preference. Both ways are acceptable for me.
You disabled testing those levels by default. It looks good to me but we need to explain it little in message to give user clue why those levels are skipped. Test result should be possible straightforward for less experienced users so please expand messages, like:
"Skipping, \$LINEAR set to \"$LINEAR\""
It i just an example, I didn't test it. The final message depends on option you will choose.
Mdadm is a kind of user interface for MD driver. I expect that not only developers are using this test suite. We need to keep it easy to use, messages should be meaningful and helpful.
Quoted 3 lines
Quoted 3 lines
Another thing is "--raidtype=linear" option, is probably redundant now.
Env variable are better implemented now than this --raidtype option. There is more work to do to make --raidtype fully valid because --raidtype uses filtering by test name. Test may define set of levels used, even if the name doesn't point to any level. So yes, I think that we can eventually remove --raidtype=linear as it is not really useful but I give it up to Song.
Thanks,
Mariusz
Song Liu
maintainerHi Mariusz,
Thanks for these explanations.
Quoted 1 line · Mariusz Tkaczyk
[...]
Quoted 9 lines
It i just an example, I didn't test it. The final message depends on option you will choose.
Mdadm is a kind of user interface for MD driver. I expect that not only developers are using this test suite. We need to keep it easy to use, messages should be meaningful and helpful.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Another thing is "--raidtype=linear" option, is probably redundant now.
Env variable are better implemented now than this --raidtype option. There is more work to do to make --raidtype fully valid because --raidtype uses filtering by test name. Test may define set of levels used, even if the name doesn't point to any level. So yes, I think that we can eventually remove --raidtype=linear as it is not really useful but I give it up to Song.
How about we add something like the following on top of this patch?
Thanks,
Song
test +0 -0
@@ -140,6 +140,7 @@ do_help() { --raidtype=
raid0|linear|raid1|raid456|raid10|ddf|imsm
--disable-multipath Disable any tests
involving multipath
--disable-integrity Disable slow tests of
RAID[56] consistency
+ --disable-linear Disable any tests involving linear
--logdir=directory Directory to save all logfiles in
--save-logs Usually use with --logdir together
--keep-going | --no-error Don't stop on error, ie.
run all tests
@@ -255,6 +256,9 @@ parse_args() {
--disable-integrity )
unset INTEGRITY
;;
+ --disable-linear )
+ unset LINEAR
+ ;;
--dev=* )
case ${i##*=} in
loop )tests/func.sh +7 -0
@@ -123,6 +123,14 @@ check_env() { modprobe multipath 2> /dev/null grep -sq 'Personalities : .*multipath' /proc/mdstat && MULTIPATH="yes" + + # Check whether to run linear tests + modprobe linear 2> /dev/null + grep -sq 'Personalities : .*linear' /proc/mdstat && + LINEAR="yes" + if [ "$LINEAR" != "yes" ]; then + echo "test: skipping tests for linear, which is
removed in upstream 6.8+ kernels"
+ fi
}
do_setup() {
Quoted 76 lines · On Fri, 5 Jan 2024 15:18:07 -0800 Song Liu <[email protected]> wrote:
Hi Mariusz,
Thanks for these explanations.
Quoted 1 line · Mariusz Tkaczyk
[...]
Quoted 9 lines
It i just an example, I didn't test it. The final message depends on option you will choose.
Mdadm is a kind of user interface for MD driver. I expect that not only developers are using this test suite. We need to keep it easy to use, messages should be meaningful and helpful.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Another thing is "--raidtype=linear" option, is probably redundant now.
Env variable are better implemented now than this --raidtype option. There is more work to do to make --raidtype fully valid because --raidtype uses filtering by test name. Test may define set of levels used, even if the name doesn't point to any level. So yes, I think that we can eventually remove --raidtype=linear as it is not really useful but I give it up to Song.
How about we add something like the following on top of this patch?
Thanks,
Songtest +0
-0@@ -140,6 +140,7 @@ do_help() { --raidtype=raid0|linear|raid1|raid456|raid10|ddf|imsm
--disable-multipath Disable any tests
involving multipath
--disable-integrity Disable slow tests of
RAID[56] consistency+ --disable-linear Disable any tests involving linear --logdir=directory Directory to save all logfiles in --save-logs Usually use with --logdir together --keep-going | --no-error Don't stop on error, ie.run all tests
test +3
-0@@ -255,6 +256,9 @@ parse_args() { --disable-integrity ) unset INTEGRITY ;; + --disable-linear ) + unset LINEAR + ;; --dev=* ) case ${i##*=} in loop )tests/func.sh +7
-0@@ -123,6 +123,14 @@ check_env() { modprobe multipath 2> /dev/null grep -sq 'Personalities : .*multipath' /proc/mdstat && MULTIPATH="yes" + + # Check whether to run linear tests + modprobe linear 2> /dev/null + grep -sq 'Personalities : .*linear' /proc/mdstat && + LINEAR="yes" + if [ "$LINEAR" != "yes" ]; then + echo "test: skipping tests for linear, which isremoved in upstream 6.8+ kernels"
+ fi
}
Quoted 1 line
do_setup(){
Approach looks good to me but multipath case handling is missed. Can we add a message for Multipath?
Thanks!
Mariusz