summaryrefslogtreecommitdiff
path: root/tests/cp/same-file
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-09-04 16:56:09 +0000
committerJim Meyering <jim@meyering.net>2000-09-04 16:56:09 +0000
commitdaaa56f9854c871d6a45805f611b9c98a1cdb690 (patch)
treeca46e9386a2950695d2d82a05cd5db863cf6056f /tests/cp/same-file
parent143be7ea2dfe0eda9798ecaa856faad8ce4c6e23 (diff)
downloadcoreutils-daaa56f9854c871d6a45805f611b9c98a1cdb690.tar.xz
Add new tests using cp's --rem option.
Reflect the fact that cp's -f option no longer causes cp to remove the destination file before trying to open it. Reflect the fact that `cp -bdl' now makes a backup when copying a symlink onto the file it points to (FIXME: look into this, and why cp -bl does *not* do so).
Diffstat (limited to 'tests/cp/same-file')
-rwxr-xr-xtests/cp/same-file29
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/cp/same-file b/tests/cp/same-file
index 534875eda..24f9508d0 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -35,7 +35,7 @@ exec 1> $actual
contents=XYZ
for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2' 'foo hardlink'; do
- for options in '' -d -f -df -b -bd -bf -bdf \
+ for options in '' -d -f -df --rem -b -bd -bf -bdf \
-l -dl -fl -dfl -bl -bdl -bfl -bdfl; do
case $args$options in
# These tests are not portable.
@@ -94,8 +94,9 @@ done
cat <<\EOF > $expected
1 [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
1 -d [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
-0 -f (foo symlink)
-0 -df (foo symlink)
+1 -f [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
+1 -df [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
+0 --rem (foo symlink)
0 -b (foo symlink symlink.~1~ -> foo)
0 -bd (foo symlink symlink.~1~ -> foo)
0 -bf (foo symlink symlink.~1~ -> foo)
@@ -103,7 +104,7 @@ cat <<\EOF > $expected
0 -l (foo symlink -> foo)
0 -dl (foo symlink -> foo)
0 -fl (foo symlink -> foo)
-0 -dfl (foo symlink)
+0 -dfl (foo symlink -> foo)
0 -bl (foo symlink -> foo)
0 -bdl (foo symlink symlink.~1~ -> foo)
0 -bfl (foo symlink -> foo)
@@ -111,8 +112,9 @@ cat <<\EOF > $expected
1 [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
1 -d [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
-1 -f [cp: `symlink' and `foo' are the same file] (symlink -> foo) symlink-loop symlink-loop
-0 -df (foo -> foo symlink -> foo) symlink-loop symlink-loop
+1 -f [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
+1 -df [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
+1 --rem [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
1 -b [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
0 -bd (foo -> foo foo.~1~ symlink -> foo) symlink-loop symlink-loop
1 -bf [cp: `symlink' and `foo' are the same file] (foo symlink -> foo)
@@ -121,13 +123,14 @@ cat <<\EOF > $expected
0 -dl (foo symlink -> foo)
0 -fl (foo symlink -> foo)
0 -bl (foo symlink -> foo)
-0 -bdl (foo symlink -> foo)
+0 -bdl (foo -> foo foo.~1~ symlink -> foo) symlink-loop symlink-loop
0 -bfl (foo symlink -> foo)
1 [cp: `foo' and `foo' are the same file] (foo)
1 -d [cp: `foo' and `foo' are the same file] (foo)
1 -f [cp: `foo' and `foo' are the same file] (foo)
1 -df [cp: `foo' and `foo' are the same file] (foo)
+1 --rem [cp: `foo' and `foo' are the same file] (foo)
1 -b [cp: `foo' and `foo' are the same file] (foo)
1 -bd [cp: `foo' and `foo' are the same file] (foo)
0 -bf (foo foo.~1~)
@@ -142,23 +145,25 @@ cat <<\EOF > $expected
0 -bdfl (foo foo.~1~)
1 [cp: `sl1' and `sl2' are the same file] (foo sl1 -> foo sl2 -> foo)
-1 -d [cp: cannot create symbolic link `sl2': File exists] (foo sl1 -> foo sl2 -> foo)
-0 -f (foo sl1 -> foo sl2)
+0 -d (foo sl1 -> foo sl2 -> foo)
+1 -f [cp: `sl1' and `sl2' are the same file] (foo sl1 -> foo sl2 -> foo)
0 -df (foo sl1 -> foo sl2 -> foo)
+0 --rem (foo sl1 -> foo sl2)
0 -b (foo sl1 -> foo sl2 sl2.~1~ -> foo)
0 -bd (foo sl1 -> foo sl2 -> foo sl2.~1~ -> foo)
0 -bf (foo sl1 -> foo sl2 sl2.~1~ -> foo)
0 -bdf (foo sl1 -> foo sl2 -> foo sl2.~1~ -> foo)
0 -l (foo sl1 -> foo sl2 -> foo)
-1 -dl [cp: cannot create link `sl2': File exists] (foo sl1 -> foo sl2 -> foo)
+0 -dl (foo sl1 -> foo sl2 -> foo)
0 -fl (foo sl1 -> foo sl2 -> foo)
0 -bl (foo sl1 -> foo sl2 -> foo)
0 -bfl (foo sl1 -> foo sl2 -> foo)
1 [cp: `foo' and `hardlink' are the same file] (foo hardlink)
1 -d [cp: `foo' and `hardlink' are the same file] (foo hardlink)
-0 -f (foo hardlink)
-0 -df (foo hardlink)
+1 -f [cp: `foo' and `hardlink' are the same file] (foo hardlink)
+1 -df [cp: `foo' and `hardlink' are the same file] (foo hardlink)
+0 --rem (foo hardlink)
0 -b (foo hardlink hardlink.~1~)
0 -bd (foo hardlink hardlink.~1~)
0 -bf (foo hardlink hardlink.~1~)