2 # script which _must_ complete successfully (at minimum) before checkins to
3 # the CVS HEAD are allowed.
6 PATH=`dirname $0`/../utils:$PATH
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="sysctl -w lnet.debug=$DEBUG_LVL"
24 [ "$DEBUG_ON" ] || DEBUG_ON="sysctl -w lnet.debug=0x33f0484"
26 LIBLUSTRE=${LIBLUSTRE:-../liblustre}
27 LIBLUSTRETESTS=${LIBLUSTRETESTS:-$LIBLUSTRE/tests}
29 LUSTRE=${LUSTRE:-`dirname $0`/..}
30 . $LUSTRE/tests/test-framework.sh
33 SETUP=${SETUP:-setupall}
34 FORMAT=${FORMAT:-formatall}
35 CLEANUP=${CLEANUP:-stopall}
38 mount | grep $MOUNT || $FORMAT && $SETUP
41 for NAME in $CONFIGS; do
42 export NAME MOUNT START CLEAN
43 . $LUSTRE/tests/cfg/$NAME.sh
45 assert_env mds_HOST MDS_MKFS_OPTS MDSDEV
46 assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT
49 if [ "$RUNTESTS" != "no" ]; then
53 if [ "$SANITY" != "no" ]; then
54 SANITYLOG=/tmp/sanity.log sh sanity.sh
57 if [ "$DBENCH" != "no" ]; then
59 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
60 DB_THREADS=$((SPACE / 50000))
61 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
68 if [ $DB_THREADS -gt 1 ]; then
70 sh rundbench $DB_THREADS
75 rm -f /mnt/lustre/`hostname`/client.txt
78 chown $UID $MOUNT && chmod 700 $MOUNT
79 if [ "$BONNIE" != "no" ]; then
81 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
82 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
84 bonnie++ -f -r 0 -s $((SIZE / 1024)) -n 10 -u $UID -d $MOUNT
91 if [ "$IOZONE" != "no" ]; then
93 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
94 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
95 IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE"
96 IOZFILE="-f $MOUNT/iozone"
98 iozone $IOZONE_OPTS $IOZFILE
103 # check if O_DIRECT support is implemented in kernel
104 if [ -z "$O_DIRECT" ]; then
105 touch $MOUNT/f.iozone
106 if ! ./directio write $MOUNT/f.iozone 0 1; then
109 rm -f $MOUNT/f.iozone
111 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
113 iozone -I $IOZONE_OPTS $IOZFILE.odir
119 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
120 IOZ_THREADS=$((SPACE / SIZE * 2 / 3 ))
121 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
122 IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
123 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
127 while [ $THREAD -le $IOZ_THREADS ]; do
128 IOZFILE="$IOZFILE $MOUNT/iozone.$THREAD"
129 THREAD=$((THREAD + 1))
131 iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE
135 elif [ $IOZVER -lt 3145 ]; then
136 VER=`iozone -v | awk '/Revision:/ { print $3 }'`
137 echo "iozone $VER too old for multi-thread test"
141 if [ "$FSX" != "no" ]; then
143 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
144 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
146 ./fsx -c 50 -p 1000 -P $TMP -l $SIZE \
147 -N $(($COUNT * 100)) $MOUNT/fsxfile
160 *) # we could extract this from $NAME.xml somehow
164 if [ "$SANITYN" != "no" ]; then
168 if [ "$MDSNODE" -a "$MDSNAME" -a "$CLIENT" ]; then
170 SANITYLOG=$TMP/sanity.log START=: CLEAN=: sh sanityN.sh
173 echo "don't know \$MDSNODE, \$MDSNAME, \$CLIENT"
174 echo "can't mount2 for '$NAME', skipping sanityN.sh"
182 if [ "$LIBLUSTRE" != "no" ]; then
184 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
185 export LIBLUSTRE_MOUNT_TARGET=$MDSNODE:/$MDSNAME/$CLIENT
186 export LIBLUSTRE_TIMEOUT=`cat /proc/sys/lustre/timeout`
187 #export LIBLUSTRE_DEBUG_MASK=`cat /proc/sys/lnet/debug`
188 if [ -x $LIBLUSTRETESTS/sanity ]; then
189 $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
198 if [ "$REPLAY_SINGLE" != "no" ]; then
202 if [ "$CONF_SANITY" != "no" ]; then
206 if [ "$RECOVERY_SMALL" != "no" ]; then
210 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
211 sh replay-ost-single.sh
214 if [ "$REPLAY_DUAL" != "no" ]; then
218 if [ "$INSANITY" != "no" ]; then
223 echo "completed with rc $RC" && exit $RC