Annotation of embedaddon/rsync/testsuite/duplicates.test, revision 1.1.1.2
1.1 misho 1: #! /bin/sh
2:
3: # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
4:
5: # This program is distributable under the terms of the GNU GPL (see
6: # COPYING).
7:
8: # Test rsync handling of duplicate filenames.
9:
10: # It's quite possible that the user might specify the same source file
11: # more than once on the command line, perhaps through shell variables
12: # or wildcard expansions. It might cause problems for rsync if the
13: # same name occurred more than once in the file list, because we might
14: # be trying to update the first copy and generate checksums for the
15: # second copy at the same time. See clean_flist() for the implementation.
16:
17: # We don't need to worry about hardlinks or symlinks. Because we
18: # always rename-and-replace the new copy, they can't affect us.
19:
20: # This test is not great, because it is a timing-dependent bug.
21:
22: . "$suitedir/rsync.fns"
23:
24: # Build some hardlinks
25:
26: mkdir "$fromdir"
27: name1="$fromdir/name1"
28: name2="$fromdir/name2"
29: echo "This is the file" > "$name1"
1.1.1.2 ! misho 30: ln -s "$name1" "$name2" || test_fail "can't create symlink"
1.1 misho 31:
32: outfile="$scratchdir/rsync.out"
33:
34: checkit "$RSYNC -avv '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$todir/'" "$fromdir" "$todir" \
35: | tee "$outfile"
36:
37: # Make sure each file was only copied once...
38: if [ `grep -c '^name1$' "$outfile"` != 1 ]
39: then
40: test_fail "name1 was not copied exactly once"
41: fi
42: if [ `grep -c '^name2 -> ' "$outfile"` != 1 ]
43: then
44: test_fail "name2 was not copied exactly once"
45: fi
46:
47: # The script would have aborted on error, so getting here means we've won.
48: exit 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>