summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-04-19 22:36:03 +0000
committerJim Meyering <jim@meyering.net>2002-04-19 22:36:03 +0000
commit1a35394a57a4f7e83be41b28353b7146fe5ae64b (patch)
tree9fb715ad3d22f0cee7e282638b457c0028805d80 /tests
parent2b5e6e4835e074f6c1dcbe189035fa87dc32a5cb (diff)
downloadcoreutils-1a35394a57a4f7e83be41b28353b7146fe5ae64b.tar.xz
upgrade to use better framework
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp/cp-mv-backup29
1 files changed, 19 insertions, 10 deletions
diff --git a/tests/cp/cp-mv-backup b/tests/cp/cp-mv-backup
index 77f62fa6b..e892d29ee 100755
--- a/tests/cp/cp-mv-backup
+++ b/tests/cp/cp-mv-backup
@@ -13,17 +13,26 @@ fi
umask 022
-pwd=`pwd`
-dir=cpmvbak-$$
-actual=$dir/actual
-expected=$dir/expected
-
# Be careful to close $actual before removing the containing directory.
# Use `1>&2' rather than `1<&-' since the latter appears not to work
# with /bin/sh from powerpc-ibm-aix4.2.0.0.
-trap "cd $pwd; exec 1>&2; rm -rf $dir" 0 1 2 3 15
-mkdir $dir
+pwd=`pwd`
+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
+trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $t0 && exit $status' 0
+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
+ echo '$0: failure in testing framework' 1>&2
+ (exit 1); exit
+fi
+
+actual=actual
+expected=expected
exec 1> $actual
@@ -31,9 +40,9 @@ fail=0
for prog in cp mv; do
for initial_files in 'x' 'x y' 'x y y~' 'x y y.~1~' 'x y y~ y.~1~'; do
for opt in none off numbered t existing nil simple never; do
- ( cd $dir; touch $initial_files )
- $prog --backup=$opt $dir/x $dir/y || fail=1
- ( cd $dir; echo $initial_files $opt: `ls [xy]*`; rm -f x y y~ y.~?~ )
+ touch $initial_files
+ $prog --backup=$opt x y || fail=1
+ echo $initial_files $opt: `ls [xy]*`; rm -f x y y~ y.~?~
done
done
done