export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
ONLY=${ONLY:-"$*"}
-[ -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" ] && \
- echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
+
+[ "$ALWAYS_EXCEPT$EXCEPT" ] &&
+ echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`"
KILL=/bin/kill
# Test 2a - Replicate files created by dbench
test_2a() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
- init_src
- init_changelog
+ init_src
+ init_changelog
- # Run dbench
- sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME || error "dbench failed!"
+ # Run dbench
+ sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME || error "dbench failed"
local LRSYNC_LOG=$(generate_logname "lrsync_log")
# Replicate the changes to $TGT
check_diff $DIR/$tdir $TGT/$tdir
check_diff $DIR/$tdir $TGT2/$tdir
- fini_changelog
- cleanup_src_tgt
- return 0
+ fini_changelog
+ cleanup_src_tgt
+ return 0
}
run_test 2a "Replicate files created by dbench."
# Test 2b - Replicate files changed by dbench.
test_2b() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
+ local child_pid
+ init_src
+ init_changelog
- init_src
- init_changelog
+ # Run dbench
+ sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME &
+ # wait for dbench to start
+ wait_for_function 'child_pid=$(pgrep dbench)' 360
+ # let dbench run for a bit
+ sleep 10
- # Run dbench
- sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME &
- sleep 20
-
- local child_pid=$(pgrep dbench)
- echo PIDs: $child_pid
- echo Stopping dbench
- $KILL -SIGSTOP $child_pid
+ echo PIDs: $child_pid
+ echo Stopping dbench
+ $KILL -SIGSTOP $child_pid
local LRSYNC_LOG=$(generate_logname "lrsync_log")
echo Starting replication
# Test 2c - Replicate files while dbench is running
test_2c() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
- init_src
- init_changelog
+ init_src
+ init_changelog
- # Run dbench
- sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME &
+ # Run dbench
+ sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME &
local LRSYNC_LOG=$(generate_logname "lrsync_log")
# Replicate the changes to $TGT
check_diff $DIR/$tdir $TGT/$tdir
check_diff $DIR/$tdir $TGT2/$tdir
- fini_changelog
- cleanup_src_tgt
- return 0
+ fini_changelog
+ cleanup_src_tgt
+ return 0
}
run_test 2c "Replicate files while dbench is running."
# Test 3a - Replicate files created by createmany
test_3a() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
+ init_src
+ init_changelog
- init_src
- init_changelog
-
- local numfiles=1000
- createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed!"
+ local numfiles=1000
+ createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed"
local LRSYNC_LOG=$(generate_logname "lrsync_log")
# Replicate the changes to $TGT
check_diff $DIR/$tdir $TGT/$tdir
check_diff $DIR/$tdir $TGT2/$tdir
- fini_changelog
- cleanup_src_tgt
- return 0
+ fini_changelog
+ cleanup_src_tgt
+ return 0
}
run_test 3a "Replicate files created by createmany"
# Test 3b - Replicate files created by writemany
test_3b() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
-
- init_src
- init_changelog
+ init_src
+ init_changelog
- local time=60
- local threads=5
- writemany -q -a $DIR/$tdir/$tfile $time $threads || error "writemany failed!"
+ local time=60
+ local threads=5
+ writemany -q -a $DIR/$tdir/$tfile $time $threads ||
+ error "writemany failed"
local LRSYNC_LOG=$(generate_logname "lrsync_log")
# Replicate the changes to $TGT
check_diff $DIR/$tdir $TGT/$tdir
check_diff $DIR/$tdir $TGT2/$tdir
- fini_changelog
- cleanup_src_tgt
- return 0
+ fini_changelog
+ cleanup_src_tgt
+ return 0
}
run_test 3b "Replicate files created by writemany"
# Test 3c - Replicate files created by createmany/unlinkmany
test_3c() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
-
- init_src
- init_changelog
+ init_src
+ init_changelog
- local numfiles=1000
- createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed!"
- unlinkmany $DIR/$tdir/$tfile $numfiles || error "unlinkmany failed!"
+ local numfiles=1000
+ createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed"
+ unlinkmany $DIR/$tdir/$tfile $numfiles || error "unlinkmany failed"
local LRSYNC_LOG=$(generate_logname "lrsync_log")
# Replicate the changes to $TGT
check_diff $DIR/$tdir $TGT/$tdir
check_diff $DIR/$tdir $TGT2/$tdir
- fini_changelog
- cleanup_src_tgt
- return 0
+ fini_changelog
+ cleanup_src_tgt
+ return 0
}
run_test 3c "Replicate files created by createmany/unlinkmany"
# Test 4 - Replicate files created by iozone
test_4() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
-
which iozone > /dev/null 2>&1
if [ $? -ne 0 ]; then
skip "iozone not found. Skipping test"
# Test 5a - Stop / start lustre_rsync
test_5a() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
-
- init_src
- init_changelog
+ init_src
+ init_changelog
- NUMTEST=2000
- createmany -o $DIR/$tdir/$tfile $NUMTEST
+ NUMTEST=2000
+ createmany -o $DIR/$tdir/$tfile $NUMTEST
# Replicate the changes to $TGT
local LRSYNC_LOG=$(generate_logname "lrsync_log")
check_diff $DIR/$tdir $TGT/$tdir
check_diff $DIR/$tdir $TGT2/$tdir
- fini_changelog
- cleanup_src_tgt
- return 0
+ fini_changelog
+ cleanup_src_tgt
+ return 0
}
run_test 5a "Stop / start lustre_rsync"
# Test 5b - Kill / restart lustre_rsync
test_5b() {
- [ "$SLOW" = "no" ] && skip "Skipping slow test" && return
+ init_src
+ init_changelog
- init_src
- init_changelog
-
- NUMTEST=2000
- createmany -o $DIR/$tdir/$tfile $NUMTEST
+ NUMTEST=2000
+ createmany -o $DIR/$tdir/$tfile $NUMTEST
# Replicate the changes to $TGT
local LRSYNC_LOG=$(generate_logname "lrsync_log")
check_diff $DIR/$tdir $TGT/$tdir
check_diff $DIR/$tdir $TGT2/$tdir
- fini_changelog
- cleanup_src_tgt
- return 0
+ fini_changelog
+ cleanup_src_tgt
+ return 0
}
run_test 5b "Kill / restart lustre_rsync"
run_test 9 "Replicate recursive directory removal"
cd $ORIG_PWD
-complete $(basename $0) $SECONDS
+complete $SECONDS
check_and_cleanup_lustre
exit_status