Improved check_perms() to work with a directory, to have better
[rsync/rsync.git] / testsuite / executability.test
CommitLineData
c6fbd563
WD
1#! /bin/sh
2
3# This program is distributable under the terms of the GNU GPL see
4# COPYING).
5
6# Test the --executability or -E option. -- Matt McCutchen
7
8. $srcdir/testsuite/rsync.fns
9
10set -x
11
c6fbd563
WD
12# Put some files in the From directory
13mkdir "$fromdir"
14cat <<EOF >"$fromdir/1"
15#!/bin/sh
16echo 'Program One!'
17EOF
18cat <<EOF >"$fromdir/2"
19#!/bin/sh
20echo 'Program Two!'
21EOF
22
23chmod 700 "$fromdir/1" || test_skipped "Can't chmod"
24chmod 600 "$fromdir/2"
25
26$RSYNC -rvv "$fromdir/" "$todir/"
27
fdbe8989
WD
28check_perms "$todir/1" rwx------ || test_fail "After initial transfer: to/1 should have 700 permissions"
29check_perms "$todir/2" rw------- || test_fail "After initial transfer: to/2 should have 600 permissions"
c6fbd563
WD
30
31# Mix up the permissions a bit
32chmod 600 "$fromdir/1"
33chmod 601 "$fromdir/2"
34chmod 604 "$todir/2"
35
36$RSYNC -rvv "$fromdir/" "$todir/"
37
38# No -E, so nothing should have changed
fdbe8989
WD
39check_perms "$todir/1" rwx------ || test_fail "After update without -E: to/1 should still have 700 permissions"
40check_perms "$todir/2" rw----r-- || test_fail "After update without -E: to/2 should still have 604 permissions"
c6fbd563
WD
41
42$RSYNC -rvvE "$fromdir/" "$todir/"
43
44# Now things should have happened!
fdbe8989
WD
45check_perms "$todir/1" rw------- || test_fail "After update with -E: to/1 should now have 600 permissions"
46check_perms "$todir/2" rwx---r-x || test_fail "After update with -E: to/2 should now have 705 permissions"
c6fbd563
WD
47
48# Hooray
49exit 0