summaryrefslogtreecommitdiffstats
path: root/tests/check
blob: f4ed6d5b9d8c7c3d2326079a7b84dfa890fffd60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
case $1 in
 raid* | linear )
   grep -s "active $1 " /proc/mdstat > /dev/null || {
		echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
  ;;
 resync | recovery )
   sleep 0.1
   grep -s $1 /proc/mdstat > /dev/null || {
		echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
  ;;

  nosync )
    sleep 0.5
    grep -s 're[synccovery]* =' > /dev/null /proc/mdstat && {
		echo >&2 "ERROR resync or recovery is happening!"; cat /proc/mdstat ; exit 1; }
  ;;

 wait )
   sleep 0.1
   while grep 're[synccovery]* =' > /dev/null /proc/mdstat
   do sleep 2;
   done
   ;;

 state )
    grep -s "blocks.*\[$2\]\$" /proc/mdstat > /dev/null || {
		echo >&2 "ERROR state $2 not found!"; cat /proc/mdstat ; exit 1; }
    sleep 0.5
   ;;

 * ) echo >&2 ERROR unknown check $1 ; exit 1;
esac

exit 0