mdadm/test: add do_clean to ensure each case only catch its own testlog

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Zhilong Liu 2018-02-02 14:10:47 +08:00 committed by Jes Sorensen
parent 7d81135e8a
commit 064bd3f5ca
3 changed files with 15 additions and 6 deletions

View File

@ -196,9 +196,8 @@ do_setup()
ulimit -c unlimited
}
cleanup()
do_clean()
{
check_ssh
for ip in $NODE1 $NODE2
do
ssh $ip "mdadm -Ssq; dmesg -c > /dev/null"
@ -206,6 +205,12 @@ cleanup()
mdadm --zero ${devlist[@]} &> /dev/null
}
cleanup()
{
check_ssh
do_clean
}
# check: $1/cluster_node $2/feature $3/optional
check()
{

4
test
View File

@ -82,11 +82,9 @@ do_test() {
if [ -f "$_script" ]
then
rm -f $targetdir/stderr
# stop all arrays, just incase some script left an array active.
$mdadm -Ssq 2> /dev/null
mdadm --zero $devlist 2> /dev/null
# this might have been reset: restore the default.
echo 2000 > /proc/sys/dev/raid/speed_limit_max
do_clean
# source script in a subshell, so it has access to our
# namespace, but cannot change it.
echo -ne "$_script... "

View File

@ -88,6 +88,13 @@ cleanup() {
esac
}
do_clean()
{
mdadm -Ss > /dev/null
mdadm --zero $devlist 2> /dev/null
dmesg -c > /dev/null
}
check_env() {
user=$(id -un)
[ "X$user" != "Xroot" ] && {
@ -141,7 +148,6 @@ do_setup() {
check_env
[ -d $logdir ] || mkdir -p $logdir
dmesg -c > /dev/null
devlist=
if [ "$DEVTYPE" == "loop" ]