Whamcloud - gitweb
LU-1458 test: dump changelog for lustre-rsync-test
authorBobi Jam <bobijam@whamcloud.com>
Tue, 7 Aug 2012 05:57:33 +0000 (13:57 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 8 Aug 2012 17:03:19 +0000 (13:03 -0400)
Dump plain text format changelog records for failed lustre-rsync-test
test case to help debugging.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I2041e8262dd3b5307e4d5eac4619a3fbcfe5abb4
Reviewed-on: http://review.whamcloud.com/3551
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/lustre-rsync-test.sh

index e09985e..de9f428 100644 (file)
@@ -42,7 +42,7 @@ build_test_filter
 
 export LRSYNC=${LRSYNC:-"$LUSTRE/utils/lustre_rsync"}
 [ ! -f "$LRSYNC" ] && export LRSYNC=$(which lustre_rsync)
 
 export LRSYNC=${LRSYNC:-"$LUSTRE/utils/lustre_rsync"}
 [ ! -f "$LRSYNC" ] && export LRSYNC=$(which lustre_rsync)
-export LRSYNC="$LRSYNC -v" # -a
+export LRSYNC="$LRSYNC -v -c no" # -a
 
 # control the time of tests
 DBENCH_TIME=${DBENCH_TIME:-60}  # No of seconds to run dbench
 
 # control the time of tests
 DBENCH_TIME=${DBENCH_TIME:-60}  # No of seconds to run dbench
@@ -108,13 +108,16 @@ check_xattr() {
 }
 
 check_diff() {
 }
 
 check_diff() {
-    if [ -e $1 -o -e $2 ]; then 
-        diff -rq -x "dev1" $1 $2
-        local RC=$?
-        if [ $RC -ne 0 ]; then
-            error "Failure in replication; differences found."
-        fi
-    fi
+       local changelog_file=$LOGDIR/${TESTSUITE}.test_${3}.changelog
+
+       if [ -e $1 -o -e $2 ]; then
+               diff -rq -x "dev1" $1 $2
+               local RC=$?
+               if [ $RC -ne 0 ]; then
+                       $LFS changelog $MDT0 > $changelog_file
+                       error "Failure in replication; differences found."
+               fi
+       fi
 }
 
 # Test 1 - test basic operations
 }
 
 # Test 1 - test basic operations
