Fixed test to work when objdir != srcdir (thanks to Art Haas).
[rsync/rsync.git] / testsuite / merge.test
... / ...
CommitLineData
1#! /bin/sh
2
3# Copyright (C) 2004 by Wayne Davison <wayned@samba.org>
4
5# This program is distributable under the terms of the GNU GPL (see
6# COPYING).
7
8# Make sure we can merge files from multiple directories into one.
9
10. "$suitedir/rsync.fns"
11
12set -x
13
14# Build some files/dirs/links to copy
15
16from1dir="${fromdir}1"
17from2dir="${fromdir}2"
18from3dir="${fromdir}3"
19
20mkdir "$from1dir" "$from2dir" "$from3dir"
21mkdir "$from2dir"/sub1 "$from3dir"/sub1
22mkdir "$from3dir"/sub2 "$from1dir"/dir-and-not-dir
23mkdir "$chkdir" "$chkdir"/sub1 "$chkdir"/sub2 "$chkdir"/dir-and-not-dir
24echo "one" >"$from1dir"/one
25cp -p "$from1dir"/one "$from2dir"/one
26cp -p "$from1dir"/one "$from3dir"/one
27echo "two" >"$from1dir"/two
28echo "three" >"$from2dir"/three
29echo "four" >"$from3dir"/four
30echo "five" >"$from1dir"/five
31echo "six" >"$from3dir"/six
32echo "sub1" >"$from2dir"/sub1/uno
33cp -p "$from2dir"/sub1/uno "$from3dir"/sub1/uno
34echo "sub2" >"$from3dir"/sub1/dos
35echo "sub3" >"$from2dir"/sub1/tres
36echo "subby" >"$from3dir"/sub2/subby
37echo "extra" >"$from1dir"/dir-and-not-dir/inside
38echo "not-dir" >"$from3dir"/dir-and-not-dir
39
40cp -p "$from1dir"/one "$from1dir"/two "$from2dir"/three "$from3dir"/four "$from1dir"/five "$from3dir"/six "$chkdir"
41cp -p "$from1dir"/dir-and-not-dir/inside "$chkdir"/dir-and-not-dir
42cp -p "$from2dir"/sub1/uno "$from3dir"/sub1/dos "$from2dir"/sub1/tres "$chkdir"/sub1
43cp -p "$from3dir"/sub2/subby "$chkdir"/sub2
44
45# Get rid of any directory-time differences
46$RSYNC -av --existing -f 'exclude,! */' "$from1dir/" "$from2dir/"
47$RSYNC -av --existing -f 'exclude,! */' "$from2dir/" "$from3dir/"
48$RSYNC -av --existing -f 'exclude,! */' "$from1dir/" "$chkdir/"
49$RSYNC -av --existing -f 'exclude,! */' "$from3dir/" "$chkdir/"
50
51checkit "$RSYNC -aHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir"
52
53# The script would have aborted on error, so getting here means we've won.
54exit 0