adapted tests

This commit is contained in:
Axel Kittenberger 2010-05-22 16:24:16 +00:00
parent 23444c6f7a
commit 58813b527f
3 changed files with 18 additions and 9 deletions

View File

@ -14,7 +14,7 @@ echo 'test' > "${WORKSOURCE}"/a/a/file
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" "${WORKSOURCE}" "${WORKTARGET}"
# try to wait until lsyncd starts and rsyncs initial file, hope 1s is enough.
# try to wait until lsyncd starts and rsyncs initial file, hope 4s is enough.
sleep 4s
# cp -r the directory, this sometimes succeeds, sometimes fails.

View File

@ -8,6 +8,9 @@ WORKTARGET=$(mktemp -d)
PIDFILE=$(mktemp)
LOGFILE=$(mktemp)
echo $WORKSOURCE
echo $WORKTARGET
echo $PIDFILE
# populate the filesystem.
mkdir "${WORKSOURCE}"/a
@ -15,22 +18,28 @@ mkdir "${WORKSOURCE}"/b
touch "${WORKSOURCE}"/a/f
touch "${WORKSOURCE}"/b/g
echo ./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" "${WORKSOURCE}" "${WORKTARGET}"
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" "${WORKSOURCE}" "${WORKTARGET}"
LSYNCPID=$(cat "${PIDFILE}")
# try to wait until lsyncd starts and rsyncs initial file, hope 1s is enough.
# try to wait until lsyncd starts and rsyncs initial file, hope 2s is enough.
sleep 2s
# move a file
echo "moving a directory"
mv "${WORKSOURCE}"/a "${WORKSOURCE}"/c
echo "create a file there"
touch "${WORKSOURCE}"/c/h
echo "and delete a directory"
#lsyncd 1.0 dies here
rm -r "${WORKSOURCE}"/b
echo "wait for events to trigger"
# try to wait until lsyncd does the job.
sleep 2s
sleep 10s
echo "killing daemon"
LSYNCPID=$(cat "${PIDFILE}")
if ! kill "${LSYNCPID}"; then
cat "${LOGFILE}"
diff -ur "${WORKSOURCE}" "${WORKTARGET}" || true
@ -46,7 +55,7 @@ cat "${LOGFILE}"
diff -ur "${WORKSOURCE}" "${WORKTARGET}"
rm "${PIDFILE}"
rm "${LOGFILE}"
rm -rf "${WORKTARGET}"
rm -rf "${WORKSOURCE}"
#rm "${PIDFILE}"
#rm "${LOGFILE}"
#rm -rf "${WORKTARGET}"
#rm -rf "${WORKSOURCE}"

View File

@ -6,7 +6,7 @@
# message
WORKTARGET=$(mktemp -d)
if [[ $( ./lsyncd --logfile /nonexisting/path/name . "${WORKTARGET}" 2>&1 ) =~ "cannot open logfile [/nonexisting/path/name]!" ]]; then
if [[ $( ./lsyncd --logfile /nonexisting/path/name . "${WORKTARGET}" 2>&1 ) == "cannot open logfile [/nonexisting/path/name]!" ]]; then
rmdir "${WORKTARGET}"
exit 0;
else