fi
}
+procs_are_stopped() {
+ local pids="$*"
+ local state
+
+ for state in $(ps -p "$pids" -o state=); do
+ if [[ "$state" != T ]]; then
+ return 1
+ fi
+ done
+
+ return 0
+}
+
+# Send SIGSTOP to PIDs and wait up to 60 seconds for them to show a
+# stopped process state.
+stop_procs() {
+ local pids="$*"
+ local end
+
+ $KILL -SIGSTOP $pids
+ end=$((SECONDS + 60))
+ while ((SECONDS < end)); do
+ if procs_are_stopped $pids; then
+ return 0
+ fi
+
+ sleep 1
+ done
+
+ return 1
+}
+
# Test 1 - test basic operations
test_1() {
init_src
test_1a() { # LU-5005
rm -rf $TGT/root-* 2> /dev/null
rm -rf $DIR/root-* 2> /dev/null
+ init_src
init_changelog
# Directory create
stat $TGT/root-dir1 && error "Dir delete not replicated"
stat $TGT/root-file4 && error "File delete not replicated"
+ cleanup_src_tgt
fini_changelog
rm -fr $TGT/root-*
rm -fr $DIR/root-*
echo PIDs: $child_pid
echo Stopping dbench
- $KILL -SIGSTOP $child_pid
+ stop_procs $child_pid
local LRSYNC_LOG=$(generate_logname "lrsync_log")
echo Starting replication
sleep 10
echo Stopping dbench
- $KILL -SIGSTOP $child_pid
+ stop_procs $child_pid
echo Starting replication
$LRSYNC -l $LREPL_LOG -D $LRSYNC_LOG
MOUNT=${DIR}/$tdir run_iozone.sh &
sleep 30
child_pid=$(pgrep iozone)
- $KILL -SIGSTOP $child_pid
+ stop_procs $child_pid
local LRSYNC_LOG=$(generate_logname "lrsync_log")
# Replicate the changes to $TGT