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 SANITY_GSS PERFORMANCE_SANITY"
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%.sh} | tr "-" "_"`
34 O=`echo $O | tr "[:lower:]" "[:upper:]"`
38 LFSCK="no" # bug 13698
39 SANITY_QUOTA="no" # bug 13058
41 LIBLUSTRETESTS=${LIBLUSTRETESTS:-../liblustre/tests}
46 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
47 . $LUSTRE/tests/test-framework.sh
51 # liblustre doesn't support GSS
54 export SANITY_GSS="no"
57 SETUP=${SETUP:-setupall}
58 FORMAT=${FORMAT:-formatall}
59 CLEANUP=${CLEANUP:-stopall}
62 mount | grep $MOUNT && return
67 # update titlebar if stdin is attaached to an xterm
68 if ${UPDATE_TITLEBAR:-false}; then
72 echo -ne "\033]2; acceptance-small: $* \007" >&0
77 log "-----============= acceptance-small: "$*" ============----- `date`"
78 RANTEST=${RANTEST}$*", "
83 remote_ost_nodsh && log "SKIP: $1: remote OST with nodsh" && return 0
89 remote_mds_nodsh && log "SKIP: $1: remote MDS with nodsh" && return 0
93 for NAME in $CONFIGS; do
94 export NAME MOUNT START CLEAN
95 . $LUSTRE/tests/cfg/$NAME.sh
97 if [ ! -f /lib/modules/$(uname -r)/kernel/fs/lustre/mds.ko -a \
98 ! -f `dirname $0`/../mds/mds.ko ]; then
99 export CLIENTMODSONLY=true
102 assert_env mds_HOST MDS_MKFS_OPTS
103 assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT
104 assert_env FSNAME MOUNT MOUNT2
110 if [ "$RUNTESTS" != "no" ]; then
118 if [ "$SANITY" != "no" ]; then
120 MOUNT2="" bash sanity.sh
126 which dbench > /dev/null 2>&1 || DBENCH=no
127 if [ "$DBENCH" != "no" ]; then
129 DBENCHDIR=$MOUNT/$HOSTNAME
131 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
132 DB_THREADS=$((SPACE / 50000))
133 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
138 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
139 chown $myUID:$myUID $DBENCHDIR
141 [ "$SLOW" = "no" ] && duration=" -t 120"
142 if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then
143 $myRUNAS bash rundbench -D $DBENCHDIR 1 $duration || error "dbench failed!"
148 if [ $DB_THREADS -gt 1 ]; then
150 $myRUNAS bash rundbench -D $DBENCHDIR $DB_THREADS $duration
159 which bonnie++ > /dev/null 2>&1 || BONNIE=no
160 if [ "$BONNIE" != "no" ]; then
162 BONDIR=$MOUNT/d0.bonnie
164 $LFS setstripe -c -1 $BONDIR
166 MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
167 SPACE=$(( OSTCOUNT * MIN ))
168 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
169 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
173 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
174 chown $myUID:$myUID $BONDIR
175 $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR
183 [ "$SLOW" = "no" ] && export IOZONE=no # 5 minutes
185 which iozone > /dev/null 2>&1 || IOZONE=no
186 if [ "$IOZONE" != "no" ]; then
188 IOZDIR=$MOUNT/d0.iozone
190 $LFS setstripe -c -1 $IOZDIR
192 MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
193 SPACE=$(( OSTCOUNT * MIN ))
194 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
195 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
196 IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE"
197 IOZFILE="$IOZDIR/iozone"
198 IOZLOG=$TMP/iozone.log
199 # $SPACE was calculated with all OSTs
203 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
204 chown $myUID:$myUID $IOZDIR
205 $myRUNAS iozone $IOZONE_OPTS -s $SIZE -f $IOZFILE 2>&1 | tee $IOZLOG
206 tail -1 $IOZLOG | grep -q complete || \
207 { error "iozone (1) failed" && false; }
213 # check if O_DIRECT support is implemented in kernel
214 if [ -z "$O_DIRECT" ]; then
215 touch $MOUNT/f.iozone
216 if ! ./directio write $MOUNT/f.iozone 0 1; then
217 log "SKIP iozone DIRECT IO test"
220 rm -f $MOUNT/f.iozone
222 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
224 $myRUNAS iozone -I $IOZONE_OPTS -s $SIZE -f $IOZFILE.odir 2>&1 | tee $IOZLOG
225 tail -1 $IOZLOG | grep -q complete || \
226 { error "iozone (2) failed" && false; }
233 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
234 IOZ_THREADS=$((SPACE / SIZE * 2 / 3 ))
235 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
236 IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
237 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
238 $LFS setstripe -c -1 $IOZDIR
242 while [ $THREAD -le $IOZ_THREADS ]; do
243 IOZFILE="$IOZFILE $IOZDIR/iozone.$THREAD"
244 THREAD=$((THREAD + 1))
246 $myRUNAS iozone $IOZONE_OPTS -s $((SIZE / IOZ_THREADS)) -t $IOZ_THREADS -F $IOZFILE 2>&1 | tee $IOZLOG
247 tail -1 $IOZLOG | grep -q complete || \
248 { error "iozone (3) failed" && false; }
253 elif [ $IOZVER -lt 3145 ]; then
254 VER=`iozone -v | awk '/Revision:/ { print $3 }'`
255 echo "iozone $VER too old for multi-thread test"
260 if [ "$FSX" != "no" ]; then
262 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
263 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
265 FSX_SEED=${FSX_SEED:-$RANDOM}
267 $LFS setstripe -c -1 $MOUNT/fsxfile
268 ./fsx -c 50 -p 1000 -S $FSX_SEED -P $TMP -l $SIZE \
269 -N $(($COUNT * 100)) $MOUNT/fsxfile
276 if [ "$SANITYN" != "no" ]; then
282 #echo "can't mount2 for '$NAME', skipping sanityN.sh"
283 START=: CLEAN=: bash sanityN.sh
292 [ "$LFSCK" != "no" ] && remote_mds && log "Remote MDS, skipping LFSCK test" && LFSCK=no && MSKIPPED=1
293 [ "$LFSCK" != "no" ] && remote_ost && log "Remote OST, skipping LFSCK test" && LFSCK=no && OSKIPPED=1
294 if [ "$LFSCK" != "no" ]; then
296 if [ -x /usr/sbin/lfsck ]; then
300 log "SKIP: e2fsck does not support lfsck"
305 [ "$NETTYPE" = "tcp" -o "$NETTYPE" = "ptl" ] || LIBLUSTRE=no # bug 15660
306 if [ "$LIBLUSTRE" != "no" ]; then
308 assert_env MGSNID MOUNT2
309 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
310 export LIBLUSTRE_MOUNT_RETRY=5
311 export LIBLUSTRE_MOUNT_TARGET=$MGSNID:/$FSNAME
312 export LIBLUSTRE_TIMEOUT=`lctl get_param -n timeout`
313 #export LIBLUSTRE_DEBUG_MASK=`lctl get_param -n debug`
314 if [ -x $LIBLUSTRETESTS/sanity ]; then
316 echo $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
317 $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
327 [ "$REPLAY_SINGLE" != "no" ] && skip_remmds replay-single && REPLAY_SINGLE=no && MSKIPPED=1
328 if [ "$REPLAY_SINGLE" != "no" ]; then
330 bash replay-single.sh
334 [ "$CONF_SANITY" != "no" ] && skip_remmds conf-sanity && CONF_SANITY=no && MSKIPPED=1
335 [ "$CONF_SANITY" != "no" ] && skip_remost conf-sanity && CONF_SANITY=no && OSKIPPED=1
336 if [ "$CONF_SANITY" != "no" ]; then
342 [ "$RECOVERY_SMALL" != "no" ] && skip_remmds recover-small && RECOVERY_SMALL=no && MSKIPPED=1
343 if [ "$RECOVERY_SMALL" != "no" ]; then
345 bash recovery-small.sh
346 RECOVERY_SMALL="done"
349 [ "$REPLAY_OST_SINGLE" != "no" ] && skip_remost replay-ost-single && REPLAY_OST_SINGLE=no && OSKIPPED=1
350 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
351 title replay-ost-single
352 bash replay-ost-single.sh
353 REPLAY_OST_SINGLE="done"
356 [ "$REPLAY_DUAL" != "no" ] && skip_remost replay-dual && REPLAY_DUAL=no && OSKIPPED=1
357 if [ "$REPLAY_DUAL" != "no" ]; then
363 [ "$INSANITY" != "no" ] && skip_remmds insanity && INSANITY=no && MSKIPPED=1
364 [ "$INSANITY" != "no" ] && skip_remost insanity && INSANITY=no && OSKIPPED=1
365 if [ "$INSANITY" != "no" ]; then
371 [ "$SANITY_QUOTA" != "no" ] && skip_remmds sanity-quota && SANITY_QUOTA=no && MSKIPPED=1
372 [ "$SANITY_QUOTA" != "no" ] && skip_remost sanity-quota && SANITY_QUOTA=no && OSKIPPED=1
373 if [ "$SANITY_QUOTA" != "no" ]; then
379 [ "$SANITY_SEC" != "no" ] && skip_remmds sanity-sec && SANITY_SEC=no && MSKIPPED=1
380 [ "$SANITY_SEC" != "no" ] && skip_remost sanity-sec && SANITY_SEC=no && OSKIPPED=1
381 if [ "$SANITY_SEC" != "no" ]; then
387 [ "$SANITY_GSS" != "no" ] && skip_remmds sanity-gss && SANITY_GSS=no && MSKIPPED=1
388 if [ "$SANITY_GSS" != "no" ]; then
394 [ "$SLOW" = no ] && PERFORMANCE_SANITY="no"
395 [ -x "$MDSRATE" ] || PERFORMANCE_SANITY="no"
396 which mpirun > /dev/null 2>&1 || PERFORMANCE_SANITY="no"
397 if [ "$PERFORMANCE_SANITY" != "no" ]; then
398 title performance-sanity
399 bash performance-sanity.sh
400 PERFORMANCE_SANITY="done"
405 echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
406 echo "Tests ran: $RANTEST"
408 [ "$MSKIPPED" = 1 ] && log "FAIL: remote MDS tests skipped" && RC=1
409 [ "$OSKIPPED" = 1 ] && log "FAIL: remote OST tests skipped" && RC=1
410 echo "$0: completed with rc $RC" && exit $RC