Add a test that when none of -l, -L, -a are specified symlinks are not
authorMartin Pool <mbp@samba.org>
Fri, 14 Dec 2001 02:01:46 +0000 (02:01 +0000)
committerMartin Pool <mbp@samba.org>
Fri, 14 Dec 2001 02:01:46 +0000 (02:01 +0000)
copied at all.

testsuite/rsync.fns
testsuite/symlink-ignore.test [new file with mode: 0644]

index cf22a97..cc179bb 100644 (file)
@@ -210,5 +210,20 @@ EOF
 }
 
 
+build_symlinks() {
+    fromdir="$scratchdir/from"
+    todir="$scratchdir/to"
+    mkdir "$fromdir"
+    date >"$fromdir/referent"
+    ln -s referent "$fromdir/relative"
+    ln -s "$fromdir/referent" "$fromdir/absolute"
+    ln -s nonexistent "$fromdir/dangling"
+}
+
+test_fail() {
+    echo "$@" >&2
+    exit 1
+}
+
 # be reproducible
 umask 077
\ No newline at end of file
diff --git a/testsuite/symlink-ignore.test b/testsuite/symlink-ignore.test
new file mode 100644 (file)
index 0000000..549e74c
--- /dev/null
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+# Copyright (C) 2001 by Martin Pool <mbp@samba.org>
+
+# This program is distributable under the terms of the GNU GPL (see
+# COPYING).
+
+# Test rsync's somewhat over-featured symlink control: the default
+# behaviour is that symlinks should not be copied at all.
+
+. $srcdir/testsuite/rsync.fns
+
+build_symlinks
+
+# Copy recursively, but without -l or -L or -a, and all the symlinks
+# should be missing.
+"$rsync_bin" -r "$fromdir/" "$todir" || test_fail "rsync returned $?"
+
+[ -e $todir/referent ] || test_fail "referent was not copied"
+[ -e $todir/from ] && test_fail "extra level of directories"
+[ -e $todir/dangling ] && test_fail "dangling symlink was copied"
+[ -e $todir/relative ] && test_fail "relative symlink was copied"
+[ -e $todir/absolute ] && test_fail "absolute symlink was copied"
+
+true # cool