1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-06-06 17:56:21 +02:00
Files
coreutils/tests/cp/backup-1
T

41 lines
868 B
Bash
Raw Normal View History

1997-07-08 23:00:29 +00:00
#!/bin/sh
1997-07-09 18:11:59 +00:00
if test "$VERBOSE" = yes; then
set -x
cp --version
1997-07-09 18:11:59 +00:00
fi
2002-04-19 21:38:32 +00:00
pwd=`pwd`
2002-04-19 21:55:30 +00:00
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
2002-04-19 21:38:32 +00:00
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
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 21:38:32 +00:00
(exit 1); exit
fi
1997-07-08 23:00:29 +00:00
suffix=.b
2002-04-19 21:38:32 +00:00
file=b1.$$
file_backup="$file$suffix"
temp_files="$file $file_backup"
1997-07-08 23:04:58 +00:00
rm -f $temp_files
1997-07-08 23:00:29 +00:00
1997-07-08 23:04:58 +00:00
fail=0
2002-04-19 21:38:32 +00:00
echo test > $file || fail=1
1997-07-08 23:00:29 +00:00
1997-07-08 23:06:36 +00:00
# Specify both version control and suffix so the environment variables
# (possibly set by the user running these tests) aren't used.
2002-04-19 21:38:32 +00:00
cp --force --backup=simple --suffix=$suffix $file $file \
1997-07-08 23:04:58 +00:00
|| fail=1
1997-07-08 23:00:29 +00:00
2002-04-19 21:38:32 +00:00
test -f $file || fail=1
test -f $file_backup || fail=1
cmp $file $file_backup > /dev/null || fail=1
1997-07-08 23:04:58 +00:00
2002-04-19 21:38:32 +00:00
(exit $fail); exit