summaryrefslogtreecommitdiff
path: root/tests/cp/link-preserve
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-10-13 20:44:59 +0000
committerJim Meyering <jim@meyering.net>2001-10-13 20:44:59 +0000
commit8f28cc87080b70d087a378891b884382e6baf58b (patch)
tree058e275da58b54ae1afa7f0a3e99fe309c6ec800 /tests/cp/link-preserve
parent0dc71387d44cac57c0a77d484a94be8cbb183397 (diff)
downloadcoreutils-8f28cc87080b70d087a378891b884382e6baf58b.tar.xz
add tests for some of the recent changes to cp
Diffstat (limited to 'tests/cp/link-preserve')
-rwxr-xr-xtests/cp/link-preserve50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve
index b818833d6..53db11f5a 100755
--- a/tests/cp/link-preserve
+++ b/tests/cp/link-preserve
@@ -1,5 +1,6 @@
#!/bin/sh
# ensure that `cp -d' preserves hard-links between command line arguments
+# ensure that --preserve=links works with -RH and -RL
if test "$VERBOSE" = yes; then
set -x
@@ -33,7 +34,56 @@ fail=0
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
+# --------------------------------------
+
+rm -rf a b c
+touch a
+ln -s a b
+mkdir c
+cp --preserve=links -R -H a b 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
+# --------------------------------------
+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
+# --------------------------------------
+
+# Ensure that --no-preserve=links works.
+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/.*,,'`
+test "$a_inode" = "$b_inode" && fail=1
+# --------------------------------------
+
+# Ensure that -d still preserves hard links.
+rm -rf a b c d
+touch a; ln a b
+mkdir c
+cp -d a b 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
+# --------------------------------------
+
+# Ensure that --no-preserve=mode works
+rm -rf a b c d
+touch a; chmod 400 a
+umask 777
+cp -a --no-preserve=mode a b
+set _ `ls -l b`; shift; mode=$1
+test "$mode" = "----------" || fail=1
+umask 022
+# --------------------------------------
(exit $fail); exit