Whamcloud - gitweb
LU-8526 tests: ensure all OSTs active for allocations
[fs/lustre-release.git] / lustre / tests / lustre-rsync-test.sh
1 #!/bin/bash
2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:shiftwidth=4:softtabstop=4:tabstop=4:
4 #
5 # Run select tests by setting ONLY, or as arguments to the script.
6 # Skip specific tests by setting EXCEPT.
7 #
8 # Run test by setting NOSETUP=true when ltest has setup env for us
9 set -e
10
11 SRCDIR=`dirname $0`
12 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
13
14 ONLY=${ONLY:-"$*"}
15 ALWAYS_EXCEPT="$LRSYNC_EXCEPT"
16 # bug number for skipped test:
17 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18
19 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
20
21 [ "$ALWAYS_EXCEPT$EXCEPT" ] &&
22         echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`"
23
24 KILL=/bin/kill
25
26 TMP=${TMP:-/tmp}
27 LREPL_LOG=$TMP/lustre_rsync.log
28 ORIG_PWD=${PWD}
29
30 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
31 . $LUSTRE/tests/test-framework.sh
32 init_test_env $@
33 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
34 init_logging
35
36 check_and_setup_lustre
37
38 DIR=${DIR:-$MOUNT}
39 assert_DIR
40
41
42 build_test_filter
43
44 export LRSYNC=${LRSYNC:-"$LUSTRE/utils/lustre_rsync"}
45 [ ! -f "$LRSYNC" ] && export LRSYNC=$(which lustre_rsync)
46 export LRSYNC="$LRSYNC -v -c no -d 2"
47
48 # control the time of tests
49 DBENCH_TIME=${DBENCH_TIME:-60}  # No of seconds to run dbench
50 TGT=$TMP/target
51 TGT2=$TMP/target2
52 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
53         awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
54
55 init_changelog() {
56     CL_USER=$(do_facet $SINGLEMDS lctl --device $MDT0 changelog_register -n)
57     echo $MDT0: Registered changelog user $CL_USER
58     CL_USERS=$(( $(do_facet $SINGLEMDS lctl get_param -n \
59         mdd.$MDT0.changelog_users | wc -l) - 2 ))
60     [ $CL_USERS -ne 1 ] && \
61         echo "Other changelog users present ($CL_USERS)"
62 }
63
64 init_src() {
65     rm -rf $TGT/$tdir $TGT/d*.lustre_rsync-test 2> /dev/null
66     rm -rf $TGT2/$tdir $TGT2/d*.lustre_rsync-test 2> /dev/null
67     rm -rf ${DIR}/$tdir $DIR/d*.lustre_rsync-test ${DIR}/tgt 2> /dev/null
68     rm -f $LREPL_LOG
69     mkdir -p ${DIR}/$tdir
70     mkdir -p ${TGT}/$tdir
71     mkdir -p ${TGT2}/$tdir
72     if [ $? -ne 0 ]; then
73         error "Failed to create target: " $TGT
74     fi
75 }
76
77 cleanup_src_tgt() {
78     rm -rf $TGT/$tdir
79     rm -rf $DIR/$tdir
80     rm -rf $DIR/tgt
81 }
82
83 fini_changelog() {
84     $LFS changelog_clear $MDT0 $CL_USER 0
85     do_facet $SINGLEMDS lctl --device $MDT0 changelog_deregister $CL_USER
86 }
87
88 # Check whether the filesystem supports xattr or not.
89 # Return value:
90 # "large" - large xattr is supported
91 # "small" - large xattr is unsupported but small xattr is supported
92 # "no"    - xattr is unsupported
93 check_xattr() {
94     local tgt=$1
95     local xattr="no"
96
97     touch $tgt
98
99     local val="$(generate_string $(max_xattr_size))"
100     if large_xattr_enabled &&
101        setfattr -n user.foo -v $val $tgt 2>/dev/null; then
102             xattr="large"
103     else
104         setfattr -n user.foo -v bar $tgt 2>/dev/null && xattr="small"
105     fi
106
107     rm -f $tgt
108     echo $xattr
109 }
110
111 check_diff() {
112         local changelog_file=$(generate_logname "changelog")
113
114         if [ -e $1 -o -e $2 ]; then
115                 diff -rq -x "dev1" $1 $2
116                 local RC=$?
117                 if [ $RC -ne 0 ]; then
118                         $LFS changelog $MDT0 > $changelog_file
119                         error "Failure in replication; differences found."
120                 fi
121         fi
122 }
123
124 procs_are_stopped() {
125         local pids="$*"
126         local state
127
128         for state in $(ps -p "$pids" -o state=); do
129                 if [[ "$state" != T ]]; then
130                         return 1
131                 fi
132         done
133
134         return 0
135 }
136
137 # Send SIGSTOP to PIDs and wait up to 60 seconds for them to show a
138 # stopped process state.
139 stop_procs() {
140         local pids="$*"
141         local end
142
143         $KILL -SIGSTOP $pids
144         end=$((SECONDS + 60))
145         while ((SECONDS < end)); do
146                 if procs_are_stopped $pids; then
147                         return 0
148                 fi
149
150                 sleep 1
151         done
152
153         return 1
154 }
155
156 # Test 1 - test basic operations
157 test_1() {
158     init_src
159     init_changelog
160     local xattr=$(check_xattr $TGT/foo)
161
162     # Directory create
163     mkdir $DIR/$tdir/d1
164     mkdir $DIR/$tdir/d2
165
166     # File create
167     touch $DIR/$tdir/file1
168     cp /etc/hosts  $DIR/$tdir/d1/
169     touch  $DIR/$tdir/d1/"space in filename"
170     touch  $DIR/$tdir/d1/file2
171
172     # File rename
173     mv $DIR/$tdir/d1/file2 $DIR/$tdir/d2/file3
174
175     # File and directory delete
176     touch $DIR/$tdir/d1/file4
177     mkdir $DIR/$tdir/d1/del
178     touch  $DIR/$tdir/d1/del/del1
179     touch  $DIR/$tdir/d1/del/del2
180     rm -rf $DIR/$tdir/d1/del
181     rm $DIR/$tdir/d1/file4
182
183     #hard and soft links
184     cat /etc/hosts > $DIR/$tdir/d1/link1
185     ln  $DIR/$tdir/d1/link1  $DIR/$tdir/d1/link2
186     ln -s $DIR/$tdir/d1/link1  $DIR/$tdir/d1/link3
187
188     # Device files
189     #mknod $DIR/$tdir/dev1 b 8 1
190
191         # Replicate
192         local LRSYNC_LOG=$(generate_logname "lrsync_log")
193         echo "Replication #1"
194         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
195                 -D $LRSYNC_LOG
196
197     # Set attributes
198     chmod 000 $DIR/$tdir/d2/file3
199     chown nobody:nobody $DIR/$tdir/d2/file3
200
201     # Set xattrs
202     if [[ "$xattr" != "no" ]]; then
203         local value
204         touch $DIR/$tdir/file5
205         [[ "$xattr" = "large" ]] &&
206             value="$(generate_string $(max_xattr_size))" || value="bar"
207         setfattr -n user.foo -v $value $DIR/$tdir/file5
208     fi
209
210         echo "Replication #2"
211         $LRSYNC -l $LREPL_LOG -D $LRSYNC_LOG
212
213     if [[ "$xattr" != "no" ]]; then
214         local xval1=$(get_xattr_value user.foo $TGT/$tdir/file5)
215         local xval2=$(get_xattr_value user.foo $TGT2/$tdir/file5)
216     fi
217
218     RC=0
219
220     # fid2path and path2fid aren't implemented for block devices
221     #if [[ ! -b $TGT/$tdir/dev1 ]] || [[ ! -b $TGT2/$tdir/dev1 ]]; then
222     #   ls -l $DIR/$tdir/dev1 $TGT/$tdir/dev1 $TGT2/$tdir/dev1
223     #   error "Error replicating block devices"
224     #   RC=1
225
226     if [[ "$xattr" != "no" ]] &&
227        [[ "$xval1" != "$value" || "$xval2" != "$value" ]]; then
228         error "Error in replicating xattrs."
229         RC=1
230     fi
231
232         # Use diff to compare the source and the destination
233         check_diff $DIR/$tdir $TGT/$tdir
234         check_diff $DIR/$tdir $TGT2/$tdir
235
236     fini_changelog
237     cleanup_src_tgt
238     return $RC
239 }
240 run_test 1 "Simple Replication"
241
242 # Test 1a - test create/delete operations in ROOT directory
243 test_1a() { # LU-5005
244         rm -rf $TGT/root-* 2> /dev/null
245         rm -rf $DIR/root-* 2> /dev/null
246         init_src
247         init_changelog
248
249         # Directory create
250         mkdir $DIR/root-dir
251
252         # File create
253         touch $DIR/root-file
254         touch $DIR/root-file2
255
256         # File rename
257         mv $DIR/root-file2 $DIR/root-file3
258
259         # File and directory delete
260         touch $DIR/root-file4
261         mkdir $DIR/root-dir1
262         rm $DIR/root-file4
263         rm -rf $DIR/root-dir1
264
265         # Replicate
266         local LRSYNC_LOG=$(generate_logname "lrsync_log")
267         echo "Replication"
268         $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG \
269                 -D $LRSYNC_LOG
270
271         # Verify
272         stat $TGT/root-dir || error "Dir create not replicated"
273         stat $TGT/root-file || error "File create not replicated"
274         stat $TGT/root-file2 && error "Rename not replicated (src)"
275         stat $TGT/root-file3 || error "Rename not replicated (tgt)"
276         stat $TGT/root-dir1 && error "Dir delete not replicated"
277         stat $TGT/root-file4 && error "File delete not replicated"
278
279         cleanup_src_tgt
280         fini_changelog
281         rm -fr $TGT/root-*
282         rm -fr $DIR/root-*
283         return 0
284 }
285 run_test 1a "Replicate create/delete operations in ROOT directory"
286
287 # Test 2a - Replicate files created by dbench
288 test_2a() {
289         init_src
290         init_changelog
291
292         # Run dbench
293         sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME || error "dbench failed"
294
295         local LRSYNC_LOG=$(generate_logname "lrsync_log")
296         # Replicate the changes to $TGT
297         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
298                 -D $LRSYNC_LOG
299
300         # Use diff to compare the source and the destination
301         check_diff $DIR/$tdir $TGT/$tdir
302         check_diff $DIR/$tdir $TGT2/$tdir
303
304         fini_changelog
305         cleanup_src_tgt
306         return 0
307 }
308 run_test 2a "Replicate files created by dbench."
309
310
311 # Test 2b - Replicate files changed by dbench.
312 test_2b() {
313         local child_pid
314         init_src
315         init_changelog
316
317         # Run dbench
318         sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME &
319         # wait for dbench to start
320         wait_for_function 'child_pid=$(pgrep dbench)' 360
321         # let dbench run for a bit
322         sleep 10
323
324         echo PIDs: $child_pid
325         echo Stopping dbench
326         stop_procs $child_pid
327
328         local LRSYNC_LOG=$(generate_logname "lrsync_log")
329         echo Starting replication
330         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
331                 -D $LRSYNC_LOG
332         check_diff $DIR/$tdir $TGT/$tdir
333
334     echo Resuming dbench
335     $KILL -SIGCONT $child_pid
336     sleep 10
337
338     echo Stopping dbench
339         stop_procs $child_pid
340
341         echo Starting replication
342         $LRSYNC -l $LREPL_LOG -D $LRSYNC_LOG
343         check_diff $DIR/$tdir $TGT/$tdir
344
345     echo "Wait for dbench to finish"
346     $KILL -SIGCONT $child_pid
347     wait
348
349         # Replicate the changes to $TGT
350         echo Starting replication
351         $LRSYNC -l $LREPL_LOG -D $LRSYNC_LOG
352
353         check_diff $DIR/$tdir $TGT/$tdir
354         check_diff $DIR/$tdir $TGT2/$tdir
355
356     fini_changelog
357     cleanup_src_tgt
358     return 0
359 }
360 run_test 2b "Replicate files changed by dbench."
361
362 # Test 2c - Replicate files while dbench is running
363 test_2c() {
364         init_src
365         init_changelog
366
367         # Run dbench
368         sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME &
369
370         local LRSYNC_LOG=$(generate_logname "lrsync_log")
371         # Replicate the changes to $TGT
372         sleep 10 # give dbench a headstart
373         local quit=0
374         while [ $quit -le 1 ];
375         do
376                 echo "Running lustre_rsync"
377                 $LRSYNC -s $DIR -t $TGT -t $TGT2 -m ${mds1_svc} -u $CL_USER \
378                         -l $LREPL_LOG -D $LRSYNC_LOG
379                 sleep 5
380                 pgrep dbench
381                 if [ $? -ne 0 ]; then
382                         quit=$(expr $quit + 1)
383                 fi
384         done
385
386         # Use diff to compare the source and the destination
387         check_diff $DIR/$tdir $TGT/$tdir
388         check_diff $DIR/$tdir $TGT2/$tdir
389
390         fini_changelog
391         cleanup_src_tgt
392         return 0
393 }
394 run_test 2c "Replicate files while dbench is running."
395
396 # Test 3a - Replicate files created by createmany
397 test_3a() {
398         init_src
399         init_changelog
400
401         local numfiles=1000
402         createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed"
403
404         local LRSYNC_LOG=$(generate_logname "lrsync_log")
405         # Replicate the changes to $TGT
406         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
407                 -D $LRSYNC_LOG
408         check_diff $DIR/$tdir $TGT/$tdir
409         check_diff $DIR/$tdir $TGT2/$tdir
410
411         fini_changelog
412         cleanup_src_tgt
413         return 0
414 }
415 run_test 3a "Replicate files created by createmany"
416
417
418 # Test 3b - Replicate files created by writemany
419 test_3b() {
420         init_src
421         init_changelog
422
423         local time=60
424         local threads=5
425         writemany -q -a $DIR/$tdir/$tfile $time $threads ||
426                 error "writemany failed"
427
428         local LRSYNC_LOG=$(generate_logname "lrsync_log")
429         # Replicate the changes to $TGT
430         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
431                 -D $LRSYNC_LOG
432
433         check_diff $DIR/$tdir $TGT/$tdir
434         check_diff $DIR/$tdir $TGT2/$tdir
435
436         fini_changelog
437         cleanup_src_tgt
438         return 0
439 }
440 run_test 3b "Replicate files created by writemany"
441
442 # Test 3c - Replicate files created by createmany/unlinkmany
443 test_3c() {
444         init_src
445         init_changelog
446
447         local numfiles=1000
448         createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed"
449         unlinkmany $DIR/$tdir/$tfile $numfiles || error "unlinkmany failed"
450
451         local LRSYNC_LOG=$(generate_logname "lrsync_log")
452         # Replicate the changes to $TGT
453         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG \
454                 -D $LRSYNC_LOG
455         check_diff $DIR/$tdir $TGT/$tdir
456         check_diff $DIR/$tdir $TGT2/$tdir
457
458         fini_changelog
459         cleanup_src_tgt
460         return 0
461 }
462 run_test 3c "Replicate files created by createmany/unlinkmany"
463
464 # Test 4 - Replicate files created by iozone
465 test_4() {
466     which iozone > /dev/null 2>&1
467     if [ $? -ne 0 ]; then
468         skip "iozone not found. Skipping test"
469         return
470     fi
471
472     init_src
473     init_changelog
474
475     END_RUN_FILE=${DIR}/$tdir/run LOAD_PID_FILE=${DIR}/$tdir/pid \
476         MOUNT=${DIR}/$tdir run_iozone.sh &
477     sleep 30
478     child_pid=$(pgrep iozone)
479         stop_procs $child_pid
480
481         local LRSYNC_LOG=$(generate_logname "lrsync_log")
482         # Replicate the changes to $TGT
483         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG \
484                 -D $LRSYNC_LOG
485         check_diff $DIR/$tdir $TGT/$tdir
486         check_diff $DIR/$tdir $TGT2/$tdir
487
488     $KILL -SIGCONT $child_pid
489     sleep 60
490     $KILL -SIGKILL $(pgrep run_iozone.sh)
491     $KILL -SIGKILL $(pgrep iozone)
492
493     # After killing 'run_iozone.sh', process 'iozone' becomes the
494     # child of PID 1. Hence 'wait' does not wait for it. Killing
495     # iozone first, means more iozone processes are spawned off which
496     # is not desirable. So, after sending a sigkill, the test goes
497     # into a wait loop for iozone to cleanup and exit.
498     wait
499     while [ "$(pgrep "iozone")" != "" ];
500     do
501       ps -ef | grep iozone | grep -v grep
502       sleep 1;
503     done
504
505         $LRSYNC -l $LREPL_LOG -D $LRSYNC_LOG
506         check_diff $DIR/$tdir $TGT/$tdir
507         check_diff $DIR/$tdir $TGT2/$tdir
508
509     fini_changelog
510     cleanup_src_tgt
511     return 0
512 }
513 run_test 4 "Replicate files created by iozone"
514
515 # Test 5a - Stop / start lustre_rsync
516 test_5a() {
517         init_src
518         init_changelog
519
520         NUMTEST=2000
521         createmany -o $DIR/$tdir/$tfile $NUMTEST
522
523         # Replicate the changes to $TGT
524         local LRSYNC_LOG=$(generate_logname "lrsync_log")
525         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
526                 -D $LRSYNC_LOG &
527         local child_pid=$!
528         sleep 30
529         $KILL -SIGHUP $child_pid
530         wait
531         $LRSYNC -l $LREPL_LOG -D $LRSYNC_LOG
532
533         check_diff $DIR/$tdir $TGT/$tdir
534         check_diff $DIR/$tdir $TGT2/$tdir
535
536         fini_changelog
537         cleanup_src_tgt
538         return 0
539 }
540 run_test 5a "Stop / start lustre_rsync"
541
542 # Test 5b - Kill / restart lustre_rsync
543 test_5b() {
544         init_src
545         init_changelog
546
547         NUMTEST=2000
548         createmany -o $DIR/$tdir/$tfile $NUMTEST
549
550         # Replicate the changes to $TGT
551         local LRSYNC_LOG=$(generate_logname "lrsync_log")
552         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
553                 -D $LRSYNC_LOG &
554         local child_pid=$!
555         sleep 30
556         $KILL -SIGKILL $child_pid
557         wait
558         $LRSYNC -l $LREPL_LOG -D $LRSYNC_LOG
559
560         check_diff $DIR/$tdir $TGT/$tdir
561         check_diff $DIR/$tdir $TGT2/$tdir
562
563         fini_changelog
564         cleanup_src_tgt
565         return 0
566 }
567 run_test 5b "Kill / restart lustre_rsync"
568
569 # Test 6 - lustre_rsync large no of hard links
570 test_6() {
571         init_src
572         init_changelog
573
574         local num_links=128
575         local i
576
577         touch $DIR/$tdir/link0
578         for ((i = 1; i < num_links - 1; i++)); do
579                 ln $DIR/$tdir/link0 $DIR/$tdir/link$i
580         done
581         # create an extra hard link of src name ending with dest name
582         ln $DIR/$tdir/link0 $DIR/$tdir/ink0
583
584         local LRSYNC_LOG=$(generate_logname "lrsync_log")
585         # Replicate the changes to $TGT
586         $LRSYNC -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG \
587                 -D $LRSYNC_LOG
588         check_diff $DIR/$tdir $TGT/$tdir
589         check_diff $DIR/$tdir $TGT2/$tdir
590
591         local count1=$(stat --format=%h $TGT/$tdir/link0)
592         local count2=$(stat --format=%h $TGT2/$tdir/link0)
593         if ((count1 != num_links || count2 != num_links)); then
594                 ls -l $TGT/$tdir/link0 $TGT2/$tdir/link0
595                 error "Incorrect no of hard links found $count1, $count2"
596         fi
597
598         fini_changelog
599         cleanup_src_tgt
600         return 0
601 }
602 run_test 6 "lustre_rsync large no of hard links"
603
604 # Test 7 - lustre_rsync stripesize
605 test_7() {
606     init_src
607     mkdir -p ${DIR}/tgt/$tdir
608     init_changelog
609
610     local NUMFILES=100
611     lfs setstripe -c $OSTCOUNT $DIR/$tdir
612     createmany -o $DIR/$tdir/$tfile $NUMFILES
613
614         # To simulate replication to another lustre filesystem, replicate
615         # the changes to $DIR/tgt. We can't turn off the changelogs
616         # while we are registered, so lustre_rsync better not try to
617         # replicate the replication steps.  It seems ok :)
618
619         local LRSYNC_LOG=$(generate_logname "lrsync_log")
620         $LRSYNC -s $DIR -t $DIR/tgt -m $MDT0 -u $CL_USER -l $LREPL_LOG \
621                 -D $LRSYNC_LOG
622         check_diff ${DIR}/$tdir $DIR/tgt/$tdir
623
624         local i=0
625         while [ $i -lt $NUMFILES ];
626         do
627                 local count=$(lfs getstripe $DIR/tgt/$tdir/${tfile}$i | \
628                               awk '/stripe_count/ {print $2}')
629                 if [ $count -ne $OSTCOUNT ]; then
630                         error "Stripe size not replicated"
631                 fi
632                 i=$(expr $i + 1)
633         done
634         fini_changelog
635         cleanup_src_tgt
636         return 0
637 }
638 run_test 7 "lustre_rsync stripesize"
639
640 # Test 8 - Replicate multiple file/directory moves
641 test_8() {
642     init_src
643     init_changelog
644
645     for i in 1 2 3 4 5 6 7 8 9; do
646         mkdir $DIR/$tdir/d$i
647             for j in 1 2 3 4 5 6 7 8 9; do
648                 mkdir $DIR/$tdir/d$i/d$i$j
649                 createmany -o $DIR/$tdir/d$i/d$i$j/a 10 \
650                     > /dev/null
651                 mv $DIR/$tdir/d$i/d$i$j $DIR/$tdir/d$i/d0$i$j
652                 createmany -o $DIR/$tdir/d$i/d0$i$j/b 10 \
653                     > /dev/null
654                 mv $DIR/$tdir/d$i/d0$i$j/a0 $DIR/$tdir/d$i/d0$i$j/c0
655             done
656             mv $DIR/$tdir/d$i $DIR/$tdir/d0$i
657     done
658
659         local LRSYNC_LOG=$(generate_logname "lrsync_log")
660         $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG \
661                 -D $LRSYNC_LOG
662
663         check_diff ${DIR}/$tdir $TGT/$tdir
664
665     fini_changelog
666     cleanup_src_tgt
667     return 0
668 }
669 run_test 8 "Replicate multiple file/directory moves"
670
671 test_9() {
672     init_src
673     init_changelog
674
675     mkdir $DIR/$tdir/foo
676     touch $DIR/$tdir/foo/a1
677
678         local LRSYNC_LOG=$(generate_logname "lrsync_log")
679         $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG \
680                 -D $LRSYNC_LOG
681
682         check_diff ${DIR}/$tdir $TGT/$tdir
683
684         rm -rf $DIR/$tdir/foo
685
686         $LRSYNC -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG \
687                 -D $LRSYNC_LOG
688
689         check_diff ${DIR}/$tdir $TGT/$tdir
690
691     fini_changelog
692     cleanup_src_tgt
693     return 0
694 }
695 run_test 9 "Replicate recursive directory removal"
696
697 cd $ORIG_PWD
698 complete $SECONDS
699 check_and_cleanup_lustre
700 exit_status