Allow $RSYNC_TEST_TMP to indicate a good tmp dir for our tests.
[rsync/rsync.git] / testsuite / chmod-temp-dir.test
index 9a8a902..0768f18 100644 (file)
@@ -2,7 +2,7 @@
 
 # Copyright (C) 2004 by Wayne Davison <wayned@samba.org>
 
 
 # Copyright (C) 2004 by Wayne Davison <wayned@samba.org>
 
-# This program is distributable under the terms of the GNU GPL see
+# 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,
 # COPYING).
 
 # Test that various read-only and set[ug]id permissions work properly,
 
 . "$suitedir/rsync.fns"
 
 
 . "$suitedir/rsync.fns"
 
-set -x
-
 hands_setup
 
 hands_setup
 
-tmpdir2=/tmp
+tmpdir2=$RSYNC_TEST_TMP
+if [ x"$tmpdir2" = x ]; then
+    tmpdir2=/tmp
+fi
 sdev=`$TOOLDIR/getfsdev $scratchdir`
 tdev=`$TOOLDIR/getfsdev $tmpdir2`
 if [ x$sdev = x$tdev ]; then
 sdev=`$TOOLDIR/getfsdev $scratchdir`
 tdev=`$TOOLDIR/getfsdev $tmpdir2`
 if [ x$sdev = x$tdev ]; then
@@ -26,13 +27,15 @@ fi
 
 chmod 440 "$fromdir/text"
 chmod 500 "$fromdir/dir/text"
 
 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"
+e="$fromdir/dir/subdir/foobar.baz"
+chmod 6450 "$e" || chmod 2450 "$e" || chmod 1450 "$e" || chmod 450 "$e"
+e="$fromdir/dir/subdir/subsubdir/etc-ltr-list"
+chmod 2670 "$e" || chmod 1670 "$e" || chmod 670 "$e"
 
 
-# First a normal copy using --temp-dir.
+# First a normal copy.
 runtest "normal copy" 'checkit "$RSYNC -avv --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"'
 
 runtest "normal copy" 'checkit "$RSYNC -avv --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"'
 
-# Then we update all the files using --temp-dir.
+# Then we update all the files.
 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.
 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.