2 # script which _must_ complete successfully (at minimum) before checkins to
3 # the CVS HEAD are allowed.
7 PATH=`dirname $0`/../utils:$PATH
9 [ -z "$CONFIG" -a "$NAME" ] && CONFIGS=$NAME
10 [ "$CONFIGS" ] || CONFIGS="local" #"local lov"
11 [ "$MAX_THREADS" ] || MAX_THREADS=20
12 RAMKB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
13 if [ -z "$THREADS" ]; then
14 THREADS=$((RAMKB / 16384))
15 [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
17 [ "$SIZE" ] || SIZE=$((RAMKB * 2))
18 [ "$RSIZE" ] || RSIZE=512
19 [ "$UID" ] || UID=1000
20 [ "$MOUNT" ] || MOUNT=/mnt/lustre
21 [ "$MOUNT2" ] || MOUNT2=${MOUNT}2
22 [ "$TMP" ] || TMP=/tmp
23 [ "$COUNT" ] || COUNT=1000
24 [ "$DEBUG_LVL" ] || DEBUG_LVL=0
25 [ "$DEBUG_OFF" ] || DEBUG_OFF="eval sysctl -w lnet.debug=\"$DEBUG_LVL\""
26 [ "$DEBUG_ON" ] || DEBUG_ON="eval sysctl -w lnet.debug=0x33f0484"
28 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"
30 if [ "$SLOW" = "no" ]; then
35 if [ "$ACC_SM_ONLY" ]; then
36 for O in $TESTSUITE_LIST; do
39 for O in $ACC_SM_ONLY; do
40 O=`echo $O | tr "[:lower:]" "[:upper:]"`
45 LIBLUSTRETESTS=${LIBLUSTRETESTS:-../liblustre/tests}
50 LUSTRE=${LUSTRE:-`dirname $0`/..}
51 . $LUSTRE/tests/test-framework.sh
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 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
103 DB_THREADS=$((SPACE / 50000))
104 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
108 [ "$SLOW" = "no" ] && duration=" -t 120"
109 if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then
110 bash rundbench 1 $duration
115 if [ $DB_THREADS -gt 1 ]; then
117 bash rundbench $DB_THREADS $duration
122 rm -f /mnt/lustre/`hostname`/client.txt
126 which bonnie++ > /dev/null 2>&1 || BONNIE=no
127 if [ "$BONNIE" != "no" ]; then
129 BONDIR=$MOUNT/d0.bonnie
131 $LFS setstripe -c -1 $BONDIR
133 MIN=`cat /proc/fs/lustre/osc/*/kbytesavail | sort -n | head -n1`
134 SPACE=$(( OSTCOUNT * MIN ))
135 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
136 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
140 FAIL_ON_ERROR=false check_runas_id $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
141 chown $myUID:$myUID $BONDIR
142 $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR
150 which iozone > /dev/null 2>&1 || IOZONE=no
151 if [ "$IOZONE" != "no" ]; then
153 mkdir -p $MOUNT/d0.iozone
154 $LFS setstripe -c -1 $MOUNT/d0.iozone
156 MIN=`cat /proc/fs/lustre/osc/*/kbytesavail | sort -n | head -n1`
157 SPACE=$(( OSTCOUNT * MIN ))
158 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
159 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
160 IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE"
161 IOZFILE="$MOUNT/d0.iozone/iozone"
162 # $SPACE was calculated with all OSTs
164 iozone $IOZONE_OPTS -f $IOZFILE
169 # check if O_DIRECT support is implemented in kernel
170 if [ -z "$O_DIRECT" ]; then
171 touch $MOUNT/f.iozone
172 if ! ./directio write $MOUNT/f.iozone 0 1; then
175 rm -f $MOUNT/f.iozone
177 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
179 iozone -I $IOZONE_OPTS $IOZFILE.odir
185 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
186 IOZ_THREADS=$((SPACE / SIZE * 2 / 3 ))
187 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
188 IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
189 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
190 $LFS setstripe -c 1 $MOUNT/d0.iozone
194 while [ $THREAD -le $IOZ_THREADS ]; do
195 IOZFILE="$IOZFILE $MOUNT/iozone.$THREAD"
196 THREAD=$((THREAD + 1))
198 iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE
202 elif [ $IOZVER -lt 3145 ]; then
203 VER=`iozone -v | awk '/Revision:/ { print $3 }'`
204 echo "iozone $VER too old for multi-thread test"
209 if [ "$FSX" != "no" ]; then
211 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
212 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
214 ./fsx -c 50 -p 1000 -P $TMP -l $SIZE \
215 -N $(($COUNT * 100)) $MOUNT/fsxfile
222 if [ "$SANITYN" != "no" ]; then
228 #echo "can't mount2 for '$NAME', skipping sanityN.sh"
229 START=: CLEAN=: bash sanityN.sh
238 if [ "$LFSCK" != "no" -a -x /usr/sbin/lfsck ]; then
240 E2VER=`e2fsck -V 2>&1 | head -n 1 | cut -d' ' -f 2`
241 if grep -q obdfilter /proc/fs/lustre/devices; then
242 if [ `echo $E2VER | cut -d. -f2` -ge 39 ] && \
243 [ "`echo $E2VER | grep cfs`" ]; then
247 echo "e2fsck does not support lfsck, skipping"
250 echo "remote OST, skipping test"
255 if [ "$LIBLUSTRE" != "no" ]; then
257 assert_env MGSNID MOUNT2
260 # Liblustre needs accept=all, noacl
261 [ -f /etc/modprobe.conf ] && MODPROBECONF=/etc/modprobe.conf
262 [ -f /etc/modprobe.d/Lustre ] && MODPROBECONF=/etc/modprobe.d/Lustre
264 LNETOPTS="$(awk '/^options lnet/ { print $0}' $MODPROBECONF | \
265 sed 's/^options lnet //g') accept=all" \
266 MDS_MOUNT_OPTS=$(echo $MDS_MOUNT_OPTS | sed 's/^[ \t]*//;s/[ \t]*$//') \
267 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl" \
268 MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS/#,/-o } \
270 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
271 export LIBLUSTRE_MOUNT_TARGET=$MGSNID:/$FSNAME
272 export LIBLUSTRE_TIMEOUT=`cat /proc/sys/lustre/timeout`
273 #export LIBLUSTRE_DEBUG_MASK=`cat /proc/sys/lnet/debug`
274 if [ -x $LIBLUSTRETESTS/sanity ]; then
276 echo $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
277 $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
287 if [ "$REPLAY_SINGLE" != "no" ]; then
289 bash replay-single.sh
293 if [ "$CONF_SANITY" != "no" ]; then
299 if [ "$RECOVERY_SMALL" != "no" ]; then
301 bash recovery-small.sh
302 RECOVERY_SMALL="done"
305 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
306 title replay-ost-single
307 bash replay-ost-single.sh
308 REPLAY_OST_SINGLE="done"
311 if [ "$REPLAY_DUAL" != "no" ]; then
317 if [ "$INSANITY" != "no" ]; then
323 if [ "$SANITY_QUOTA" != "no" ]; then
332 echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
333 echo "Tests ran: $RANTEST"
335 echo "$0: completed with rc $RC" && exit $RC