Whamcloud - gitweb
b=15967
[fs/lustre-release.git] / lustre / tests / acceptance-small.sh
index c5b6b40..4be72e6 100755 (executable)
@@ -4,8 +4,6 @@
 #set -vx
 set -e
 
-PATH=`dirname $0`/../utils:$PATH
-
 [ -z "$CONFIG" -a "$NAME" ] && CONFIGS=$NAME
 [ "$CONFIGS" ] || CONFIGS="local"  #"local lov"
 [ "$MAX_THREADS" ] || MAX_THREADS=20
@@ -22,15 +20,10 @@ fi
 [ "$TMP" ] || TMP=/tmp
 [ "$COUNT" ] || COUNT=1000
 [ "$DEBUG_LVL" ] || DEBUG_LVL=0
-[ "$DEBUG_OFF" ] || DEBUG_OFF="eval sysctl -w lnet.debug=\"$DEBUG_LVL\""
-[ "$DEBUG_ON" ] || DEBUG_ON="eval sysctl -w lnet.debug=0x33f0484"
-
-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"
+[ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\""
+[ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484"
 
-if [ "$SLOW" = "no" ]; then
-#          5 min  
-    export IOZONE="no"
-fi
+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"
 
 if [ "$ACC_SM_ONLY" ]; then
     for O in $TESTSUITE_LIST; do
@@ -42,16 +35,22 @@ if [ "$ACC_SM_ONLY" ]; then
     done
 fi
 LFSCK="no" # bug 13698
+SANITY_QUOTA="no" # bug 13058
 
 LIBLUSTRETESTS=${LIBLUSTRETESTS:-../liblustre/tests}
 
 STARTTIME=`date +%s`
 RANTEST=""
 
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 
+if $GSS; then
+    # liblustre doesn't support GSS
+    export LIBLUSTRE=no
+fi
+
 SETUP=${SETUP:-setupall}
 FORMAT=${FORMAT:-formatall}
 CLEANUP=${CLEANUP:-stopall}
@@ -69,6 +68,11 @@ title() {
 for NAME in $CONFIGS; do
        export NAME MOUNT START CLEAN
        . $LUSTRE/tests/cfg/$NAME.sh
+
+       if [ ! -f /lib/modules/$(uname -r)/kernel/fs/lustre/mds.ko -a \
+           ! -f `dirname $0`/../mds/mds.ko ]; then
+           export CLIENTMODSONLY=true
+       fi
        
        assert_env mds_HOST MDS_MKFS_OPTS MDSDEV
        assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT
@@ -86,7 +90,7 @@ for NAME in $CONFIGS; do
 
        if [ "$SANITY" != "no" ]; then
                title sanity
-               bash sanity.sh
+               MOUNT2="" bash sanity.sh
                $CLEANUP
                $SETUP
                SANITY="done"
@@ -95,40 +99,53 @@ for NAME in $CONFIGS; do
        which dbench > /dev/null 2>&1 || DBENCH=no
        if [ "$DBENCH" != "no" ]; then
                title dbench
+               DBENCHDIR=$MOUNT/$HOSTNAME
+               mkdir -p $DBENCHDIR
                SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
                DB_THREADS=$((SPACE / 50000))
                [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
 
                $DEBUG_OFF
+               myUID=$RUNAS_ID
+               myRUNAS=$RUNAS
+               FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
+               chown $myUID:$myUID $DBENCHDIR
                duration=""
                [ "$SLOW" = "no" ] && duration=" -t 120"
                if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then
-                       bash rundbench 1 $duration
+                       DIR=$DBENCHDIR $myRUNAS bash rundbench 1 $duration
                        $DEBUG_ON
                        $CLEANUP
                        $SETUP
                fi
                if [ $DB_THREADS -gt 1 ]; then
                        $DEBUG_OFF
-                       bash rundbench $DB_THREADS $duration
+                       DIR=$DBENCHDIR $myRUNAS bash rundbench $DB_THREADS $duration
                        $DEBUG_ON
                        $CLEANUP
                        $SETUP
                fi
-               rm -f /mnt/lustre/`hostname`/client.txt
+               rm -rf $DBENCHDIR
                DBENCH="done"
        fi
 
-       chown $UID $MOUNT
        which bonnie++ > /dev/null 2>&1 || BONNIE=no
        if [ "$BONNIE" != "no" ]; then
                title bonnie
-               $LFS setstripe $MOUNT 0 -1 -1
-               MIN=`cat /proc/fs/lustre/osc/*-osc-*/kbytesfree | sort -n | head -n1`
+               BONDIR=$MOUNT/d0.bonnie
+               mkdir -p $BONDIR
+               $LFS setstripe -c -1 $BONDIR
+               sync
+               MIN=`cat /proc/fs/lustre/osc/*/kbytesavail | sort -n | head -n1`
                SPACE=$(( OSTCOUNT * MIN ))
                [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
+               log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
                $DEBUG_OFF
-               bonnie++ -f -r 0 -s $((SIZE / 1024)) -n 10 -u $UID -d $MOUNT
+               myUID=$RUNAS_ID
+               myRUNAS=$RUNAS
+               FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
+               chown $myUID:$myUID $BONDIR             
+               $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR
                $DEBUG_ON
                $CLEANUP
                $SETUP
@@ -136,18 +153,28 @@ for NAME in $CONFIGS; do
        fi
 
        export O_DIRECT
+       [ "$SLOW" = "no" ] && export IOZONE=no # 5 minutes
+
        which iozone > /dev/null 2>&1 || IOZONE=no
        if [ "$IOZONE" != "no" ]; then
                title iozone
-               MIN=`cat /proc/fs/lustre/osc/*-osc-*/kbytesfree | sort -n | head -n1`
+               IOZDIR=$MOUNT/d0.iozone
+               mkdir -p $IOZDIR
+               $LFS setstripe -c -1 $IOZDIR
+               sync
+               MIN=`cat /proc/fs/lustre/osc/*/kbytesavail | sort -n | head -n1`
                SPACE=$(( OSTCOUNT * MIN ))
                [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
+               log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
                IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE"
-               IOZFILE="$MOUNT/iozone"
+               IOZFILE="$IOZDIR/iozone"
                # $SPACE was calculated with all OSTs
-               $LFS setstripe $IOZFILE 0 -1 -1
                $DEBUG_OFF
-               iozone $IOZONE_OPTS -f $IOZFILE
+               myUID=$RUNAS_ID
+               myRUNAS=$RUNAS
+               FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
+               chown $myUID:$myUID $IOZDIR
+               $myRUNAS iozone $IOZONE_OPTS -f $IOZFILE
                $DEBUG_ON
                $CLEANUP
                $SETUP
@@ -162,7 +189,8 @@ for NAME in $CONFIGS; do
                fi
                if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
                        $DEBUG_OFF
-                       iozone -I $IOZONE_OPTS $IOZFILE.odir
+                       # cd TMP to have write permission for tmp file iozone writes
+                       ( cd $TMP && $myRUNAS iozone -I $IOZONE_OPTS $IOZFILE.odir )
                        $DEBUG_ON
                        $CLEANUP
                        $SETUP
@@ -173,14 +201,15 @@ for NAME in $CONFIGS; do
                [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
                IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
                if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
+                       $LFS setstripe -c 1 $IOZDIR
                        $DEBUG_OFF
                        THREAD=1
                        IOZFILE="-F "
                        while [ $THREAD -le $IOZ_THREADS ]; do
-                               IOZFILE="$IOZFILE $MOUNT/iozone.$THREAD"
+                               IOZFILE="$IOZFILE $IOZDIR/iozone.$THREAD"
                                THREAD=$((THREAD + 1))
                        done
-                       iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE
+                       $myRUNAS iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZFILE
                        $DEBUG_ON
                        $CLEANUP
                        $SETUP
@@ -220,23 +249,24 @@ for NAME in $CONFIGS; do
                SANITYN="done"
        fi
 
+       remote_mds && log "Remote MDS, skipping LFSCK test" && LFSCK=no
+       remote_ost && log "Remote OST, skipping LFSCK test" && LFSCK=no
+
        if [ "$LFSCK" != "no" -a -x /usr/sbin/lfsck ]; then
                title lfsck
                E2VER=`e2fsck -V 2>&1 | head -n 1 | cut -d' ' -f 2`
-               if grep -q obdfilter /proc/fs/lustre/devices; then
-                       if [ `echo $E2VER | cut -d. -f2` -ge 39 ] && \
-                          [ "`echo $E2VER | grep cfs`" ]; then
-                               bash lfscktest.sh
-                       else
-                               e2fsck -V
-                               echo "e2fsck does not support lfsck, skipping"
-                       fi
+               if [ `echo $E2VER | cut -d. -f2` -ge 39 ] && \
+                  [ "`echo $E2VER | grep cfs`" -o \
+                       "`echo $E2VER | grep sun`" ]; then
+                               bash lfscktest.sh
                else
-                       echo "remote OST, skipping test"
+                       e2fsck -V
+                       echo "e2fsck does not support lfsck, skipping"
                fi
                LFSCK="done"
        fi
 
+       [ "$NETTYPE" = "tcp" -o "$NETTYPE" = "ptl" ] || LIBLUSTRE=no # bug 15660
        if [ "$LIBLUSTRE" != "no" ]; then
                title liblustre
                assert_env MGSNID MOUNT2
@@ -247,7 +277,7 @@ for NAME in $CONFIGS; do
                [ -f /etc/modprobe.d/Lustre ] && MODPROBECONF=/etc/modprobe.d/Lustre
 
                LNETOPTS="$(awk '/^options lnet/ { print $0}' $MODPROBECONF | \
-                       sed 's/^options lnet //g') accept=all" \
+                       sed 's/^options lnet //g; s/"//g') accept=all" \
                        MDS_MOUNT_OPTS=$(echo $MDS_MOUNT_OPTS | sed 's/^[ \t]*//;s/[ \t]*$//') \
                        MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl" \
                        MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS/#,/-o } \
@@ -311,6 +341,11 @@ if [ "$SANITY_QUOTA" != "no" ]; then
         SANITY_QUOTA="done"
 fi
 
+if [ "$SANITY_SEC" != "no" ]; then
+        title sanity-sec
+        bash sanity-sec.sh
+        SANITY_SEC="done"
+fi
 
 RC=$?
 title FINISHED