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 llmount.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 llmount.sh
61                 fi
62                 rm -f /mnt/lustre/`hostname`/client.txt
63         fi
64
65         chown $UID $MOUNT && chmod 700 $MOUNT
66         if [ "$BONNIE" != "no" ]; then
67                 mount | grep $MOUNT || sh llmount.sh
68                 $DEBUG_OFF
69                 bonnie++ -f -r 0 -s $(($SIZE / 1024)) -n 10 -u $UID -d $MOUNT
70                 $DEBUG_ON
71                 sh llmountcleanup.sh
72                 sh llmount.sh
73         fi
74
75         IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE"
76         IOZFILE="-f $MOUNT/iozone"
77         if [ "$IOZONE" != "no" ]; then
78                 mount | grep $MOUNT || sh llmount.sh
79                 $DEBUG_OFF
80                 iozone $IOZONE_OPTS $IOZFILE
81                 $DEBUG_ON
82                 sh llmountcleanup.sh
83                 sh llmount.sh
84
85                 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
86                         $DEBUG_OFF
87                         iozone -I $IOZONE_OPTS $IOZFILE.odir
88                         $DEBUG_ON
89                         sh llmountcleanup.sh
90                         sh llmount.sh
91                 fi
92
93                 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
94                 IOZ_THREADS=`expr $SPACE / \( $SIZE + $SIZE / 512 \)`
95                 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
96                 IOZVER=`iozone -v|awk '/Revision:/ {print $3}'|tr -d .`
97                 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
98                         $DEBUG_OFF
99                         THREAD=1
100                         IOZFILE="-F "
101                         while [ $THREAD -le $IOZ_THREADS ]; do
102                                 IOZFILE="$IOZFILE $MOUNT/iozone.$THREAD"
103                                 THREAD=`expr $THREAD + 1`
104                         done
105                         iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE
106                         $DEBUG_ON
107                         sh llmountcleanup.sh
108                         sh llmount.sh
109                 elif [ $IOZVER -lt 3145 ]; then
110                         VER=`iozone -v | awk '/Revision:/ { print $3 }'`
111                         echo "iozone $VER too old for multi-thread test"
112                 fi
113         fi
114
115         if [ "$FSX" != "no" ]; then
116                 mount | grep $MOUNT || sh llmount.sh
117                 $DEBUG_OFF
118                 ./fsx -c 50 -p 1000 -P $TMP -l $SIZE \
119                         -N $(($COUNT * 100)) $MOUNT/fsxfile
120                 $DEBUG_ON
121                 sh llmountcleanup.sh
122                 sh llmount.sh
123         fi      
124
125         mkdir -p $MOUNT2
126         case $NAME in
127         local|lov)
128                 MDSNODE=`hostname`
129                 MDSNAME=mds1
130                 CLIENT=client
131                 ;;
132         *)      # we could extract this from $NAME.xml somehow
133                 ;;
134         esac
135
136         if [ "$SANITYN" != "no" ]; then
137                 mount | grep $MOUNT || sh llmount.sh
138                 $DEBUG_OFF
139
140                 if [ "$MDSNODE" -a "$MDSNAME" -a "$CLIENT" ]; then
141                         llmount $MDSNODE:/$MDSNAME/$CLIENT $MOUNT2
142                         SANITYLOG=$TMP/sanity.log START=: CLEAN=: sh sanityN.sh
143                         umount $MOUNT2
144                 else
145                         echo "don't know \$MDSNODE, \$MDSNAME, \$CLIENT"
146                         echo "can't mount2 for '$NAME', skipping sanityN.sh"
147                 fi
148
149                 $DEBUG_ON
150                 sh llmountcleanup.sh
151                 sh llmount.sh
152         fi
153
154         if [ "$LIBLUSTRE" != "no" ]; then
155                 mount | grep $MOUNT || sh llmount.sh
156                 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
157                 export LIBLUSTRE_MOUNT_TARGET=$MDSNODE:/$MDSNAME/$CLIENT
158                 export LIBLUSTRE_TIMEOUT=`cat /proc/sys/lustre/timeout`
159                 #export LIBLUSTRE_DEBUG_MASK=`cat /proc/sys/lnet/debug`
160                 if [ -x $LIBLUSTRETESTS/sanity ]; then
161                         $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
162                 fi
163                 sh llmountcleanup.sh
164                 #sh llmount.sh
165         fi
166
167         mount | grep $MOUNT && sh llmountcleanup.sh
168 done
169
170 if [ "$REPLAY_SINGLE" != "no" ]; then
171         sh replay-single.sh
172 fi
173
174 if [ "$CONF_SANITY" != "no" ]; then
175         sh conf-sanity.sh
176 fi
177
178 if [ "$RECOVERY_SMALL" != "no" ]; then
179         sh recovery-small.sh
180 fi
181
182 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
183         sh replay-ost-single.sh
184 fi
185
186 if [ "$REPLAY_DUAL" != "no" ]; then
187         sh replay-dual.sh
188 fi
189
190 if [ "$INSANITY" != "no" ]; then
191         sh insanity.sh -r
192 fi
193
194 RC=$?
195 echo "completed with rc $RC" && exit $RC