| 1 | #!/bin/sh |
| 2 | |
| 3 | # Copyright (C) 1998,1999 Philip Hands <phil@hands.com> |
| 4 | # |
| 5 | # This program is distributable under the terms of the GNU GPL (see COPYING) |
| 6 | # |
| 7 | # This is a simple test script that tests a few rsync |
| 8 | # features to make sure I haven't broken them before a release. |
| 9 | # |
| 10 | # |
| 11 | |
| 12 | . "$suitedir/rsync.fns" |
| 13 | |
| 14 | hands_setup |
| 15 | |
| 16 | |
| 17 | checkforlogs() { |
| 18 | # skip it if we're under debian-test |
| 19 | if test -n "${Debian}" ; then return 0 ; fi |
| 20 | |
| 21 | if [ -f $1 -a -s $1 ] ; then |
| 22 | echo "Failures have occurred. $1 follows:" >&2 |
| 23 | cat $1 >&2 |
| 24 | exit 1 |
| 25 | else |
| 26 | echo "" |
| 27 | echo "Tests Completed Successfully :-)" |
| 28 | fi |
| 29 | } |
| 30 | |
| 31 | # Main script starts here |
| 32 | |
| 33 | runtest "basic operation" 'checkit "$RSYNC -av ${FROM}/ ${TO}" ${FROM}/ ${TO}' |
| 34 | |
| 35 | ln ${FROM}/pslist ${FROM}/dir |
| 36 | runtest "hard links" 'checkit "$RSYNC -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}' |
| 37 | |
| 38 | rm ${TO}/${F1} |
| 39 | runtest "one file" 'checkit "$RSYNC -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}' |
| 40 | |
| 41 | echo "extra line" >> ${TO}/${F1} |
| 42 | runtest "extra data" 'checkit "$RSYNC -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}' |
| 43 | |
| 44 | cp ${FROM}/${F1} ${TO}/ThisShouldGo |
| 45 | runtest " --delete" 'checkit "$RSYNC --delete -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}' |
| 46 | |
| 47 | LONGDIR=${FROM}/This-is-a-directory-with-a-stupidly-long-name-created-in-an-attempt-to-provoke-an-error-found-in-2.0.11-that-should-hopefully-never-appear-again-if-this-test-does-its-job/This-is-a-directory-with-a-stupidly-long-name-created-in-an-attempt-to-provoke-an-error-found-in-2.0.11-that-should-hopefully-never-appear-again-if-this-test-does-its-job/This-is-a-directory-with-a-stupidly-long-name-created-in-an-attempt-to-provoke-an-error-found-in-2.0.11-that-should-hopefully-never-appear-again-if-this-test-does-its-job |
| 48 | mkdir -p ${LONGDIR} |
| 49 | date > ${LONGDIR}/1 |
| 50 | ls -la / > ${LONGDIR}/2 |
| 51 | runtest "long paths" 'checkit "$RSYNC --delete -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}' |
| 52 | |
| 53 | rm -rf ${TO} |
| 54 | mkdir -p ${FROM}2/dir/subdir |
| 55 | cp -a ${FROM}/dir/subdir/subsubdir ${FROM}2/dir/subdir |
| 56 | cp ${FROM}/dir/* ${FROM}2/dir || : |
| 57 | runtest "excludes" 'checkit "$RSYNC -vv -Hlrt --delete --include /dir/ --include /dir/\* --include /dir/\*/subsubdir --include /dir/\*/subsubdir/\*\* --exclude \*\* ${FROM}/dir ${TO}" ${FROM}2/ ${TO}' |
| 58 | rm -r ${FROM}2 |
| 59 | |
| 60 | checkforlogs ${LOG}.? |