From 6558854dbe14f62cb3713da897b55b9dbaac43eb Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 9 Aug 2004 20:52:35 +0000 Subject: [PATCH] Do some simple tests with various read-only and set[ug]id files. --- testsuite/chmod-temp-dir.test | 39 +++++++++++++++++++++++++++++++++++ testsuite/chmod.test | 30 +++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 testsuite/chmod-temp-dir.test create mode 100644 testsuite/chmod.test diff --git a/testsuite/chmod-temp-dir.test b/testsuite/chmod-temp-dir.test new file mode 100644 index 00000000..9a8a9021 --- /dev/null +++ b/testsuite/chmod-temp-dir.test @@ -0,0 +1,39 @@ +#! /bin/sh + +# Copyright (C) 2004 by Wayne Davison + +# This program is distributable under the terms of the GNU GPL see +# COPYING). + +# Test that various read-only and set[ug]id permissions work properly, +# even when using a --temp-dir option (which we try to point at a +# different filesystem than the destination dir). + +. "$suitedir/rsync.fns" + +set -x + +hands_setup + +tmpdir2=/tmp +sdev=`$TOOLDIR/getfsdev $scratchdir` +tdev=`$TOOLDIR/getfsdev $tmpdir2` +if [ x$sdev = x$tdev ]; then + tmpdir2=/var/tmp + tdev=`$TOOLDIR/getfsdev $tmpdir2` + [ x$sdev = x$tdev ] && test_skipped "Can't find a tmp dir on a different file system" +fi + +chmod 440 "$fromdir/text" +chmod 500 "$fromdir/dir/text" +chmod 6450 "$fromdir/dir/subdir/foobar.baz" +chmod 2670 "$fromdir/dir/subdir/subsubdir/etc-ltr-list" + +# First a normal copy using --temp-dir. +runtest "normal copy" 'checkit "$RSYNC -avv --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"' + +# Then we update all the files using --temp-dir. +runtest "update copy" 'checkit "$RSYNC -avvI --no-whole-file --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"' + +# The script would have aborted on error, so getting here means we've won. +exit 0 diff --git a/testsuite/chmod.test b/testsuite/chmod.test new file mode 100644 index 00000000..ce46b9f0 --- /dev/null +++ b/testsuite/chmod.test @@ -0,0 +1,30 @@ +#! /bin/sh + +# Copyright (C) 2004 by Wayne Davison + +# This program is distributable under the terms of the GNU GPL see +# COPYING). + +# Test that various read-only and set[ug]id permissions work properly, +# even when using a --temp-dir option (which we try to point at a +# different filesystem than the destination dir). + +. "$suitedir/rsync.fns" + +set -x + +hands_setup + +chmod 440 "$fromdir/text" +chmod 500 "$fromdir/dir/text" +chmod 6450 "$fromdir/dir/subdir/foobar.baz" +chmod 2670 "$fromdir/dir/subdir/subsubdir/etc-ltr-list" + +# First a normal copy. +runtest "normal copy" 'checkit "$RSYNC -avv \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"' + +# Then we update all the files. +runtest "update copy" 'checkit "$RSYNC -avvI --no-whole-file \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"' + +# The script would have aborted on error, so getting here means we've won. +exit 0 -- 2.34.1