@@ -192,8 +195,8 @@ test_1() {
     fi
 
     # Use diff to compare the source and the destination
     fi
 
     # Use diff to compare the source and the destination
-    check_diff $DIR/$tdir $TGT/$tdir
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 1
+    check_diff $DIR/$tdir $TGT2/$tdir 1
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -214,8 +217,8 @@ test_2a() {
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     # Use diff to compare the source and the destination
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     # Use diff to compare the source and the destination
-    check_diff $DIR/$tdir $TGT/$tdir
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 2a
+    check_diff $DIR/$tdir $TGT2/$tdir 2a
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -242,7 +245,7 @@ test_2b() {
 
     echo Starting replication
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     echo Starting replication
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
-    check_diff $DIR/$tdir $TGT/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 2b
 
     echo Resuming dbench
     $KILL -SIGCONT $child_pid
 
     echo Resuming dbench
     $KILL -SIGCONT $child_pid
@@ -253,7 +256,7 @@ test_2b() {
 
     echo Starting replication
     $LRSYNC -l $LREPL_LOG
 
     echo Starting replication
     $LRSYNC -l $LREPL_LOG
-    check_diff $DIR/$tdir $TGT/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 2b
 
     echo "Wait for dbench to finish"
     $KILL -SIGCONT $child_pid
 
     echo "Wait for dbench to finish"
     $KILL -SIGCONT $child_pid
@@ -263,8 +266,8 @@ test_2b() {
     echo Starting replication
     $LRSYNC -l $LREPL_LOG
 
     echo Starting replication
     $LRSYNC -l $LREPL_LOG
 
-    check_diff $DIR/$tdir $TGT/$tdir
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 2b
+    check_diff $DIR/$tdir $TGT2/$tdir 2b
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -296,8 +299,8 @@ test_2c() {
     done
 
     # Use diff to compare the source and the destination
     done
 
     # Use diff to compare the source and the destination
-    check_diff $DIR/$tdir $TGT/$tdir
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 2c
+    check_diff $DIR/$tdir $TGT2/$tdir 2c
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -317,8 +320,8 @@ test_3a() {
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
-    check_diff $DIR/$tdir $TGT/$tdir   
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 3a
+    check_diff $DIR/$tdir $TGT2/$tdir 3a
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -341,8 +344,8 @@ test_3b() {
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
-    check_diff $DIR/$tdir $TGT/$tdir   
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 3b
+    check_diff $DIR/$tdir $TGT2/$tdir 3b
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -363,8 +366,8 @@ test_3c() {
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG
-    check_diff $DIR/$tdir $TGT/$tdir   
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 3c
+    check_diff $DIR/$tdir $TGT2/$tdir 3c
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -393,8 +396,8 @@ test_4() {
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG
-    check_diff $DIR/$tdir $TGT/$tdir
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 4
+    check_diff $DIR/$tdir $TGT2/$tdir 4
 
     $KILL -SIGCONT $child_pid
     sleep 60
 
     $KILL -SIGCONT $child_pid
     sleep 60
@@ -414,8 +417,8 @@ test_4() {
     done
 
     $LRSYNC -l $LREPL_LOG
     done
 
     $LRSYNC -l $LREPL_LOG
-    check_diff $DIR/$tdir $TGT/$tdir
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 4
+    check_diff $DIR/$tdir $TGT2/$tdir 4
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -442,8 +445,8 @@ test_5a() {
     wait
     $LRSYNC -l $LREPL_LOG
 
     wait
     $LRSYNC -l $LREPL_LOG
 
-    check_diff $DIR/$tdir $TGT/$tdir   
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 5a
+    check_diff $DIR/$tdir $TGT2/$tdir 5a
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -470,8 +473,8 @@ test_5b() {
     wait
     $LRSYNC -l $LREPL_LOG
 
     wait
     $LRSYNC -l $LREPL_LOG
 
-    check_diff $DIR/$tdir $TGT/$tdir   
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 5b
+    check_diff $DIR/$tdir $TGT2/$tdir 5b
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -495,8 +498,8 @@ test_6() {
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     # Replicate the changes to $TGT
     $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
-    check_diff $DIR/$tdir $TGT/$tdir
-    check_diff $DIR/$tdir $TGT2/$tdir
+    check_diff $DIR/$tdir $TGT/$tdir 6
+    check_diff $DIR/$tdir $TGT2/$tdir 6
 
     local count1=$(ls -l $TGT/$tdir/link0 | sed -r 's/ +/ /g' | cut -f 2 -d ' ')
     local count2=$(ls -l $TGT/$tdir/link0 | sed -r 's/ +/ /g' | cut -f 2 -d ' ')
 
     local count1=$(ls -l $TGT/$tdir/link0 | sed -r 's/ +/ /g' | cut -f 2 -d ' ')
     local count2=$(ls -l $TGT/$tdir/link0 | sed -r 's/ +/ /g' | cut -f 2 -d ' ')
@@ -526,7 +529,7 @@ test_7() {
     # replicate the replication steps.  It seems ok :)
 
     $LRSYNC -s $DIR -t $DIR/tgt -m $MDT0 -u $CL_USER -l $LREPL_LOG
     # replicate the replication steps.  It seems ok :)
 
     $LRSYNC -s $DIR -t $DIR/tgt -m $MDT0 -u $CL_USER -l $LREPL_LOG
-    check_diff ${DIR}/$tdir $DIR/tgt/$tdir
+    check_diff ${DIR}/$tdir $DIR/tgt/$tdir 7
 
     local i=0
     while [ $i -lt $NUMFILES ];
 
     local i=0
     while [ $i -lt $NUMFILES ];
@@ -564,7 +567,7 @@ test_8() {
 
     $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
 
     $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
-    check_diff ${DIR}/$tdir $TGT/$tdir
+    check_diff ${DIR}/$tdir $TGT/$tdir 8
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt
@@ -581,13 +584,13 @@ test_9() {
 
     $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
 
     $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
-    check_diff ${DIR}/$tdir $TGT/$tdir
+    check_diff ${DIR}/$tdir $TGT/$tdir 9
 
     rm -rf $DIR/$tdir/foo
 
     $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
 
     rm -rf $DIR/$tdir/foo
 
     $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
-    check_diff ${DIR}/$tdir $TGT/$tdir
+    check_diff ${DIR}/$tdir $TGT/$tdir 9
 
     fini_changelog
     cleanup_src_tgt
 
     fini_changelog
     cleanup_src_tgt