Whamcloud - gitweb
LU-3626 tests: More time to allow mds-ost sync being finished
[fs/lustre-release.git] / lustre / tests / sanity-gss.sh
index 171ea7c..8b695b6 100644 (file)
@@ -1,5 +1,4 @@
 #!/bin/bash
-# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
 #
 # Run select tests by setting ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
@@ -12,20 +11,13 @@ ONLY=${ONLY:-"$*"}
 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$SANITY_GSS_EXCEPT"}
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
-# Tests that fail on uml
-CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
-[ "$CPU" = "UML" ] && EXCEPT="$EXCEPT"
-
-case `uname -r` in
-2.6*) FSTYPE=${FSTYPE:-ldiskfs}; ALWAYS_EXCEPT="$ALWAYS_EXCEPT " ;;
-*) error "unsupported kernel (gss only works with 2.6.x)" ;;
-esac
-
 SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$SRCDIR/../utils/gss:$PATH:/sbin
 export NAME=${NAME:-local}
 SAVE_PWD=$PWD
 
+export MULTIOP=${MULTIOP:-multiop}
+
 CLEANUP=${CLEANUP:-""}
 SETUP=${SETUP:-""}
 
@@ -241,7 +233,7 @@ test_3() {
     $RUNAS cat $file > /dev/null || error "$RUNAS_ID cat error"
 
     # start multiop
-    $RUNAS multiop $file o_r &
+    $RUNAS $MULTIOP $file o_r &
     OPPID=$!
     # wait multiop finish its open()
     sleep 1
@@ -354,59 +346,65 @@ test_6() {
 run_test 6 "test basic DLM callback works"
 
 test_7() {
-    local tdir=$DIR/d7
-    local num_osts
-
-    #
-    # for open(), client only reserve space for default stripe count lovea,
-    # and server may return larger lovea in reply (because of larger stripe
-    # count), client need call enlarge_reqbuf() and save the replied lovea
-    # in request for future possible replay.
-    #
-    # Note: current script does NOT guarantee enlarge_reqbuf() will be in
-    # the path, however it does work in local test which has 2 OSTs and
-    # default stripe count is 1.
-    #
-    num_osts=`$LFS getstripe $MOUNT | egrep "^[0-9]*:.*ACTIVE" | wc -l`
-    echo "found $num_osts active OSTs"
-    [ $num_osts -lt 2 ] && echo "skipping $TESTNAME (must have >= 2 OSTs)" && return
-
-    mkdir $tdir || error
-    $LFS setstripe -c $num_osts $tdir || error
-
-    echo "creating..."
-    for ((i=0;i<20;i++)); do
-        dd if=/dev/zero of=$tdir/f$i bs=4k count=16 2>/dev/null
-    done
-    echo "reading..."
-    for ((i=0;i<20;i++)); do
-        dd if=$tdir/f$i of=/dev/null bs=4k count=16 2>/dev/null
-    done
-    rm -rf $tdir
+       local tdir=$DIR/d7
+       local num_osts
+
+       # for open(), client only reserve space for default stripe count lovea,
+       # and server may return larger lovea in reply (because of larger stripe
+       # count), client need call enlarge_reqbuf() and save the replied lovea
+       # in request for future possible replay.
+       #
+       # Note: current script does NOT guarantee enlarge_reqbuf() will be in
+       # the path, however it does work in local test which has 2 OSTs and
+       # default stripe count is 1.
+       num_osts=$($LFS getstripe $MOUNT | egrep "^[0-9]*:.*ACTIVE" | wc -l)
+       echo "found $num_osts active OSTs"
+       [ $num_osts -lt 2 ] &&
+               echo "skipping $TESTNAME (must have >= 2 OSTs)" && return
+
+       mkdir $tdir || error "mkdir $tdir failed"
+       $LFS setstripe -c $num_osts $tdir || error "setstripe -c $num_osts"
+
+       echo "creating..."
+       for ((i = 0; i < 20; i++)); do
+               dd if=/dev/zero of=$tdir/f$i bs=4k count=16 2>/dev/null
+       done
+       echo "reading..."
+       for ((i = 0; i < 20; i++)); do
+               dd if=$tdir/f$i of=/dev/null bs=4k count=16 2>/dev/null
+       done
+       rm -rf $tdir
 }
 run_test 7 "exercise enlarge_reqbuf()"
 
 test_8()
 {
-    local ATHISTORY=$(do_facet mds "find /sys/ -name at_history")
-    local ATOLDBASE=$(do_facet mds "cat $ATHISTORY")
-    do_facet mds "echo 8 >> $ATHISTORY"
+    local ATHISTORY=$(do_facet $SINGLEMDS "find /sys/ -name at_history")
+    local ATOLDBASE=$(do_facet $SINGLEMDS "cat $ATHISTORY")
+    local REQ_DELAY
+    do_facet $SINGLEMDS "echo 8 >> $ATHISTORY"
+
+    mkdir -p $DIR/d8
+    chmod a+w $DIR/d8
 
     $LCTL dk > /dev/null
     debugsave
     sysctl -w lnet.debug="+other"
 
-    mkdir -p $DIR/d8
-    chmod a+w $DIR/d8
-
-    REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
-               awk '/portal 12/ {print $5}' | tail -1`
+    # wait for the at estimation come down, this is faster
+    while [ true ]; do
+        REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
+                   awk '/portal 12/ {print $5}' | tail -1`
+        [ $REQ_DELAY -le 5 ] && break
+        echo "current AT estimation is $REQ_DELAY, wait a little bit"
+        sleep 8
+    done
     REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
 
     # sleep sometime in ctx handle
-    do_facet mds lctl set_param fail_val=$REQ_DELAY
+    do_facet $SINGLEMDS lctl set_param fail_val=$REQ_DELAY
 #define OBD_FAIL_SEC_CTX_HDL_PAUSE       0x1204
-    do_facet mds lctl set_param fail_loc=0x1204
+    do_facet $SINGLEMDS lctl set_param fail_loc=0x1204
 
     $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
 
@@ -414,13 +412,13 @@ test_8()
     TOUCHPID=$!
     echo "waiting for touch (pid $TOUCHPID) to finish..."
     sleep 2 # give it a chance to really trigger context init rpc
-    do_facet mds sysctl -w lustre.fail_loc=0
+    do_facet $SINGLEMDS $LCTL set_param fail_loc=0
     wait $TOUCHPID || error "touch should have succeeded"
 
     $LCTL dk | grep "Early reply #" || error "No early reply"
 
     debugrestore
-    do_facet mds "echo $ATOLDBASE >> $ATHISTORY" || true
+    do_facet $SINGLEMDS "echo $ATOLDBASE >> $ATHISTORY" || true
 }
 run_test 8 "Early reply sent for slow gss context negotiation"
 
@@ -631,7 +629,7 @@ switch_sec_test()
     do_facet $SINGLEMDS lctl set_param fail_val=36
     do_facet $SINGLEMDS lctl set_param fail_loc=0x513
     log "starting multiop"
-    multiop $filename m &
+    $MULTIOP $filename m &
     multiop_pid=$!
     echo "multiop pid=$multiop_pid"
     sleep 1
@@ -786,6 +784,6 @@ test_151() {
 }
 run_test 151 "secure mgs connection: server flavor control"
 
-equals_msg `basename $0`: test complete, cleaning up
+complete $SECONDS
 check_and_cleanup_lustre
-[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true
+exit_status