summaryrefslogtreecommitdiff
path: root/testsuite/executability.test
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-02-03 06:47:26 +0000
committerWayne Davison <wayned@samba.org>2006-02-03 06:47:26 +0000
commitc6fbd563d8f9b91dc871ec62fa6dbe309ff1c801 (patch)
treefa496699235d18df3083fd4b96e9133dda360326 /testsuite/executability.test
parenta5df33bb62e177ef40c84776f2ad08542c396e85 (diff)
downloadrsync-c6fbd563d8f9b91dc871ec62fa6dbe309ff1c801.tar.gz
Matt's executability test with a few tweaks (e.g. to avoid using
"stat").
Diffstat (limited to 'testsuite/executability.test')
-rw-r--r--testsuite/executability.test58
1 files changed, 58 insertions, 0 deletions
diff --git a/testsuite/executability.test b/testsuite/executability.test
new file mode 100644
index 00000000..8ea8fb5b
--- /dev/null
+++ b/testsuite/executability.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+
+# This program is distributable under the terms of the GNU GPL see
+# COPYING).
+
+# Test the --executability or -E option. -- Matt McCutchen
+
+. $srcdir/testsuite/rsync.fns
+
+set -x
+
+P600='^-rw-------'
+P604='^-rw----r--'
+P700='^-rwx------'
+P705='^-rwx---r-x'
+
+check_perms() {
+ $TOOLDIR/tls "$1" | grep "$2" >/dev/null
+}
+
+# Put some files in the From directory
+mkdir "$fromdir"
+cat <<EOF >"$fromdir/1"
+#!/bin/sh
+echo 'Program One!'
+EOF
+cat <<EOF >"$fromdir/2"
+#!/bin/sh
+echo 'Program Two!'
+EOF
+
+chmod 700 "$fromdir/1" || test_skipped "Can't chmod"
+chmod 600 "$fromdir/2"
+
+$RSYNC -rvv "$fromdir/" "$todir/"
+
+check_perms "$todir/1" $P700 || test_fail "After initial transfer: to/1 should have 700 permissions"
+check_perms "$todir/2" $P600 || test_fail "After initial transfer: to/2 should have 600 permissions"
+
+# Mix up the permissions a bit
+chmod 600 "$fromdir/1"
+chmod 601 "$fromdir/2"
+chmod 604 "$todir/2"
+
+$RSYNC -rvv "$fromdir/" "$todir/"
+
+# No -E, so nothing should have changed
+check_perms "$todir/1" $P700 || test_fail "After update without -E: to/1 should still have 700 permissions"
+check_perms "$todir/2" $P604 || test_fail "After update without -E: to/2 should still have 604 permissions"
+
+$RSYNC -rvvE "$fromdir/" "$todir/"
+
+# Now things should have happened!
+check_perms "$todir/1" $P600 || test_fail "After update with -E: to/1 should now have 600 permissions"
+check_perms "$todir/2" $P705 || test_fail "After update with -E: to/2 should now have 705 permissions"
+
+# Hooray
+exit 0