]>
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 # this might have been reset: restore the default.
86 echo 2000 > /proc
/sys
/dev
/raid
/speed_limit_max
88 # source script in a subshell, so it has access to our
89 # namespace, but cannot change it.
90 echo -ne "$_script... "
91 if ( set -ex ; .
$_script ) &> $targetdir/log
93 dmesg |
grep -iq "error\|call trace\|segfault" &&
94 die
"dmesg prints errors when testing $_basename!"
101 [ "$savelogs" == "1" ] &&
102 mv -f $targetdir/log
$logdir/$_basename.log
103 [ "$_fail" == "1" -a "$exitonerror" == "1" ] && exit 1
110 Example for disk mode: ./test --dev=disk --disks=/dev/sda{2..15}
112 --tests=test1,test2,... Comma separated list of tests to run
113 --testdir= Specify testdir as tests|clustermd_tests
114 --raidtype= raid0|linear|raid1|raid456|raid10|ddf|imsm
115 --disable-multipath Disable any tests involving multipath
116 --disable-integrity Disable slow tests of RAID[56] consistency
117 --logdir=directory Directory to save all logfiles in
118 --save-logs Usually use with --logdir together
119 --keep-going | --no-error Don't stop on error, ie. run all tests
120 --dev=loop|lvm|ram|disk Use loop devices (default), LVM, RAM or disk
121 --disks= Provide a bunch of physical devices for test
122 --volgroup=name LVM volume group for LVM test
123 setup Setup test environment and exit
124 cleanup Cleanup test environment
125 prefix Run tests with <prefix>
126 --help | -h Print this usage
140 testdir
=clustermd_tests
141 CLUSTER_CONF
="$PWD/$testdir/cluster_conf"
144 echo "Unknown argument: $i"
152 [ -z "$testdir" ] && testdir
=tests
161 echo "mdadm test environment setup"
173 TESTLIST
=($
(echo ${i##*=} |
sed -e 's/,/ /g'))
178 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r0\|raid0"))
181 TESTLIST
=($
(ls $testdir |
grep "linear"))
184 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r1\|raid1" |
grep -vi "r10\|raid10"))
187 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r[4-6]\|raid[4-6]"))
190 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]r10\|raid10"))
193 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]ddf"))
196 TESTLIST
=($
(ls $testdir |
grep "[0-9][0-9]imsm"))
199 echo "Unknown argument: $i"
211 --keep-going |
--no-error )
214 --disable-multipath )
217 --disable-integrity )
235 echo "Unknown argument: $i"
242 disks
=(${disks[*]} ${i##*=})
245 LVM_VOLGROUP
=`expr "x$i" : 'x[^=]*=\(.*\)'`
252 echo " $0: Unknown argument: $i"
263 echo "Testing on linux-$(uname -r) kernel"
264 [ "$savelogs" == "1" ] &&
265 echo "Saving logs to $logdir"
266 if [ "x$TESTLIST" != "x" ]
268 for script in ${TESTLIST[@]}
270 do_test
$testdir/$script
273 for script in $testdir/$prefix $testdir/$prefix*[^~
]