summaryrefslogtreecommitdiff
path: root/tests/cp/link-preserve
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-11-19 19:16:34 +0100
committerJim Meyering <meyering@redhat.com>2008-11-20 10:21:52 +0100
commit1760ade090cbf8c854c1033399d51ff4fdde3ae0 (patch)
treef05432b3add3d55c80c86f202b4e274fbec3cf43 /tests/cp/link-preserve
parented017d44b205bdf74368c2ee5e414553944608c0 (diff)
downloadcoreutils-1760ade090cbf8c854c1033399d51ff4fdde3ae0.tar.xz
tests: add a test of cp --preserve=links
* tests/cp/link-preserve: Add a case and comments.
Diffstat (limited to 'tests/cp/link-preserve')
-rwxr-xr-xtests/cp/link-preserve18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve
index 309c05121..fbde3ffe7 100755
--- a/tests/cp/link-preserve
+++ b/tests/cp/link-preserve
@@ -48,9 +48,17 @@ b_inode=`ls -i c/b|sed 's,c/.*,,'`
test "$a_inode" = "$b_inode" || fail=1
# --------------------------------------
-rm -rf a b c d
-mkdir d
-(cd d; touch a; ln -s a b)
+# Ensure that -L makes cp follow the b->a symlink
+# and translates to hard-linked a and b in the destination dir.
+rm -rf a b c d; mkdir d; (cd d; touch a; ln -s a b)
+cp --preserve=links -R -L d c
+a_inode=`ls -i c/a|sed 's,c/.*,,'`
+b_inode=`ls -i c/b|sed 's,c/.*,,'`
+test "$a_inode" = "$b_inode" || fail=1
+# --------------------------------------
+
+# Same as above, but starting with a/b hard linked.
+rm -rf a b c d; mkdir d; (cd d; touch a; ln a b)
cp --preserve=links -R -L d c
a_inode=`ls -i c/a|sed 's,c/.*,,'`
b_inode=`ls -i c/b|sed 's,c/.*,,'`
@@ -58,9 +66,7 @@ test "$a_inode" = "$b_inode" || fail=1
# --------------------------------------
# Ensure that --no-preserve=links works.
-rm -rf a b c d
-mkdir d
-(cd d; touch a; ln a b)
+rm -rf a b c d; mkdir d; (cd d; touch a; ln a b)
cp -dR --no-preserve=links d c
a_inode=`ls -i c/a|sed 's,c/.*,,'`
b_inode=`ls -i c/b|sed 's,c/.*,,'`