bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: add a test of cp --preserve=links


From: Jim Meyering
Subject: [PATCH] tests: add a test of cp --preserve=links
Date: Thu, 20 Nov 2008 10:14:45 +0100

Just add a test...
Before, we tested -L only with symlinked a and b (the primary case,
since -L makes cp dereference symlinks).
This also tests with them hard-linked.

>From 3cc091a2afe244d222156e1d62e73b3fe612b2d7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 19 Nov 2008 19:16:34 +0100
Subject: [PATCH] tests: add a test of cp --preserve=links

* tests/cp/link-preserve: Add a case and comments.
---
 tests/cp/link-preserve |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve
index 309c051..fbde3ff 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/.*,,'`
--
1.6.0.4.1021.g4320




reply via email to

[Prev in Thread] Current Thread [Next in Thread]