summaryrefslogtreecommitdiff
path: root/tests/mv/hard-2
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-02-28 21:34:15 +0000
committerJim Meyering <jim@meyering.net>2003-02-28 21:34:15 +0000
commit1fce29ae9355f55a419cded1d4be4fd2361641a0 (patch)
treebd52b80a4c7b0cb4d27db28a443a6524c37ce150 /tests/mv/hard-2
parent4b08f97c49cd683b1c804ebff5276b5b0056f3ec (diff)
downloadcoreutils-1fce29ae9355f55a419cded1d4be4fd2361641a0.tar.xz
also test cp
Diffstat (limited to 'tests/mv/hard-2')
-rwxr-xr-xtests/mv/hard-227
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/mv/hard-2 b/tests/mv/hard-2
index 3a44e2cf9..1af8fb121 100755
--- a/tests/mv/hard-2
+++ b/tests/mv/hard-2
@@ -1,9 +1,11 @@
#!/bin/sh
# Ensure that moving hard-linked arguments onto existing destinations works.
+# Likewise when using cp --preserve=link.
if test "$VERBOSE" = yes; then
set -x
mv --version
+ cp --version
fi
. $srcdir/../envvar-check
@@ -30,6 +32,31 @@ fi
fail=0
+# ======================================
+cp --preserve=link a b c dst || fail=1
+# The source files must remain.
+test -f a || fail=1
+test -f b || fail=1
+test -f c || fail=1
+cd dst
+
+# Three destination files must exist.
+test -f a || fail=1
+test -f b || fail=1
+test -f c || fail=1
+
+# The three i-node numbers must be the same.
+ia=`ls -i a|sed 's/ a//'`
+ib=`ls -i b|sed 's/ b//'`
+ic=`ls -i c|sed 's/ c//'`
+test $ia = $ib || fail=1
+test $ia = $ic || fail=1
+
+cd ..
+rm -f dst/[abc]
+(cd dst && touch a b c)
+
+# ======================================
mv a b c dst || fail=1
# The source files must be gone.