mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-08 09:18:30 +00:00
towards a test script
This commit is contained in:
parent
8ba756ade0
commit
dd2273ea20
@ -7,42 +7,50 @@ echo -e "$C1****************************************************************$C0"
|
|||||||
echo -e "$C1 Testing layer 4 default rsync with simulated data activity $C0"
|
echo -e "$C1 Testing layer 4 default rsync with simulated data activity $C0"
|
||||||
echo -e "$C1****************************************************************$C0"
|
echo -e "$C1****************************************************************$C0"
|
||||||
echo
|
echo
|
||||||
#root tmp dir
|
|
||||||
|
# root tmp dir
|
||||||
R=$(mktemp -d)
|
R=$(mktemp -d)
|
||||||
#source dir
|
# source dir
|
||||||
S=$R/source
|
S=$R/source
|
||||||
#target dir
|
# target dir
|
||||||
T=$R/target
|
T=$R/target
|
||||||
|
# logfile
|
||||||
|
L=$R/log
|
||||||
|
# pidfile
|
||||||
|
P=$R/pid
|
||||||
|
|
||||||
echo -e "$C1* using root dir for test $R$C0"
|
echo -e "$C1* using root dir for test $R$C0"
|
||||||
echo -e "$C1* populating the source$C0"
|
echo -e "$C1* populating the source$C0"
|
||||||
mkdir -p "$S"/d1/d11
|
mkdir -p "$S"/d/e
|
||||||
echo 'test' > "$S"/d1/d11/f1
|
echo 'test' > "$S"/d/e/f1
|
||||||
echo -e "$C1* starting lsyncd$C0"
|
echo -e "$C1* starting lsyncd$C0"
|
||||||
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" --verbose --no-daemon "${WORKSOURCE}" "${WORKTARGET}"&
|
# lets bash detatch Lsyncd instead of itself; lets it log stdout as well.
|
||||||
|
./lsyncd -logfile "$L" -pidfile "$P" -rsync -nodaemon "$S" "$T" &
|
||||||
echo -e "$C1* waiting for lsyncd to start$C0"
|
echo -e "$C1* waiting for lsyncd to start$C0"
|
||||||
sleep 4s
|
sleep 4s
|
||||||
|
|
||||||
# cp -r the directory
|
# cp -r the directory
|
||||||
echo -e "$CON* making a lot of data$COFF"
|
echo -e "$C1* making some data$CO"
|
||||||
for A in 1 2 3 4 5 6 7 8 9 10; do
|
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
cp -r "${WORKSOURCE}"/a "${WORKSOURCE}"/b${A}
|
cp -r "$S"/d "$S"/d${i}
|
||||||
echo 'test2' > "${WORKSOURCE}"/b${A}/a/another
|
echo 'test2' > "$S"/d${i}/e/f2
|
||||||
done
|
|
||||||
mkdir -p "${WORKSOURCE}"/c/a
|
|
||||||
echo 'test3' > "${WORKSOURCE}"/c/a/file
|
|
||||||
for A in 1 2 3 4 5 6 7 8 9 10; do
|
|
||||||
cp -r "${WORKSOURCE}"/c "${WORKSOURCE}"/d${A}
|
|
||||||
echo 'test2' > "${WORKSOURCE}"/d${A}/a/another
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "$CON* waiting for lsyncd to do the job.$COFF"
|
mkdir -p "$S"/m/n
|
||||||
|
echo 'test3' > "$S"/m/n/file
|
||||||
|
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
|
cp -r "$S"/m "$S"/m$i
|
||||||
|
echo 'test4' > "$S"/m${i}/n/another
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "$C1* waiting for lsyncd to do its job.$C0"
|
||||||
sleep 10s
|
sleep 10s
|
||||||
|
|
||||||
echo -e "$CON* killing lsyncd$COFF"
|
echo -e "$CON* killing lsyncd$COFF"
|
||||||
LSYNCPID=$(cat "${PIDFILE}")
|
PID=$(cat "$P")
|
||||||
if ! kill "${LSYNCPID}"; then
|
if ! kill "$PID"; then
|
||||||
cat "${LOGFILE}"
|
cat "$L"
|
||||||
diff -urN "${WORKSOURCE}" "${WORKTARGET}" || true
|
diff -urN "$S" "$T" || true
|
||||||
echo "kill failed"
|
echo "kill failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user