summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-06-27 21:03:16 +0000
committerJim Meyering <jim@meyering.net>1998-06-27 21:03:16 +0000
commit4ec1fad4e76ed3c188736cdbb88c06563f9f01a4 (patch)
treecb13410cb6c3384d1898799d341604eb896f8923 /tests
parent9d9fef5595fe51e5364d28a7d5259dc28c4bcc1a (diff)
downloadcoreutils-4ec1fad4e76ed3c188736cdbb88c06563f9f01a4.tar.xz
*** empty log message ***
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp/same-file61
1 files changed, 35 insertions, 26 deletions
diff --git a/tests/cp/same-file b/tests/cp/same-file
index a1f9bde34..597bfa4d4 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -24,13 +24,14 @@ trap "cd $pwd; rm -rf $actual $expected dir" 0 1 2 3 15
exec 1> $actual
contents=XYZ
-for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2'; do
+for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2' 'foo hardlink'; do
for options in '' -b -d -bd -bdf; do
rm -rf dir
mkdir dir
cd dir
echo $contents > foo
case "$args" in *symlink*) ln -s foo symlink ;; esac
+ case "$args" in *hardlink*) ln foo hardlink ;; esac
case "$args" in *sl1*) ln -s foo sl1;; esac
case "$args" in *sl2*) ln -s foo sl2;; esac
(
@@ -42,7 +43,9 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2'; do
# and put brackets around the output.
test -s .err && echo "[`sed 's/^[^:][^:]*:/cp:/' .err`]"
# Strip off all but the file names.
- ls -lG * | sed 's/^..............................................//'
+ ls="`ls -lG * \
+ | sed 's/^..............................................//'`"
+ echo "($ls)"
# Make sure the original is unchanged and that
# the destination is a copy.
for f in $args; do
@@ -64,30 +67,36 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2'; do
done
cat <<\EOF > $expected
-1 [cp: `foo' and `symlink' are the same file] foo symlink -> foo
-0 foo symlink symlink.~1~ -> foo
-1 [cp: `foo' and `symlink' are the same file] foo symlink -> foo
-0 foo symlink symlink.~1~ -> foo
-0 foo symlink symlink.~1~ -> foo
-
-1 [cp: `symlink' and `foo' are the same file] foo symlink -> foo
-1 [cp: `symlink' and `foo' are the same file] foo symlink -> foo
-1 [cp: `symlink' and `foo' are the same file] foo symlink -> foo
-0 foo -> foo foo.~1~ symlink -> foo symlink-loop symlink-loop
-0 foo -> foo foo.~1~ symlink -> foo symlink-loop symlink-loop
-
-1 [cp: `foo' and `foo' are the same file] foo
-1 [cp: `foo' and `foo' are the same file] foo
-1 [cp: `foo' and `foo' are the same file] foo
-1 [cp: `foo' and `foo' are the same file] foo
-0 foo foo.~1~
-
-1 [cp: `sl1' and `sl2' are the same file] foo sl1 -> foo sl2 -> foo
-0 foo sl1 -> foo sl2 sl2.~1~ -> foo
-1 [cp: `sl1' and `sl2' are the same file] foo sl1 -> foo sl2 -> foo
-0 foo sl1 -> foo sl2 -> foo sl2.~1~ -> foo
-0 foo sl1 -> foo sl2 -> foo sl2.~1~ -> foo
+1 [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
+0 (foo symlink symlink.~1~ -> foo)
+1 [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
+0 (foo symlink symlink.~1~ -> foo)
+0 (foo symlink symlink.~1~ -> foo)
+
+1 [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
+1 [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
+1 [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
+0 (foo -> foo foo.~1~ symlink -> foo) symlink-loop symlink-loop
+0 (foo -> foo foo.~1~ symlink -> foo) symlink-loop symlink-loop
+
+1 [cp: `foo' and `foo' are the same file] (foo)
+1 [cp: `foo' and `foo' are the same file] (foo)
+1 [cp: `foo' and `foo' are the same file] (foo)
+1 [cp: `foo' and `foo' are the same file] (foo)
+0 (foo foo.~1~)
+
+1 [cp: `sl1' and `sl2' are the same file] (foo sl1 -> foo sl2 -> foo)
+0 (foo sl1 -> foo sl2 sl2.~1~ -> foo)
+1 [cp: `sl1' and `sl2' are the same file] (foo sl1 -> foo sl2 -> foo)
+0 (foo sl1 -> foo sl2 -> foo sl2.~1~ -> foo)
+0 (foo sl1 -> foo sl2 -> foo sl2.~1~ -> foo)
+
+1 [cp: `foo' and `hardlink' are the same file] (foo hardlink)
+0 (foo hardlink hardlink.~1~)
+1 [cp: `foo' and `hardlink' are the same file] (foo hardlink)
+0 (foo hardlink hardlink.~1~)
+0 (foo hardlink hardlink.~1~)
EOF
-cmp $expected $actual || cat $actual 1>&2
+cmp $expected $actual || diff -u $expected $actual 1>&2