Added the new --protocol option.
[rsync.git] / testsuite / chown.test
blob2d58b9022a45d08a874963166f39d4849f3b8307
1 #! /bin/sh
3 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
5 # This program is distributable under the terms of the GNU GPL (see
6 # COPYING).
8 # Test that when rsync is running as root and has -a it correctly sets
9 # the ownership of the destination.
11 # We don't know what users will be present on this system, so we just
12 # use random numeric uids and gids.
14 . $srcdir/testsuite/rsync.fns
16 set -x
18 # Build some hardlinks
20 fromdir="$scratchdir/from"
21 todir="$scratchdir/to"
23 mkdir "$fromdir"
24 name1="$fromdir/name1"
25 name2="$fromdir/name2"
26 echo "This is the file" > "$name1"
27 echo "This is the other file" > "$name2"
29 chown 5000 "$name1" || test_skipped "Can't chown (probably need root)"
30 chown 5001 "$name2" || test_skipped "Can't chown (probably need root)"
31 chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)"
32 chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)"
34 checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
36 exit 0
37 # last [] may have failed but if we get here then we've won