1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-06-09 03:06:33 +02:00
Files
coreutils/tests/cp/backup-is-src
T

40 lines
772 B
Bash
Raw Normal View History

1998-05-11 03:46:48 +00:00
#!/bin/sh
if test "$VERBOSE" = yes; then
set -x
cp --version
1998-05-11 03:46:48 +00:00
fi
2002-04-19 22:36:11 +00:00
. $srcdir/../lang-default
2002-10-09 08:09:57 +00:00
. $srcdir/../envvar-check
2002-04-19 22:36:11 +00:00
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
1998-05-11 03:46:48 +00:00
framework_failure=0
2002-04-19 22:36:11 +00:00
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
1998-08-15 03:03:44 +00:00
echo a > a || framework_failure=1
echo a-tilde > a~ || framework_failure=1
1998-05-11 03:46:48 +00:00
if test $framework_failure = 1; then
2002-10-08 09:21:08 +00:00
echo "$0: failure in testing framework" 1>&2
2002-04-19 22:36:11 +00:00
(exit 1); exit
1998-05-11 03:46:48 +00:00
fi
# This cp command should exit nonzero.
cp --b=simple a~ a > out 2>&1 && fail=1
1998-05-11 03:46:48 +00:00
sed "s,cp:,XXX:," out > out2
1998-05-11 03:46:48 +00:00
cat > exp <<\EOF
XXX: backing up `a' would destroy source; `a~' not copied
EOF
cmp out2 exp || fail=1
2002-04-19 21:55:30 +00:00
(exit $fail); exit