]>
git.ipfire.org Git - thirdparty/mdadm.git/blob - test
3 # run test suite for mdadm
15 # use loop devices by default if doesn't specify --dev
20 # make sure to test local mdmon, not system one
21 export MDADM_NO_SYSTEMCTL
=1
23 # assume md0, md1, md2 exist in /dev
31 echo -e "\n\tERROR: $* \n"
40 # mdadm always adds --quiet, and we want to see any unexpected messages
42 rm -f $targetdir/stderr
46 p
=`cat /proc/sys/dev/raid/speed_limit_max`
47 echo 20000 > /proc
/sys
/dev
/raid
/speed_limit_max
51 *-C* |
*--create* |
*-B* |
*--build* )
52 # clear superblock every time once creating or
53 # building arrays, because it's always creating
54 # and building array many times in a test case.
57 [[ $args =~
"/dev/" ]] && {
58 [[ $args =~
"md" ]] ||
59 $mdadm --zero $args > /dev
/null
62 $mdadm 2> $targetdir/stderr
--quiet "$@" --auto=yes
65 $mdadm 2> $targetdir/stderr
--quiet "$@"
72 echo $p > /proc
/sys
/dev
/raid
/speed_limit_max
75 cat >&2 $targetdir/stderr
81 _basename
=`basename $_script`
84 rm -f $targetdir/stderr
85 # stop all arrays, just incase some script left an array active.
86 $mdadm -Ssq 2> /dev
/null
87 mdadm
--zero $devlist 2> /dev
/null
88 # this might have been reset: restore the default.
89 echo 2000 > /proc
/sys
/dev
/raid
/speed_limit_max
90 # source script in a subshell, so it has access to our
91 # namespace, but cannot change it.
92 echo -ne "$_script... "
93 if ( set -ex ; .
$_script ) &> $targetdir/log
95 dmesg |
grep -iq "error\|call trace\|segfault" &&
96 die
"dmesg prints errors when testing $_basename!"
103 [ "$savelogs" == "1" ] &&
104 mv -f $targetdir/log
$logdir/$_basename.log
105 [ "$_fail" == "1" -a "$exitonerror" == "1" ] && exit 1
112 Example for disk mode: ./test --dev=disk --disks=/dev/sda{2..15}
114 --tests=test1,test2,... Comma separated list of tests to run
115 --testdir= Specify testdir as tests|clustermd_tests
116 --raidtype= raid0|linear|raid1|raid456|raid10|ddf|imsm
117 --disable-multipath Disable any tests involving multipath
118 --disable-integrity Disable slow tests of RAID[56] consistency
119 --logdir=directory Directory to save all logfiles in
120 --save-logs Usually use with --logdir together
121 --keep-going | --no-error Don't stop on error, ie. run all tests
122 --dev=loop|lvm|ram|disk Use loop devices (default), LVM, RAM or disk
123 --disks= Provide a bunch of physical devices for test
124 --volgroup=name LVM volume group for LVM test
125 setup Setup test environment and exit
126 cleanup Cleanup test environment
127 prefix Run tests with <prefix>
128 --help | -h Print this usage
142 testdir
=clustermd_tests
143 CLUSTER_CONF
="$PWD/$testdir/cluster_conf"
146 echo "Unknown argument: $i"
154 [ -z "$testdir" ] && testdir
=tests
163 echo "mdadm test environment setup"
175 TESTLIST
=($
(echo ${i##*=} |
sed -e 's/,/ /g'))
180 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r0\|raid0"))
183 TESTLIST
=($
(ls $testdir |
grep "linear"))
186 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r1\|raid1" |
grep -vi raid10
))
189 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r[4-6]\|raid[4-6]"))
192 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r10\|raid10"))
195 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]ddf"))
198 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]imsm"))
201 echo "Unknown argument: $i"
213 --keep-going |
--no-error )
216 --disable-multipath )
219 --disable-integrity )
237 echo "Unknown argument: $i"
244 disks
=(${disks[*]} ${i##*=})
247 LVM_VOLGROUP
=`expr "x$i" : 'x[^=]*=\(.*\)'`
254 echo " $0: Unknown argument: $i"
265 echo "Testing on linux-$(uname -r) kernel"
266 [ "$savelogs" == "1" ] &&
267 echo "Saving logs to $logdir"
268 if [ "x$TESTLIST" != "x" ]
270 for script in ${TESTLIST[@]}
272 do_test
$testdir/$script
275 for script in $testdir/$prefix $testdir/$prefix*[^~
]