2 # script which _must_ complete successfully (at minimum) before checkins to
3 # the CVS HEAD are allowed.
7 [ -z "$CONFIG" -a "$NAME" ] && CONFIGS=$NAME
8 [ "$CONFIGS" ] || CONFIGS="local" #"local lov"
9 [ "$MAX_THREADS" ] || MAX_THREADS=20
10 RAMKB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
11 if [ -z "$THREADS" ]; then
12 THREADS=$((RAMKB / 16384))
13 [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
15 [ "$SIZE" ] || SIZE=$((RAMKB * 2))
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=0
23 [ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\""
24 [ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484"
26 export TESTSUITE_LIST="RUNTESTS SANITY DBENCH BONNIE IOZONE FSX SANITYN LFSCK LIBLUSTRE REPLAY_SINGLE CONF_SANITY RECOVERY_SMALL REPLAY_OST_SINGLE REPLAY_DUAL INSANITY SANITY_QUOTA SANITY_SEC"
28 if [ "$ACC_SM_ONLY" ]; then
29 for O in $TESTSUITE_LIST; do
32 for O in $ACC_SM_ONLY; do
33 O=`echo $O | tr "[:lower:]" "[:upper:]"`
37 LFSCK="no" # bug 13698
38 SANITY_QUOTA="no" # bug 13058
40 LIBLUSTRETESTS=${LIBLUSTRETESTS:-../liblustre/tests}
45 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
46 . $LUSTRE/tests/test-framework.sh
50 # liblustre doesn't support GSS
54 SETUP=${SETUP:-setupall}
55 FORMAT=${FORMAT:-formatall}
56 CLEANUP=${CLEANUP:-stopall}
59 mount | grep $MOUNT && return
64 log "-----============= acceptance-small: "$*" ============----- `date`"
65 RANTEST=${RANTEST}$*", "
68 for NAME in $CONFIGS; do
69 export NAME MOUNT START CLEAN
70 . $LUSTRE/tests/cfg/$NAME.sh
72 if [ ! -f /lib/modules/$(uname -r)/kernel/fs/lustre/mds.ko -a \
73 ! -f `dirname $0`/../mds/mds.ko ]; then
74 export CLIENTMODSONLY=true
77 assert_env mds_HOST MDS_MKFS_OPTS MDSDEV
78 assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT
79 assert_env FSNAME MOUNT MOUNT2
83 if [ "$RUNTESTS" != "no" ]; then
91 if [ "$SANITY" != "no" ]; then
93 MOUNT2="" bash sanity.sh
99 which dbench > /dev/null 2>&1 || DBENCH=no
100 if [ "$DBENCH" != "no" ]; then
102 DBENCHDIR=$MOUNT/$HOSTNAME
104 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
105 DB_THREADS=$((SPACE / 50000))
106 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
111 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
112 chown $myUID:$myUID $DBENCHDIR
114 [ "$SLOW" = "no" ] && duration=" -t 120"
115 if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then
116 DIR=$DBENCHDIR $myRUNAS bash rundbench 1 $duration
121 if [ $DB_THREADS -gt 1 ]; then
123 DIR=$DBENCHDIR $myRUNAS bash rundbench $DB_THREADS $duration
132 which bonnie++ > /dev/null 2>&1 || BONNIE=no
133 if [ "$BONNIE" != "no" ]; then
135 BONDIR=$MOUNT/d0.bonnie
137 $LFS setstripe -c -1 $BONDIR
139 MIN=`cat /proc/fs/lustre/osc/*/kbytesavail | sort -n | head -n1`
140 SPACE=$(( OSTCOUNT * MIN ))
141 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
142 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
146 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
147 chown $myUID:$myUID $BONDIR
148 $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR
156 [ "$SLOW" = "no" ] && export IOZONE=no # 5 minutes
158 which iozone > /dev/null 2>&1 || IOZONE=no
159 if [ "$IOZONE" != "no" ]; then
161 IOZDIR=$MOUNT/d0.iozone
163 $LFS setstripe -c -1 $IOZDIR
165 MIN=`cat /proc/fs/lustre/osc/*/kbytesavail | sort -n | head -n1`
166 SPACE=$(( OSTCOUNT * MIN ))
167 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
168 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
169 IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE"
170 IOZFILE="$IOZDIR/iozone"
171 IOZLOG=$TMP/iozone.log
172 # $SPACE was calculated with all OSTs
176 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
177 chown $myUID:$myUID $IOZDIR
178 $myRUNAS iozone $IOZONE_OPTS -f $IOZFILE 2>&1 | tee $IOZLOG
179 tail -1 $IOZLOG | grep -q complete || \
180 { error "iozone (1) failed" && false; }
186 # check if O_DIRECT support is implemented in kernel
187 if [ -z "$O_DIRECT" ]; then
188 touch $MOUNT/f.iozone
189 if ! ./directio write $MOUNT/f.iozone 0 1; then
192 rm -f $MOUNT/f.iozone
194 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
196 # cd TMP to have write permission for tmp file iozone writes
197 ( cd $TMP && $myRUNAS iozone -I $IOZONE_OPTS $IOZFILE.odir 2>&1 | tee $IOZLOG)
198 tail -1 $IOZLOG | grep -q complete || \
199 { error "iozone (2) failed" && false; }
206 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
207 IOZ_THREADS=$((SPACE / SIZE * 2 / 3 ))
208 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
209 IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
210 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
211 $LFS setstripe -c -1 $IOZDIR
215 while [ $THREAD -le $IOZ_THREADS ]; do
216 IOZFILE="$IOZFILE $IOZDIR/iozone.$THREAD"
217 THREAD=$((THREAD + 1))
219 $myRUNAS iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE 2>&1 | tee $IOZLOG
220 tail -1 $IOZLOG | grep -q complete || \
221 { error "iozone (3) failed" && false; }
226 elif [ $IOZVER -lt 3145 ]; then
227 VER=`iozone -v | awk '/Revision:/ { print $3 }'`
228 echo "iozone $VER too old for multi-thread test"
233 if [ "$FSX" != "no" ]; then
235 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
236 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
238 ./fsx -c 50 -p 1000 -P $TMP -l $SIZE \
239 -N $(($COUNT * 100)) $MOUNT/fsxfile
246 if [ "$SANITYN" != "no" ]; then
252 #echo "can't mount2 for '$NAME', skipping sanityN.sh"
253 START=: CLEAN=: bash sanityN.sh
262 remote_mds && log "Remote MDS, skipping LFSCK test" && LFSCK=no
263 remote_ost && log "Remote OST, skipping LFSCK test" && LFSCK=no
265 if [ "$LFSCK" != "no" -a -x /usr/sbin/lfsck ]; then
267 E2VER=`e2fsck -V 2>&1 | head -n 1 | cut -d' ' -f 2`
268 if [ `echo $E2VER | cut -d. -f2` -ge 39 ] && \
269 [ "`echo $E2VER | grep cfs`" -o \
270 "`echo $E2VER | grep sun`" ]; then
274 echo "e2fsck does not support lfsck, skipping"
279 [ "$NETTYPE" = "tcp" -o "$NETTYPE" = "ptl" ] || LIBLUSTRE=no # bug 15660
280 if [ "$LIBLUSTRE" != "no" ]; then
282 assert_env MGSNID MOUNT2
285 # Liblustre needs accept=all, noacl
286 [ -f /etc/modprobe.conf ] && MODPROBECONF=/etc/modprobe.conf
287 [ -f /etc/modprobe.d/Lustre ] && MODPROBECONF=/etc/modprobe.d/Lustre
289 LNETOPTS="$(awk '/^options lnet/ { print $0}' $MODPROBECONF | \
290 sed 's/^options lnet //g; s/"//g') accept=all" \
291 MDS_MOUNT_OPTS=$(echo $MDS_MOUNT_OPTS | sed 's/^[ \t]*//;s/[ \t]*$//') \
292 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl" \
293 MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS/#,/-o } \
295 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
296 export LIBLUSTRE_MOUNT_TARGET=$MGSNID:/$FSNAME
297 export LIBLUSTRE_TIMEOUT=`cat /proc/sys/lustre/timeout`
298 #export LIBLUSTRE_DEBUG_MASK=`cat /proc/sys/lnet/debug`
299 if [ -x $LIBLUSTRETESTS/sanity ]; then
301 echo $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
302 $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
312 if [ "$REPLAY_SINGLE" != "no" ]; then
314 bash replay-single.sh
318 if [ "$CONF_SANITY" != "no" ]; then
324 if [ "$RECOVERY_SMALL" != "no" ]; then
326 bash recovery-small.sh
327 RECOVERY_SMALL="done"
330 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
331 title replay-ost-single
332 bash replay-ost-single.sh
333 REPLAY_OST_SINGLE="done"
336 if [ "$REPLAY_DUAL" != "no" ]; then
342 if [ "$INSANITY" != "no" ]; then
348 if [ "$SANITY_QUOTA" != "no" ]; then
354 if [ "$SANITY_SEC" != "no" ]; then
362 echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
363 echo "Tests ran: $RANTEST"
365 echo "$0: completed with rc $RC" && exit $RC