]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - clustermd_tests/func.sh
mdadm/test: mdadm needn't make install on the system
[thirdparty/mdadm.git] / clustermd_tests / func.sh
index 23874245167a87725bb93e2ac25f2b334b815253..642cc966ef61d56d00bd777ec1abacc885dd3077 100644 (file)
@@ -86,10 +86,13 @@ check_env()
                echo "testing can only be done as 'root'."
                exit 1
        }
+       [ \! -x $mdadm ] && {
+               echo "test: please run make everything before perform testing."
+               exit 1
+       }
        check_ssh
        commands=(mdadm iscsiadm bc modinfo dlm_controld
                  udevadm crm crm_mon lsblk pgrep sbd)
-       mdadm_src_ver="$($mdadm -V 2>&1)"
        for ip in $NODE1 $NODE2
        do
                for cmd in ${commands[@]}
@@ -99,12 +102,6 @@ check_env()
                                exit 1
                        }
                done
-               mdadm_sbin_ver="$(ssh $ip "mdadm -V 2>&1")"
-               if [ "$mdadm_src_ver" != "$mdadm_sbin_ver" ]
-               then
-                       echo "$ip: please run 'make install' before testing."
-                       exit 1
-               fi
                mods=(raid1 raid10 md_mod dlm md-cluster)
                for mod in ${mods[@]}
                do
@@ -178,6 +175,8 @@ save_log()
                        then
                                echo "##$ip: mdadm -X ${md_disks[@]}" >> $logdir/$logfile
                                ssh $ip "mdadm -X ${md_disks[@]}" >> $logdir/$logfile
+                               echo "##$ip: mdadm -E ${md_disks[@]}" >> $logdir/$logfile
+                               ssh $ip "mdadm -E ${md_disks[@]}" >> $logdir/$logfile
                        fi
                else
                        echo "##$ip: no array assembled!" >> $logdir/$logfile
@@ -194,9 +193,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"
@@ -204,6 +202,12 @@ cleanup()
        mdadm --zero ${devlist[@]} &> /dev/null
 }
 
+cleanup()
+{
+       check_ssh
+       do_clean
+}
+
 # check: $1/cluster_node $2/feature $3/optional
 check()
 {
@@ -271,12 +275,17 @@ check()
                bitmap )
                        for ip in ${NODES[@]}
                        do
-                               echo $ip
-                               ssh $ip cat /proc/mdstat
                                ssh $ip "grep -sq '$2' /proc/mdstat" ||
                                        die "$ip: no '$2' found in /proc/mdstat."
                        done
                ;;
+               nobitmap )
+                       for ip in ${NODES[@]}
+                       do
+                               ssh $ip "grep -sq 'bitmap' /proc/mdstat" &&
+                                       die "$ip: 'bitmap' found in /proc/mdstat."
+                       done
+               ;;
                chunk )
                        for ip in ${NODES[@]}
                        do