Whamcloud - gitweb
b=23728 fix regression in wait_flavor.
[fs/lustre-release.git] / lustre / tests / lustre-rsync-test.sh
index 576bc4c..6566850 100644 (file)
@@ -10,8 +10,9 @@ SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 
 ONLY=${ONLY:-"$*"}
-ALWAYS_EXCEPT="$LRSYNC_EXCEPT 5a 5b"
-# bug number for skipped test: -  20878
+[ -n "$ONLY" ] && SLOW=yes
+ALWAYS_EXCEPT="$LRSYNC_EXCEPT"
+# bug number for skipped test:
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 [ "$ALWAYS_EXCEPT$EXCEPT" ] && \
@@ -47,8 +48,8 @@ export LRSYNC="$LRSYNC -v" # -a
 
 # control the time of tests
 DBENCH_TIME=${DBENCH_TIME:-60}  # No of seconds to run dbench
-TGT=/tmp/target
-TGT2=/tmp/target2
+TGT=$TMP/target
+TGT2=$TMP/target2
 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
     awk '{gsub(/_UUID/,""); print $1}' | head -1)
 
@@ -66,8 +67,9 @@ init_src() {
     rm -rf $TGT2/$tdir $TGT2/d*.lustre_rsync-test 2> /dev/null
     rm -rf ${DIR}/$tdir $DIR/d*.lustre_rsync-test ${DIR}/tgt 2> /dev/null
     rm -f $LREPL_LOG
-    mkdir -p $TGT
-    mkdir -p $TGT2
+    mkdir -p ${DIR}/$tdir
+    mkdir -p ${TGT}/$tdir
+    mkdir -p ${TGT2}/$tdir
     if [ $? -ne 0 ]; then
         error "Failed to create target: " $TGT
     fi
@@ -113,7 +115,6 @@ test_1() {
     local xattr=`check_xattr $TGT/foo`
 
     # Directory create
-    mkdir -p ${DIR}/$tdir
     mkdir $DIR/$tdir/d1
     mkdir $DIR/$tdir/d2
 
@@ -302,7 +303,6 @@ test_3a() {
     init_changelog
 
     local numfiles=1000
-    mkdir -p ${DIR}/$tdir
     createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed!"
 
     # Replicate the changes to $TGT
@@ -326,7 +326,6 @@ test_3b() {
 
     local time=60
     local threads=5
-    mkdir -p ${DIR}/$tdir
     writemany -q -a $DIR/$tdir/$tfile $time $threads || error "writemany failed!"
 
     # Replicate the changes to $TGT
@@ -349,7 +348,6 @@ test_3c() {
     init_changelog
 
     local numfiles=1000
-    mkdir -p ${DIR}/$tdir
     createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed!"
     unlinkmany $DIR/$tdir/$tfile $numfiles || error "unlinkmany failed!"
 
@@ -377,7 +375,6 @@ test_4() {
     init_src
     init_changelog
 
-    mkdir -p ${DIR}/$tdir
     END_RUN_FILE=${DIR}/$tdir/run LOAD_PID_FILE=${DIR}/$tdir/pid \
         MOUNT=${DIR}/$tdir run_iozone.sh &
     sleep 30
@@ -424,7 +421,6 @@ test_5a() {
     init_changelog
 
     NUMTEST=2000
-    mkdir -p ${DIR}/$tdir
     createmany -o $DIR/$tdir/$tfile $NUMTEST
 
     # Replicate the changes to $TGT
@@ -453,7 +449,6 @@ test_5b() {
     init_changelog
 
     NUMTEST=2000
-    mkdir -p ${DIR}/$tdir
     createmany -o $DIR/$tdir/$tfile $NUMTEST
 
     # Replicate the changes to $TGT
@@ -480,7 +475,6 @@ test_6() {
     init_changelog
 
     local NUMLINKS=128
-    mkdir -p ${DIR}/$tdir
     touch $DIR/$tdir/link0
     local i=1
     while [ $i -lt $NUMLINKS ];
@@ -509,10 +503,10 @@ run_test 6 "lustre_rsync large no of hard links"
 # Test 7 - lustre_rsync stripesize
 test_7() {
     init_src
+    mkdir -p ${DIR}/tgt/$tdir
     init_changelog
 
     local NUMFILES=100
-    mkdir -p ${DIR}/$tdir
     lfs setstripe -c 2 ${DIR}/$tdir
     createmany -o $DIR/$tdir/$tfile $NUMFILES
 
@@ -520,7 +514,6 @@ test_7() {
     # the changes to $DIR/tgt. We can't turn off the changelogs
     # while we are registered, so lustre_rsync better not try to 
     # replicate the replication steps.  It seems ok :)
-    mkdir $DIR/tgt
 
     $LRSYNC -s $DIR -t $DIR/tgt -m $MDT0 -u $CL_USER -l $LREPL_LOG
     check_diff ${DIR}/$tdir $DIR/tgt/$tdir
@@ -545,8 +538,6 @@ test_8() {
     init_src
     init_changelog
 
-    mkdir -p ${DIR}/$tdir
-
     for i in 1 2 3 4 5 6 7 8 9; do
        mkdir $DIR/$tdir/d$i
            for j in 1 2 3 4 5 6 7 8 9; do
@@ -571,6 +562,29 @@ test_8() {
 }
 run_test 8 "Replicate multiple file/directory moves"
 
+test_9() {
+    init_src
+    init_changelog
+
+    mkdir $DIR/$tdir/foo
+    touch $DIR/$tdir/foo/a1
+
+    $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
+
+    check_diff ${DIR}/$tdir $TGT/$tdir
+
+    rm -rf $DIR/$tdir/foo
+
+    $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
+
+    check_diff ${DIR}/$tdir $TGT/$tdir
+
+    fini_changelog
+    cleanup_src_tgt
+    return 0
+}
+run_test 9 "Replicate recursive directory removal"
+
 log "cleanup: ======================================================"
 cd $ORIG_PWD
 check_and_cleanup_lustre