4 # Copyright (C) 1998 Philip Hands <http://www.hands.com/~phil/>
6 # This program is distributable under the terms of the GNU GPL (see COPYING)
8 # This is a simple test script that tests a few rsync
9 # features to make sure I haven't broken them before a release.
14 TMP=/tmp/rsync-test.$$
26 mkdir ${FROM}/emptydir
27 ps ax > ${FROM}/pslist
28 echo -n "This file has no trailing lf" > ${FROM}/nolf
29 ln -s nolf ${FROM}/nolf-symlink
30 cat /etc/inittab /etc/services /etc/resolv.conf > ${FROM}/${F1}
32 cp ${FROM}/${F1} ${FROM}/dir
35 echo -n "Test $4: $5:"
38 echo "Running: \"$1\"" >${log}
40 eval "$1 || failed=YES" >>${log} 2>&1
42 echo "-------------">>${log}
43 echo "check how the files compare with diff:">>${log}
45 diff -ur $2 $3 >>${log} || failed=YES
46 echo "-------------">>${log}
47 echo "check how the directory listings compare with diff:">>${log}
49 ls -la $2 > ${TMP}/ls-from
50 ls -la $3 > ${TMP}/ls-to
51 diff -u ${TMP}/ls-from ${TMP}/ls-to >>${log} || failed=YES
52 if [ -z "${failed}" ] ; then
64 Failures have occured.
66 You can find the output of the tests in these files:
76 echo "Tests Completed Successfully :-)"
80 # Main script starts here
82 checkit "rsync -av ${FROM}/ ${TO}" ${FROM}/ ${TO} \
85 ln ${FROM}/pslist ${FROM}/dir
86 checkit "rsync -avH ${FROM}/ ${TO}" ${FROM}/ ${TO} \
90 checkit "rsync -avH ${FROM}/ ${TO}" ${FROM}/ ${TO} \
93 echo "extra line" >> ${TO}/${F1}
94 checkit "rsync -avH ${FROM}/ ${TO}" ${FROM}/ ${TO} \
97 cp ${FROM}/${F1} ${TO}/ThisShouldGo
98 checkit "rsync --delete -avH ${FROM}/ ${TO}" ${FROM}/ ${TO} \
101 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
104 ls -la / > ${LONGDIR}/2
105 checkit "rsync --delete -avH ${FROM}/ ${TO}" ${FROM}/ ${TO} \
108 if type ssh >/dev/null ; then
110 checkit "rsync -avH -e ssh ${FROM}/ localhost:${TO}" ${FROM}/ ${TO} \
113 mv ${TO}/${F1} ${TO}/ThisShouldGo
114 checkit "rsync --delete -avH -e ssh ${FROM}/ localhost:${TO}" ${FROM}/ ${TO}\
115 8 "ssh: renamed file"
118 echo "**** Skipping SSH tests because ssh is not in the path
\a ****"
122 checkforlogs ${LOG}.?