From: Martin Pool Date: Sat, 9 Feb 2002 07:43:13 +0000 (+0000) Subject: Add a test that --owner correctly propagates ownership of files for a X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/b0d4f4c10ed89cff36ceec26a510ac36d51dea0a Add a test that --owner correctly propagates ownership of files for a local transfer as root. --- diff --git a/testsuite/chown.test b/testsuite/chown.test new file mode 100644 index 00000000..751edbe2 --- /dev/null +++ b/testsuite/chown.test @@ -0,0 +1,38 @@ +#! /bin/sh + +# Copyright (C) 2002 by Martin Pool + +# This program is distributable under the terms of the GNU GPL (see +# COPYING). + +# Test that when rsync is running as root and has -a it correctly sets +# the ownership of the destination. + +# We don't know what users will be present on this system, so we just +# use random numeric uids and gids. + +. $srcdir/testsuite/rsync.fns + +set -x + +# Build some hardlinks + +fromdir="$scratchdir/from" +todir="$scratchdir/to" + +mkdir "$fromdir" +name1="$fromdir/name1" +name2="$fromdir/name2" +echo "This is the file" > "$name1" +echo "This is the other file" > "$name2" + +chown 5000 "$name1" || test_skipped "Can't chown" +chown 5001 "$name2" || test_skipped "Can't chown" +chgrp 5002 "$name1" || test_skipped "Can't chgrp" +chgrp 5003 "$name2" || test_skipped "Can't chgrp" + +checkit "rsync -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" + +exit 0 +# last [] may have failed but if we get here then we've won +