From: Martin Pool Date: Fri, 11 Jan 2002 07:09:53 +0000 (+0000) Subject: Merge ChangeSet@1.12: Add test case for -H X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/b781537597496326f3c3c20d1d5757ebc42c4f92 Merge ChangeSet@1.12: Add test case for -H --- diff --git a/testsuite/hardlinks.test b/testsuite/hardlinks.test new file mode 100644 index 00000000..5cdc78fd --- /dev/null +++ b/testsuite/hardlinks.test @@ -0,0 +1,38 @@ +#! /bin/sh + +# Copyright (C) 2002 by Martin Pool + +# 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 +