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