summaryrefslogtreecommitdiff
path: root/testsuite/merge.test
blob: 73b2b82d37c97578ae6a7d6c21bcab9cfa18dbe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/sh

# Copyright (C) 2004 by Wayne Davison <wayned@samba.org>

# This program is distributable under the terms of the GNU GPL (see
# COPYING).

# Make sure we can merge files from multiple directories into one.

. $srcdir/testsuite/rsync.fns

set -x

# Build some files/dirs/links to copy

fromdir="$scratchdir/from"
from1dir="${fromdir}1"
from2dir="${fromdir}2"
from3dir="${fromdir}3"
todir="$scratchdir/to"
chkdir="$scratchdir/chk"

mkdir "$from1dir" "$from2dir" "$from3dir"
mkdir "$from2dir"/sub1 "$from3dir"/sub1
mkdir "$from3dir"/sub2
mkdir "$chkdir" "$chkdir"/sub1 "$chkdir"/sub2
echo "one" >"$from1dir"/one
cp -p "$from1dir"/one "$from2dir"/one
cp -p "$from1dir"/one "$from3dir"/one
echo "two" >"$from1dir"/two
echo "three" >"$from2dir"/three
echo "four" >"$from3dir"/four
echo "five" >"$from1dir"/five
echo "six" >"$from3dir"/six
echo "sub1" >"$from2dir"/sub1/uno
cp -p "$from2dir"/sub1/uno "$from3dir"/sub1/uno
echo "sub2" >"$from3dir"/sub1/dos
echo "sub3" >"$from2dir"/sub1/tres
echo "subby" >"$from3dir"/sub2/subby

cp -p "$from1dir"/one "$from1dir"/two "$from2dir"/three "$from3dir"/four "$from1dir"/five "$from3dir"/six "$chkdir"
cp -p "$from2dir"/sub1/uno "$from3dir"/sub1/dos "$from2dir"/sub1/tres "$chkdir"/sub1
cp -p "$from3dir"/sub2/subby "$chkdir"/sub2

# Get rid of any directory-time differences
touch "$fromdir"? "$chkdir" "$fromdir"?/sub? "$chkdir"/sub?

checkit "$RSYNC -aHvv \"$fromdir\"?/ \"$todir/\"" "$chkdir" "$todir"

# The script would have aborted on error, so getting here means we've won.
exit 0