Whamcloud - gitweb
LU-506 tests: modprobe exportfs for fsfilt_ldiskfs
[fs/lustre-release.git] / lustre / tests / test-framework.sh
index 4b2cd84..cca6f0c 100644 (file)
@@ -37,8 +37,13 @@ if [ -f "$EXCEPT_LIST_FILE" ]; then
     . $EXCEPT_LIST_FILE
 fi
 
-[ -z "$MODPROBECONF" -a -f /etc/modprobe.conf ] && MODPROBECONF=/etc/modprobe.conf
-[ -z "$MODPROBECONF" -a -f /etc/modprobe.d/Lustre ] && MODPROBECONF=/etc/modprobe.d/Lustre
+# check config files for options in decreasing order of preference
+[ -z "$MODPROBECONF" -a -f /etc/modprobe.d/lustre.conf ] &&
+    MODPROBECONF=/etc/modprobe.d/lustre.conf
+[ -z "$MODPROBECONF" -a -f /etc/modprobe.d/Lustre ] &&
+    MODPROBECONF=/etc/modprobe.d/Lustre
+[ -z "$MODPROBECONF" -a -f /etc/modprobe.conf ] &&
+    MODPROBECONF=/etc/modprobe.conf
 
 assert_DIR () {
     local failed=""
@@ -371,10 +376,15 @@ load_modules_local() {
     load_module lov/lov
     load_module mgc/mgc
     if ! client_only; then
-        grep -q crc16 /proc/kallsyms || { modprobe crc16 2>/dev/null || true; }
-        grep -q -w jbd /proc/kallsyms || { modprobe jbd 2>/dev/null || true; }
-        grep -q -w jbd2 /proc/kallsyms || { modprobe jbd2 2>/dev/null || true; }
-        [ "$FSTYPE" = "ldiskfs" ] && load_module ../ldiskfs/ldiskfs/ldiskfs
+        SYMLIST=/proc/kallsyms
+        grep -q crc16 $SYMLIST || { modprobe crc16 2>/dev/null || true; }
+        grep -q -w jbd $SYMLIST || { modprobe jbd 2>/dev/null || true; }
+        grep -q -w jbd2 $SYMLIST || { modprobe jbd2 2>/dev/null || true; }
+        if [ "$FSTYPE" = "ldiskfs" ]; then
+            grep -q exportfs_decode_fh $SYMLIST ||
+                { modprobe exportfs 2> /dev/null || true; }
+            load_module ../ldiskfs/ldiskfs/ldiskfs
+        fi
         load_module mgs/mgs
         load_module mds/mds
         load_module mdd/mdd
@@ -607,12 +617,12 @@ set_default_debug_nodes () {
     local nodes=$1
 
     if [[ ,$nodes, = *,$HOSTNAME,* ]]; then
-       nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME")
-       set_default_debug
+        nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME")
+            set_default_debug
     fi
 
     [[ -n $nodes ]] && do_rpc_nodes $nodes set_default_debug \
-       \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true
+        \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true
 }
 
 set_default_debug_facet () {
@@ -1256,7 +1266,8 @@ wait_update () {
         while [ true ]; do
             RESULT=$(do_node $node "$TEST")
             if [ "$RESULT" == "$FINAL" ]; then
-                echo "Updated after $WAIT sec: wanted '$FINAL' got '$RESULT'"
+                [ -z "$RESULT" -o $WAIT -le $sleep ] ||
+                    echo "Updated after ${WAIT}s: wanted '$FINAL' got '$RESULT'"
                 return 0
             fi
             [ $WAIT -ge $MAX ] && break
@@ -1264,7 +1275,7 @@ wait_update () {
             WAIT=$((WAIT + sleep))
             sleep $sleep
         done
-        echo "Update not seen after $MAX sec: wanted '$FINAL' got '$RESULT'"
+        echo "Update not seen after ${MAX}s: wanted '$FINAL' got '$RESULT'"
         return 3
 }
 
@@ -3052,7 +3063,7 @@ error_noexit() {
 
     # We need to dump the logs on all nodes
     if $dump; then
-        gather_logs $(comma_list $(nodes_list))
+        gather_logs $(comma_list $(nodes_list)) 0
     fi
 
     debugrestore
@@ -3331,7 +3342,7 @@ run_one_logged() {
 
     echo
     log_sub_test_begin test_${1}
-    (run_one $1 "$2") 2>&1 | tee $test_log
+    (run_one $1 "$2") 2>&1 | tee -i $test_log
     local RC=${PIPESTATUS[0]}
 
     [ $RC -ne 0 ] && [ ! -f $LOGDIR/err ] && \
@@ -4226,6 +4237,7 @@ cleanup_pools () {
 
 gather_logs () {
     local list=$1
+    local tar_logs=$2
 
     local ts=$(date +%s)
     local docp=true
@@ -4251,10 +4263,12 @@ gather_logs () {
         do_nodes $list rsync -az "${prefix}.*.${suffix}" $HOSTNAME:$LOGDIR
       fi
 
-    local archive=$LOGDIR/${TESTSUITE}-$ts.tar.bz2
-    tar -jcf $archive $LOGDIR/*$ts* $LOGDIR/*${TESTSUITE}*
+    if [ $tar_logs == 1 ]; then
+        local archive=$LOGDIR/${TESTSUITE}-$ts.tar.bz2
+        tar -jcf $archive $LOGDIR/*$ts* $LOGDIR/*${TESTSUITE}*
 
-    echo $archive
+        echo $archive
+    fi
 }
 
 cleanup_logs () {
@@ -4536,7 +4550,7 @@ wait_flavor()
         echo -n "checking $dir..."
         res=$(do_check_flavor $dir $flavor)
         echo "found $res/$expect $flavor connections"
-        [ $res -eq $expect ] && return 0
+        [ $res -ge $expect ] && return 0
         sleep 4
     done