3 # Copyright (C) 2001 by Martin Pool <mbp@samba.org>
5 # General-purpose test functions for rsync.
15 echo $ECHO_N "Test $1: $ECHO_C"
24 [ -d $FROM ] || mkdir
$FROM
25 [ -d $TO ] || mkdir
$TO
29 mkdir
${FROM}/emptydir
30 ps ax
> ${FROM}/pslist
32 # This might fail on systems that don't have -n
33 echo $ECHO_N "This file has no trailing lf$ECHO_C" > ${FROM}/nolf
34 ln -s nolf
${FROM}/nolf-symlink
35 cat /etc
/inittab
/etc
/services
/etc
/resolv.conf
> ${FROM}/${F1}
37 cp ${FROM}/${F1} ${FROM}/dir
38 mkdir
${FROM}/dir
/subdir
39 mkdir
${FROM}/dir
/subdir
/subsubdir
40 ls -ltr /etc
> ${FROM}/dir
/subdir
/subsubdir
/etc-ltr-list
41 mkdir
${FROM}/dir
/subdir
/subsubdir2
42 ls -lt /bin
> ${FROM}/dir
/subdir
/subsubdir
2/bin-lt-list
46 ###########################
47 # Run a test (in '$1') then compare directories $2 and $3 to see if
48 # there are any difference. If there are, explain them.
53 # the log accumulates all output; we only display it if there
56 echo "Running: \"$1\"" >${log}
58 eval "$1" >>${log} 2>&1
60 if [ $status != 0 ]; then
64 echo "-------------">>${log}
65 echo "check how the files compare with diff:">>${log}
67 diff -ur $2 $3 >>${log} 2>&1 || failed
=YES
68 echo "-------------">>${log}
69 echo "check how the directory listings compare with diff:">>${log}
71 ( cd $2 ; ls -laR ) > ${TMP}/ls-from
2>>${log}
72 ( cd $3 ; ls -laR ) > ${TMP}/ls-to
2>>${log}
73 diff -u ${TMP}/ls-from ${TMP}/ls-to >>${log} 2>&1 || failed
=YES
74 if [ -z "${failed}" ] ; then
75 echo "${ECHO_T} done."
79 echo "${ECHO_T} failed!"