From 1623ba68891761a3a8d44acf35afeb9d4d5e8ba2 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Fri, 11 Jan 2002 07:29:53 +0000 Subject: [PATCH] Improved duplicates test: check that each file is copied once and exactly once. --- testsuite/duplicates.test | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/testsuite/duplicates.test b/testsuite/duplicates.test index 9648bd8e..4f5080d3 100644 --- a/testsuite/duplicates.test +++ b/testsuite/duplicates.test @@ -28,15 +28,26 @@ set -x fromdir="$scratchdir/from" todir="$scratchdir/to" -# TODO: Need to test whether hardlinks are possible on this OS/filesystem - mkdir "$fromdir" name1="$fromdir/name1" -name1="$fromdir/name2" +name2="$fromdir/name2" echo "This is the file" > "$name1" ln -s "$name1" "$name2" || fail "can't create symlink" -checkit "rsync -avv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" +outfile="$scratchdir/rsync.out" + +checkit "rsync -avv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \ + | tee "$outfile" + +# Make sure each file was only copied once... +if [ `grep -c '^name1$' "$outfile"` != 1 ] +then + test_fail "name1 was not copied exactly once" +fi +if [ `grep -c '^name2$' "$outfile"` != 1 ] +then + test_fail "name2 was not copied exactly once" +fi exit 0 # last [] may have failed but if we get here then we've won -- 2.34.1