From: Wayne Davison Date: Tue, 18 May 2004 00:41:55 +0000 (+0000) Subject: - Use fromdir, todir, and tmpdir instead of FROM, TO, and TMP. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/6f481bb0e043271da3bc5683e0fbda4830546ac4 - Use fromdir, todir, and tmpdir instead of FROM, TO, and TMP. - Added chkdir. - Quote the dir expansions to avoid problems with spaces. - Added "exclude = foobar.baz" the the rsync.conf file we create. --- diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns index 396cee69..951f0b73 100644 --- a/testsuite/rsync.fns +++ b/testsuite/rsync.fns @@ -18,11 +18,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -TMP="$scratchdir" -FROM=${TMP}/from -TO=${TMP}/to -LOG=${TMP}/log -RSYNC="$rsync_bin" +tmpdir="$scratchdir" +fromdir=$tmpdir/from +todir=$tmpdir/to +chkdir=$tmpdir/chk # Berkley's nice. PATH="$PATH:/usr/ucb" @@ -37,10 +36,10 @@ runtest() { echo $ECHO_N "Test $1: $ECHO_C" if eval "$2" then - echo "${ECHO_T} done." + echo "$ECHO_T done." return 0 else - echo "${ECHO_T} failed!" + echo "$ECHO_T failed!" return 1 fi } @@ -60,16 +59,16 @@ rsync_getgroups() { #################### -# Build test directories TO and FROM, with FROM full of files. +# Build test directories $todir and $fromdir, with $fromdir full of files. hands_setup() { # Clean before creation - rm -rf $FROM - rm -rf $TO + rm -rf "$fromdir" + rm -rf "$todir" - [ -d $TMP ] || mkdir $TMP - [ -d $FROM ] || mkdir $FROM - [ -d $TO ] || mkdir $TO + [ -d $tmpdir ] || mkdir "$tmpdir" + [ -d $fromdir ] || mkdir "$fromdir" + [ -d $todir ] || mkdir "$todir" # On some BSD systems, the umask affects the mode of created # symlinks, even though the mode apparently has no effect on how @@ -82,29 +81,29 @@ hands_setup() { # the same. So, we need to set our umask before doing any creations. # set up test data - touch ${FROM}/empty - mkdir ${FROM}/emptydir + touch "$fromdir/empty" + mkdir "$fromdir/emptydir" # a hundred lines of text or so - rsync_ls_lR "${srcdir}" > ${FROM}/filelist + rsync_ls_lR "$srcdir" > "$fromdir/filelist" - # This might fail on systems that don't have -n - echo $ECHO_N "This file has no trailing lf$ECHO_C" > ${FROM}/nolf + echo $ECHO_N "This file has no trailing lf$ECHO_C" > "$fromdir/nolf" umask 0 - ln -s nolf ${FROM}/nolf-symlink + ln -s nolf "$fromdir/nolf-symlink" umask 022 - cat $srcdir/*.c > ${FROM}/text - mkdir ${FROM}/dir - cp ${FROM}/text ${FROM}/dir - mkdir ${FROM}/dir/subdir - mkdir ${FROM}/dir/subdir/subsubdir - ls -ltr /etc > ${FROM}/dir/subdir/subsubdir/etc-ltr-list - mkdir ${FROM}/dir/subdir/subsubdir2 - ls -lt /bin > ${FROM}/dir/subdir/subsubdir2/bin-lt-list + cat $srcdir/*.c > "$fromdir/text" + mkdir "$fromdir/dir" + cp "$fromdir/text" "$fromdir/dir" + mkdir "$fromdir/dir/subdir" + echo some data > "$fromdir/dir/subdir/foobar.baz" + mkdir "$fromdir/dir/subdir/subsubdir" + ls -ltr /etc > "$fromdir/dir/subdir/subsubdir/etc-ltr-list" + mkdir "$fromdir/dir/subdir/subsubdir2" + ls -lt /bin > "$fromdir/dir/subdir/subsubdir2/bin-lt-list" # echo testing head: -# ls -lR ${srcdir} | head -10 || echo failed +# ls -lR "$srcdir" | head -10 || echo failed } @@ -169,10 +168,10 @@ checkit() { echo "-------------" echo "check how the directory listings compare with diff:" echo "" - ( cd "$2" && rsync_ls_lR . ) > ${TMP}/ls-from - ( cd "$3" && rsync_ls_lR . ) > ${TMP}/ls-to - diff $diffopt ${TMP}/ls-from ${TMP}/ls-to || failed=YES - if [ -z "${failed}" ] ; then + ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from" + ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to" + diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES + if [ -z "$failed" ] ; then return 0 else return 1 @@ -189,24 +188,25 @@ build_rsyncd_conf() { pidfile="$scratchdir/rsyncd.pid" logfile="$scratchdir/rsyncd.log" - cat >$conf <"$conf" <&2 - echo "$@" > "$TMP/whyskipped" + echo "$@" > "$tmpdir/whyskipped" exit 77 }