From: Wayne Davison Date: Sat, 26 Mar 2022 17:00:24 +0000 (-0700) Subject: Combine some alt-dest tests. X-Git-Tag: v3.2.4pre4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a48c20c97c151e297d79327912e5c294450c342b;p=thirdparty%2Frsync.git Combine some alt-dest tests. --- diff --git a/testsuite/alt-dest.test b/testsuite/alt-dest.test index 126daedd..d2fb5a1b 100644 --- a/testsuite/alt-dest.test +++ b/testsuite/alt-dest.test @@ -5,12 +5,15 @@ # This program is distributable under the terms of the GNU GPL (see # COPYING). -# Test rsync handling of the --compare-dest option. +# Test rsync handling of --compare-dest and similar options. . "$suitedir/rsync.fns" alt1dir="$tmpdir/alt1" alt2dir="$tmpdir/alt2" +alt3dir="$tmpdir/alt3" + +SSH="$scratchdir/src/support/lsh.sh" # Build some files/dirs/links to copy @@ -20,8 +23,14 @@ hands_setup $RSYNC -av --include=text --include='*/' --exclude='*' "$fromdir/" "$alt1dir/" $RSYNC -av --include=etc-ltr-list --include='*/' --exclude='*' "$fromdir/" "$alt2dir/" +# Create a side dir where there is a candidate destfile of the same name as a sourcefile +echo "This is a test file" >"$fromdir/likely" + +mkdir "$alt3dir" +echo "This is a test file" >"$alt3dir/likely" + sleep 1 -touch "$fromdir/dir/text" +touch "$fromdir/dir/text" "$fromdir/likely" $RSYNC -av --exclude=/text --exclude=etc-ltr-list "$fromdir/" "$chkdir/" @@ -29,9 +38,31 @@ $RSYNC -av --exclude=/text --exclude=etc-ltr-list "$fromdir/" "$chkdir/" checkit "$RSYNC -avv --no-whole-file \ --compare-dest='$alt1dir' --compare-dest='$alt2dir' \ '$fromdir/' '$todir/'" "$chkdir" "$todir" + +rm -rf "$todir" checkit "$RSYNC -avv --no-whole-file \ --copy-dest='$alt1dir' --copy-dest='$alt2dir' \ '$fromdir/' '$todir/'" "$fromdir" "$todir" +# Test that copy_file() works correctly with tmpfiles +for maybe_inplace in '' --inplace; do + rm -rf "$todir" + checkit "$RSYNC -av $maybe_inplace --copy-dest='$alt3dir' \ + '$fromdir/' '$todir/'" "$fromdir" "$todir" + + for srchost in '' 'localhost:'; do + if [ -z "$srchost" ]; then + desthost='localhost:' + else + desthost='' + fi + + rm -rf "$todir" + checkit "$RSYNC -ave '$SSH' --rsync-path='$RSYNC' $maybe_inplace \ + --copy-dest='$alt3dir' '$srchost$fromdir/' '$desthost$todir/'" \ + "$fromdir" "$todir" + done +done + # The script would have aborted on error, so getting here means we've won. exit 0 diff --git a/testsuite/copy-file-inplace.test b/testsuite/copy-file-inplace.test deleted file mode 100755 index a3d124f7..00000000 --- a/testsuite/copy-file-inplace.test +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2008-2022 Wayne Davison - -# This program is distributable under the terms of the GNU GPL (see -# COPYING). - -# Test that copy_file works correctly with tmpfiles - -. "$suitedir/rsync.fns" - -SSH="$scratchdir/src/support/lsh.sh" - -hands_setup - -# Create a side dir where there is a candidate destfile of the same name as a sourcefile -cat >"$scratchdir/from/likely" <"$scratchdir/demo/likely" <"$scratchdir/from/likely" <"$scratchdir/demo/likely" <