Whamcloud - gitweb
Branch b1_4_mountconf
[fs/lustre-release.git] / lustre / tests / acceptance-small.sh
1 #!/bin/sh
2 # script which _must_ complete successfully (at minimum) before checkins to
3 # the CVS HEAD are allowed.
4 set -vxe
5
6 PATH=`dirname $0`/../utils:$PATH
7
8 [ "$CONFIGS" ] || CONFIGS="local lov"
9 [ "$MAX_THREADS" ] || MAX_THREADS=10
10 if [ -z "$THREADS" ]; then
11         KB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
12         THREADS=`expr $KB / 16384`
13         [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
14 fi
15 [ "$SIZE" ] || SIZE=40960
16 [ "$RSIZE" ] || RSIZE=512
17 [ "$UID" ] || UID=1000
18 [ "$MOUNT" ] || MOUNT=/mnt/lustre
19 [ "$MOUNT2" ] || MOUNT2=${MOUNT}2
20 [ "$TMP" ] || TMP=/tmp
21 [ "$COUNT" ] || COUNT=1000
22 #[ "$DEBUG_LVL" ] || DEBUG_LVL=0x370200
23 [ "$DEBUG_LVL" ] || DEBUG_LVL=0
24 [ "$DEBUG_OFF" ] || DEBUG_OFF="sysctl -w lnet.debug=$DEBUG_LVL"
25 [ "$DEBUG_ON" ] || DEBUG_ON="sysctl -w lnet.debug=0x33f0480"
26
27 LIBLUSTRE=${LIBLUSTRE:-../liblustre}
28 LIBLUSTRETESTS=${LIBLUSTRETESTS:-$LIBLUSTRE/tests}
29
30 for NAME in $CONFIGS; do
31         export NAME MOUNT START CLEAN
32         [ -e $NAME.sh ] && sh $NAME.sh
33         [ ! -e $NAME.xml ] && [ -z "$LDAPURL" ] && \
34                 echo "no config '$NAME.xml'" 1>&2 && exit 1
35
36         if [ "$RUNTESTS" != "no" ]; then
37                 sh runtests
38         fi
39
40         if [ "$SANITY" != "no" ]; then
41                 SANITYLOG=/tmp/sanity.log sh sanity.sh
42         fi
43
44         if [ "$DBENCH" != "no" ]; then
45                 mount | grep $MOUNT || sh llmount.sh
46                 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
47                 DB_THREADS=`expr $SPACE / 50000`
48                 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
49
50                 $DEBUG_OFF
51                 sh rundbench 1
52                 $DEBUG_ON
53                 sh llmountcleanup.sh
54                 sh llrmount.sh
55                 if [ $DB_THREADS -gt 1 ]; then
56                         $DEBUG_OFF
57                         sh rundbench $DB_THREADS
58                         $DEBUG_ON
59                         sh llmountcleanup.sh
60                         sh llrmount.sh
61                 fi
62                 rm -f /mnt/lustre/`hostname`/client.txt
63         fi
64         chown $UID $MOUNT && chmod 700 $MOUNT
65         if [ "$BONNIE" != "no" ]; then
66                 mount | grep $MOUNT || sh llmount.sh
67                 $DEBUG_OFF
68                 bonnie++ -f -r 0 -s $(($SIZE / 1024)) -n 10 -u $UID -d $MOUNT
69                 $DEBUG_ON
70                 sh llmountcleanup.sh
71                 sh llrmount.sh
72         fi
73
74         IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE"
75         IOZFILE="-f $MOUNT/iozone"
76         if [ "$IOZONE" != "no" ]; then
77                 mount | grep $MOUNT || sh llmount.sh
78                 $DEBUG_OFF
79                 iozone $IOZONE_OPTS $IOZFILE
80                 $DEBUG_ON
81                 sh llmountcleanup.sh
82                 sh llrmount.sh
83
84                 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
85                         $DEBUG_OFF
86                         iozone -I $IOZONE_OPTS $IOZFILE.odir
87                         $DEBUG_ON
88                         sh llmountcleanup.sh
89                         sh llrmount.sh
90                 fi
91
92                 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
93                 IOZ_THREADS=`expr $SPACE / \( $SIZE + $SIZE / 512 \)`
94                 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
95                 IOZVER=`iozone -v|awk '/Revision:/ {print $3}'|tr -d .`
96                 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
97                         $DEBUG_OFF
98                         THREAD=1
99                         IOZFILE="-F "
100                         while [ $THREAD -le $IOZ_THREADS ]; do
101                                 IOZFILE="$IOZFILE $MOUNT/iozone.$THREAD"
102                                 THREAD=`expr $THREAD + 1`
103                         done
104                         iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE
105                         $DEBUG_ON
106                         sh llmountcleanup.sh
107                         sh llrmount.sh
108                 elif [ $IOZVER -lt 3145 ]; then
109                         VER=`iozone -v | awk '/Revision:/ { print $3 }'`
110                         echo "iozone $VER too old for multi-thread test"
111                 fi
112         fi
113         if [ "$FSX" != "no" ]; then
114                 mount | grep $MOUNT || sh llmount.sh
115                 $DEBUG_OFF
116                 ./fsx -c 50 -p 1000 -P $TMP -l $SIZE \
117                         -N $(($COUNT * 100)) $MOUNT/fsxfile
118                 $DEBUG_ON
119                 sh llmountcleanup.sh
120                 sh llrmount.sh
121         fi      
122
123         mkdir -p $MOUNT2
124         case $NAME in
125         local|lov)
126                 MDSNODE=`hostname`
127                 MDSNAME=mds1
128                 CLIENT=client
129                 ;;
130         *)      # we could extract this from $NAME.xml somehow
131                 ;;
132         esac
133
134         if [ "$SANITYN" != "no" ]; then
135                 mount | grep $MOUNT || sh llmount.sh
136                 $DEBUG_OFF
137
138                 if [ "$MDSNODE" -a "$MDSNAME" -a "$CLIENT" ]; then
139                         llmount $MDSNODE:/$MDSNAME/$CLIENT $MOUNT2
140                         SANITYLOG=$TMP/sanity.log START=: CLEAN=: sh sanityN.sh
141                         umount $MOUNT2
142                 else
143                         echo "don't know \$MDSNODE, \$MDSNAME, \$CLIENT"
144                         echo "can't mount2 for '$NAME', skipping sanityN.sh"
145                 fi
146
147                 $DEBUG_ON
148                 sh llmountcleanup.sh
149                 sh llrmount.sh
150         fi
151
152         if [ "$LIBLUSTRE" != "no" ]; then
153                 mount | grep $MOUNT || sh llmount.sh
154                 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
155                 export LIBLUSTRE_MOUNT_TARGET=$MDSNODE:/$MDSNAME/$CLIENT
156                 export LIBLUSTRE_TIMEOUT=`cat /proc/sys/lustre/timeout`
157                 #export LIBLUSTRE_DEBUG_MASK=`cat /proc/sys/lnet/debug`
158                 if [ -x $LIBLUSTRETESTS/sanity ]; then
159                         $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
160                 fi
161                 sh llmountcleanup.sh
162                 #sh llrmount.sh
163         fi
164
165         mount | grep $MOUNT && sh llmountcleanup.sh
166 done
167
168 if [ "$REPLAY_SINGLE" != "no" ]; then
169         sh replay-single.sh
170 fi
171
172 if [ "$CONF_SANITY" != "no" ]; then
173         sh conf-sanity.sh
174 fi
175
176 if [ "$RECOVERY_SMALL" != "no" ]; then
177         sh recovery-small.sh
178 fi
179
180 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
181         sh replay-ost-single.sh
182 fi
183
184 if [ "$REPLAY_DUAL" != "no" ]; then
185         sh replay-dual.sh
186 fi
187
188 if [ "$INSANITY" != "no" ]; then
189         sh insanity.sh -r
190 fi
191
192 RC=$?
193 echo "completed with rc $RC" && exit $RC