From 83a8ca7b14483826c85f7cc0e0e38ed9ce387d83 Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Tue, 18 Mar 2008 22:16:41 -0400 Subject: Unsnarl missing_below/dry_run logic. The generator can skip a directory's contents altogether due to --ignore-non-existing, a daemon exclude, or a mkdir failure. On a --dry-run, the generator can also note the missingness of a directory while still scanning its contents. These two scenarios were conflated using a single set of missing_below/missing_dir variables in combination with transient increments in dry_run; this caused at least three bugs. Now recv_generator has separate variables for the two scenarios, called skip_dir and dry_missing_dir, respectively. For simplicity, we take the F_DEPTH instead of having separate *_below variables. We mark both kinds of missing dirs with FLAG_MISSING_DIR. (dry_run > 1) iff the *root* of the destination does not exist; it is no longer incremented for missing subdirs. I added tests for the three fixed bugs in missing.test. --- testsuite/missing.test | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 testsuite/missing.test (limited to 'testsuite/missing.test') diff --git a/testsuite/missing.test b/testsuite/missing.test new file mode 100644 index 00000000..705050b4 --- /dev/null +++ b/testsuite/missing.test @@ -0,0 +1,28 @@ +#! /bin/sh + +# This program is distributable under the terms of the GNU GPL (see +# COPYING). + +# Test three bugs fixed by my redoing of the missing_below logic. + +. $srcdir/testsuite/rsync.fns + +mkdir "$fromdir" "$todir" +mkdir "$fromdir/subdir" +echo data >"$fromdir/subdir/file" +echo data >"$todir/other" + +# Test 1: Too much "not creating new..." output on a dry run +$RSYNC -n -r --ignore-non-existing -vv "$fromdir/" "$todir/" | tee "$scratchdir/out" +if grep 'not creating new.*subdir/file' "$scratchdir/out" >/dev/null; then + test_fail 'test 1 failed' +fi + +# Test 2: Attempt to make a fuzzy dirlist for a dir not created on a dry run +$RSYNC -n -r -R --no-implied-dirs -y "$fromdir/./subdir/file" "$todir/" \ + || test_fail 'test 2 failed' + +# Test 3: --delete-after pass skipped when last dir is dry-missing +$RSYNC -n -r --delete-after -i "$fromdir/" "$todir/" | tee "$scratchdir/out" +grep '^\*deleting other' "$scratchdir/out" >/dev/null \ + || test_fail 'test 3 failed' -- cgit v1.2.1