Fixed an "Internal abbrev error" when dealing with an xattr value
[rsync/rsync.git] / testsuite / duplicates.test
index 9648bd8..3b4ebab 100644 (file)
@@ -2,7 +2,7 @@
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
-# This program is distributable under the terms of the GNU GPL see
+# This program is distributable under the terms of the GNU GPL (see
 # COPYING).
 
 # Test rsync handling of duplicate filenames.  
 
 # This test is not great, because it is a timing-dependent bug.
 
-. $srcdir/testsuite/rsync.fns
-
-set -x
+. "$suitedir/rsync.fns"
 
 # Build some hardlinks
 
-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"
 
-exit 0
-# last [] may have failed but if we get here then we've won
+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
 
+# The script would have aborted on error, so getting here means we've won.
+exit 0