summaryrefslogtreecommitdiff
path: root/tests/cp/backup-is-src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-05-11 03:46:48 +0000
committerJim Meyering <jim@meyering.net>1998-05-11 03:46:48 +0000
commit20f1f8b063145e6d6ced1c444fc7739dea7ef431 (patch)
tree0913b4e91d987cc7a047ae5983afee2d3183f118 /tests/cp/backup-is-src
parent4e1e8c600d7557e3aaacb582ec7068f34c34a5a0 (diff)
downloadcoreutils-20f1f8b063145e6d6ced1c444fc7739dea7ef431.tar.xz
.
Diffstat (limited to 'tests/cp/backup-is-src')
-rwxr-xr-xtests/cp/backup-is-src42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/cp/backup-is-src b/tests/cp/backup-is-src
new file mode 100755
index 000000000..6f2aa53d7
--- /dev/null
+++ b/tests/cp/backup-is-src
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+: ${CP=cp}
+: ${RM=rm}
+
+if test "$VERBOSE" = yes; then
+ set -x
+ $CP --version
+fi
+
+framework_failure=0
+$RM -f a a~ || framework_failure=1
+: > a || framework_failure=1
+echo a > a~ || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo 'failure in testing framework'
+ exit 1
+fi
+
+# Make sure we get English translations.
+LANGUAGE=C
+export LANGUAGE
+LC_ALL=C
+export LC_ALL
+LANG=C
+export LANG
+
+# This cp command should exit nonzero.
+$CP -b -V simple a~ a > out 2>&1 && fail=1
+
+sed "s,$CP:,XXX:," out > out2
+
+cat > exp <<\EOF
+XXX: backing up `a' would destroy source; `a~' not copied
+EOF
+
+cmp out2 exp || fail=1
+
+#$RM -f $temp_files out out2 exp
+
+exit $fail