Merge ChangeSet@1.12: Add test case for -H
authorMartin Pool <mbp@samba.org>
Fri, 11 Jan 2002 07:09:53 +0000 (07:09 +0000)
committerMartin Pool <mbp@samba.org>
Fri, 11 Jan 2002 07:09:53 +0000 (07:09 +0000)
testsuite/hardlinks.test [new file with mode: 0644]

diff --git a/testsuite/hardlinks.test b/testsuite/hardlinks.test
new file mode 100644 (file)
index 0000000..5cdc78f
--- /dev/null
@@ -0,0 +1,38 @@
+#! /bin/sh
+
+# Copyright (C) 2002 by Martin Pool <mbp@samba.org>
+
+# This program is distributable under the terms of the GNU GPL (see
+# COPYING).
+
+# Test rsync handling of hardlinks.  By default (in 2.5.1) rsync does
+# not detect symlinks and they get split into different files.  If you
+# specify -H, then hard links are detected and recreated as hardlinks
+# on the other end.
+
+. $srcdir/testsuite/rsync.fns
+
+set -x
+
+# Build some hardlinks
+
+fromdir="$scratchdir/from"
+todir="$scratchdir/to"
+
+# TODO: Need to test whether hardlinks are possible on this OS/filesystem
+
+mkdir "$fromdir"
+name1="$fromdir/name1"
+name2="$fromdir/name2"
+name3="$fromdir/name3"
+name4="$fromdir/name4"
+echo "This is the file" > "$name1"
+ln "$name1" "$name2" || fail "Can't create hardlink"
+ln "$name2" "$name3" || fail "Can't create hardlink"
+cp "$name2" "$name4" || fail "Can't copy file"
+
+checkit "rsync -aH \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
+
+exit 0
+# last [] may have failed but if we get here then we've won
+