Whamcloud - gitweb
LU-1187 tests: add create remote directory to racer
[fs/lustre-release.git] / lustre / tests / racer.sh
index 8d75c2c..45cc384 100644 (file)
@@ -10,7 +10,7 @@ init_test_env $@
 init_logging
 
 racer=$LUSTRE/tests/racer/racer.sh
-echo racer: $racer
+echo racer: $racer with $MDSCOUNT MDTs
 
 DURATION=${DURATION:-900}
 [ "$SLOW" = "no" ] && DURATION=300
@@ -22,41 +22,55 @@ check_and_setup_lustre
 CLIENTS=${CLIENTS:-$HOSTNAME}
 RACERDIRS=${RACERDIRS:-"$DIR $DIR2"}
 echo RACERDIRS=$RACERDIRS
-for d in ${RACERDIRS}; do
-        is_mounted $d || continue
 
-       RDIRS="$RDIRS $d/racer"
-       mkdir -p $d/racer
-#      lfs setstripe $d/racer -c -1
-done
+
+check_progs_installed $CLIENTS $racer ||
+       { skip_env "$racer not found" && exit 0; }
 
 # run racer
 test_1() {
-    local rrc=0
-    local rc=0
-    local clients=${CLIENTS:-$(hostname)}
+       local rrc=0
+       local rc=0
+       local clients=$CLIENTS
+       local RDIRS
+       local i
+
+       for d in ${RACERDIRS}; do
+               is_mounted $d || continue
 
-    check_progs_installed $clients $racer || \
-        { skip_env "$racer not found" && return 0; }
+               RDIRS="$RDIRS $d/racer"
+               mkdir -p $d/racer
+       #       lfs setstripe $d/racer -c -1
+               if [ $MDSCOUNT -ge 2 ]; then
+                       for i in $(seq $((MDSCOUNT - 1))); do
+                               RDIRS="$RDIRS $d/racer$i"
+                               if [ ! -e $d/racer$i ]; then
+                                       $LFS mkdir -i $i $d/racer$i ||
+                                               error "lfs mkdir $i failed"
+                               fi
+                       done
+               fi
+       done
 
-    local rpids=""
-    for rdir in $RDIRS; do
-        do_nodes $clients "DURATION=$DURATION $racer $rdir $NUM_RACER_THREADS" &
-        pid=$!
-        rpids="$rpids $pid"
-    done
+       local rpids=""
+       for rdir in $RDIRS; do
+               do_nodes $clients "DURATION=$DURATION MDSCOUNT=$MDSCOUNT \
+                                  $racer $rdir $NUM_RACER_THREADS" &
+               pid=$!
+               rpids="$rpids $pid"
+       done
 
-    echo racers pids: $rpids
-    for pid in $rpids; do
-        wait $pid
-        rc=$?
-        echo "pid=$pid rc=$rc"
-        if [ $rc != 0 ]; then
-            rrc=$((rrc + 1))
-        fi
-    done
+       echo racers pids: $rpids
+       for pid in $rpids; do
+               wait $pid
+               rc=$?
+               echo "pid=$pid rc=$rc"
+               if [ $rc != 0 ]; then
+                   rrc=$((rrc + 1))
+               fi
+       done
 
-    return $rrc
+       return $rrc
 }
 run_test 1 "racer on clients: ${CLIENTS:-$(hostname)} DURATION=$DURATION"