summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-06-27 20:33:22 +0000
committerJim Meyering <jim@meyering.net>1998-06-27 20:33:22 +0000
commita3e1200b4a0764f5693894433750a93e34a8866e (patch)
treeb562e4f328054185bd2bf1083ef88a2d76e5155a /tests
parent2b2424aab83161b552f8ba6f05eab4b0bd4c7dae (diff)
downloadcoreutils-a3e1200b4a0764f5693894433750a93e34a8866e.tar.xz
*** empty log message ***
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp/same-file14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/cp/same-file b/tests/cp/same-file
index 981f0768c..e8e303214 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -1,4 +1,8 @@
#!/bin/sh
+# Test some of cp's options and how cp handles situations in
+# which a naive implementation might overwrite the source file.
+
+: ${CP=cp}
LANGUAGE=C; export LANGUAGE
LANG=C; export LANG
@@ -26,14 +30,18 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2'; do
case "$args" in *sl2*) ln -s foo sl2;; esac
(
(
- cp $options $args 2>.err
+ $CP $options $args 2>.err
echo $?
- test -s .err && echo "[`cat .err`]"
+
+ # Normalize the program name in the error output,
+ # 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/^..............................................//'
+ # Make sure the original is unchanged and that
+ # the destination is a copy.
for f in $args; do
if test -f $f; then
- # make sure the file was copied.
case "`cat $f`" in
"$contents") ;;
*) echo cp FAILED;;