Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Sun, 3 Jul 2005 09:08:18 +0000 (09:08 +0000)
committeradilger <adilger>
Sun, 3 Jul 2005 09:08:18 +0000 (09:08 +0000)
Don't run test 27[o-q] on non-local mounts.

lustre/tests/sanity.sh

index 11874aa..77b4e45 100644 (file)
@@ -79,8 +79,9 @@ trace() {
 }
 TRACE=${TRACE:-""}
 
+LPROC=/proc/fs/lustre
 check_kernel_version() {
-       VERSION_FILE=/proc/fs/lustre/kernel_version
+       VERSION_FILE=$LPROC/kernel_version
        WANT_VER=$1
        [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
        GOT_VER=`cat $VERSION_FILE`
@@ -181,11 +182,11 @@ fi
 DIR=${DIR:-$MOUNT}
 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
 
-LOVNAME=`cat /proc/fs/lustre/llite/*/lov/common_name | tail -n 1`
-OSTCOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
-STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/stripecount`
-STRIPESIZE=`cat /proc/fs/lustre/lov/$LOVNAME/stripesize`
-ORIGFREE=`cat /proc/fs/lustre/lov/$LOVNAME/kbytesavail`
+LOVNAME=`cat $LPROC/llite/*/lov/common_name | tail -n 1`
+OSTCOUNT=`cat $LPROC/lov/$LOVNAME/numobd`
+STRIPECOUNT=`cat $LPROC/lov/$LOVNAME/stripecount`
+STRIPESIZE=`cat $LPROC/lov/$LOVNAME/stripesize`
+ORIGFREE=`cat $LPROC/lov/$LOVNAME/kbytesavail`
 MAXFREE=${MAXFREE:-$((200000 * $OSTCOUNT))}
 
 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
@@ -918,95 +919,114 @@ reset_enospc() {
     rmdir $DIR/d27/nospc
 }
 
+MDS=$(find $LPROC/mds/ -maxdepth 1 -type d | tail -n 1)
+MDS=$(basename $MDS)
+
 exhaust_precreations() {
-    local i
-    ostidx=$1
-    ost=$(head -n $(( ostidx + 1 )) /proc/fs/lustre/lov/${LOVNAME}/target_obd | tail -n 1 | awk '{print $2}' | sed -e 's/_UUID$//')
-    mds=$(find /proc/fs/lustre/mds/ -maxdepth 1 -type d | tail -n 1)
-    mds=$(basename $mds)
-
-    last_id=$(tail -n 1 /proc/fs/lustre/osc/OSC_*_${ost}_${mds}/prealloc_last_id)
-    next_id=$(tail -n 1 /proc/fs/lustre/osc/OSC_*_${ost}_${mds}/prealloc_next_id)
-
-    mkdir -p $DIR/d27/${ost}
-    $LSTRIPE $DIR/d27/${ost} 0 $ostidx 1
-    sysctl -w lustre.fail_loc=0x215
-    echo "Creating to objid $last_id on ost $ost..."
-    for (( i = next_id; i <= last_id; i++ )) ; do
-       touch $DIR/d27/${ost}/f$i
-    done
-    reset_enospc
+       local i
+       OSTIDX=$1
+       OST=$(head -n $((OSTIDX + 1)) $LPROC/lov/${LOVNAME}/target_obd |\
+               tail -n 1 | awk '{print $2}' | sed -e 's/_UUID$//')
+
+       last_id=$(tail -n 1 $LPROC/osc/OSC_*_${OST}_${MDS}/prealloc_last_id)
+       next_id=$(tail -n 1 $LPROC/osc/OSC_*_${OST}_${MDS}/prealloc_next_id)
+
+       mkdir -p $DIR/d27/${OST}
+       $LSTRIPE $DIR/d27/${OST} 0 $OSTIDX 1
+       sysctl -w lustre.fail_loc=0x215
+       echo "Creating to objid $last_id on ost $OST..."
+       for (( i = next_id; i <= last_id; i++ )) ; do
+               touch $DIR/d27/${OST}/f$i
+       done
+       reset_enospc
 }
 
 exhaust_all_precreations() {
-    local i
-    for (( i=0; i < OSTCOUNT; i++ )) ; do
-       exhaust_precreations $i
-    done
+       local i
+       for (( i=0; i < OSTCOUNT; i++ )) ; do
+               exhaust_precreations $i
+       done
 }
 
 test_27n() {
-    [ "$OSTCOUNT" -lt "2" ] && echo "" && return
-    reset_enospc
-    rm -f $DIR/d27/f27n
-    exhaust_precreations 0
-    sysctl -w lustre.fail_loc=0x80000215
-    touch $DIR/d27/f27n || error
-    reset_enospc
+       [ "$OSTCOUNT" -lt "2" -o -z "$MDS" ] && echo "skipping test" && return
+
+       reset_enospc
+       rm -f $DIR/d27/f27n
+       exhaust_precreations 0
+
+       sysctl -w lustre.fail_loc=0x80000215
+       touch $DIR/d27/f27n || error
+
+       reset_enospc
 }
-run_test 27n "creating a file while some OSTs are full (should succeed) ==="
+run_test 27n "create file with some full OSTs =================="
 
 test_27o() {
-    [ "$OSTCOUNT" -lt "2" ] && echo "" && return
-    reset_enospc
-    rm -f $DIR/d27/f27o
-    exhaust_all_precreations
-    sysctl -w lustre.fail_loc=0x215
-    touch $DIR/d27/f27o && error
-    reset_enospc
+       [ "$OSTCOUNT" -lt "2" -o -z "$MDS" ] && echo "skipping test" && return
+
+       reset_enospc
+       rm -f $DIR/d27/f27o
+       exhaust_all_precreations
+
+       sysctl -w lustre.fail_loc=0x215
+       touch $DIR/d27/f27o && error
+
+       reset_enospc
 }
-run_test 27o "creating a file while all OSTs are full (should error) ==="
+run_test 27o "create file with all full OSTs (should error) ===="
 
 test_27p() {
-    [ "$OSTCOUNT" -lt "2" ] && echo "" && return
-    reset_enospc
-    rm -f $DIR/d27/f27p
-    exhaust_precreations 0
-    $MCREATE $DIR/d27/f27p || error
-    $TRUNCATE $DIR/d27/f27p 80000000 || error
-    $CHECKSTAT -s 80000000 $DIR/d27/f27p || error
-    sysctl -w lustre.fail_loc=0x80000215
-    echo foo >> $DIR/d27/f27p || error
-    $CHECKSTAT -s 80000004 $DIR/d27/f27p || error
-    reset_enospc
-}
-run_test 27p "appending to a truncated file while some OSTs are full ==="
+       [ "$OSTCOUNT" -lt "2" -o -z "$MDS" ] && echo "skipping test" && return
+
+       reset_enospc
+       rm -f $DIR/d27/f27p
+       exhaust_precreations 0
+
+       $MCREATE $DIR/d27/f27p || error
+       $TRUNCATE $DIR/d27/f27p 80000000 || error
+       $CHECKSTAT -s 80000000 $DIR/d27/f27p || error
+
+       sysctl -w lustre.fail_loc=0x80000215
+       echo foo >> $DIR/d27/f27p || error
+       $CHECKSTAT -s 80000004 $DIR/d27/f27p || error
+
+       reset_enospc
+}
+run_test 27p "append to a truncated file with some full OSTs ==="
 
 test_27q() {
-    [ "$OSTCOUNT" -lt "2" ] && echo "" && return
-    reset_enospc
-    rm -f $DIR/d27/f27q
-    exhaust_precreations 0
-    $MCREATE $DIR/d27/f27q || error
-    $TRUNCATE $DIR/d27/f27q 80000000 || error
-    $CHECKSTAT -s 80000000 $DIR/d27/f27q || error
-    sysctl -w lustre.fail_loc=0x215
-    echo foo >> $DIR/d27/f27q && error
-    $CHECKSTAT -s 80000000 $DIR/d27/f27q || error
-    reset_enospc
-}
-run_test 27q "appending to a truncated file while all OSTs are full (should error) ==="
+       [ "$OSTCOUNT" -lt "2" -o -z "$MDS" ] && echo "skipping test" && return
+
+       reset_enospc
+       rm -f $DIR/d27/f27q
+       exhaust_precreations 0
+
+       $MCREATE $DIR/d27/f27q || error
+       $TRUNCATE $DIR/d27/f27q 80000000 || error
+       $CHECKSTAT -s 80000000 $DIR/d27/f27q || error
+
+       sysctl -w lustre.fail_loc=0x215
+       echo foo >> $DIR/d27/f27q && error
+       $CHECKSTAT -s 80000000 $DIR/d27/f27q || error
+
+       reset_enospc
+}
+run_test 27q "append to truncated file with all OSTs full (should error) ==="
 
 test_27r() {
-    [ "$OSTCOUNT" -lt "2" ] && echo "" && return
-    reset_enospc
-    rm -f $DIR/d27/f27r
-    exhaust_precreations 0
-    sysctl -w lustre.fail_loc=0x80000215
-    $LSTRIPE $DIR/d27/f27r 0 0 -1 && error
-    reset_enospc
+       [ "$OSTCOUNT" -lt "2" -o -z "$MDS" ] && echo "skipping test" && return
+
+       reset_enospc
+       rm -f $DIR/d27/f27r
+       exhaust_precreations 0
+
+       sysctl -w lustre.fail_loc=0x80000215
+       $LSTRIPE $DIR/d27/f27r 0 0 2 && error
+
+       reset_enospc
 }
-run_test 27r "creating a file while some OSTs are full with an explicit stripe count (should error) ==="
+run_test 27r "stripe file with some full OSTs (should error) ==="
 
 test_28() {
        mkdir $DIR/d28
@@ -1015,10 +1035,10 @@ test_28() {
 run_test 28 "create/mknod/mkdir with bad file types ============"
 
 cancel_lru_locks() {
-       for d in /proc/fs/lustre/ldlm/namespaces/$1*; do
+       for d in $LPROC/ldlm/namespaces/$1*; do
                echo clear > $d/lru_size
        done
-       grep "[0-9]" /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null
+       grep "[0-9]" $LPROC/ldlm/namespaces/$1*/lock_unused_count /dev/null
 }
 
 test_29() {
@@ -1027,7 +1047,7 @@ test_29() {
        touch $DIR/d29/foo
        log 'first d29'
        ls -l $DIR/d29
-       MDCDIR=${MDCDIR:-/proc/fs/lustre/ldlm/namespaces/MDC_*}
+       MDCDIR=${MDCDIR:-$LPROC/ldlm/namespaces/MDC_*}
        LOCKCOUNTORIG=`cat $MDCDIR/lock_count`
        LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count`
        log 'second d29'
@@ -1036,7 +1056,7 @@ test_29() {
        LOCKCOUNTCURRENT=`cat $MDCDIR/lock_count`
        LOCKUNUSEDCOUNTCURRENT=`cat $MDCDIR/lock_unused_count`
        if [ $LOCKCOUNTCURRENT -gt $LOCKCOUNTORIG ]; then
-               echo > /proc/fs/lustre/ldlm/dump_namespaces
+               echo > $LPROC/ldlm/dump_namespaces
                error "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG"
                $LCTL dk | sort -k4 -t: > $TMP/test_29.dk
                log "dumped log to $TMP/test_29.dk (bug 5793)"
@@ -1511,7 +1531,7 @@ test_41() {
 run_test 41 "test small file write + fstat ====================="
 
 count_ost_writes() {
-        cat /proc/fs/lustre/osc/*/stats |
+        cat $LPROC/osc/*/stats |
             awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
 }
 
@@ -1559,7 +1579,7 @@ test_42a() {
        stop_writeback
        sync; sleep 1; sync # just to be safe
        BEFOREWRITES=`count_ost_writes`
-       grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/cur_grant_bytes
+       grep "[0-9]" $LPROC/osc/OSC*MNT*/cur_grant_bytes
        dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
        AFTERWRITES=`count_ost_writes`
        [ $BEFOREWRITES -eq $AFTERWRITES ] || \
@@ -1727,7 +1747,7 @@ run_test 44a "test sparse pwrite ==============================="
 
 dirty_osc_total() {
        tot=0
-       for d in /proc/fs/lustre/osc/*/cur_dirty_bytes; do
+       for d in $LPROC/osc/*/cur_dirty_bytes; do
                tot=$(($tot + `cat $d`))
        done
        echo $tot