summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-04-19 21:55:30 +0000
committerJim Meyering <jim@meyering.net>2002-04-19 21:55:30 +0000
commit306c8e8b4fec79a581f2cad7b160ba6f61f600ac (patch)
tree294ed47d250d3d7334d95d14fd7033c7e1a87fdd /tests
parent3cc80a439024199e6673477ae91cb32f69aa7ad3 (diff)
downloadcoreutils-306c8e8b4fec79a581f2cad7b160ba6f61f600ac.tar.xz
Lots of clean-up:
E.g., (exit $fail); exit t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$ trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp/backup-14
-rwxr-xr-xtests/cp/backup-is-src2
-rwxr-xr-xtests/cp/cp-HL6
-rwxr-xr-xtests/cp/cp-mv-backup2
-rwxr-xr-xtests/cp/cp-parents6
-rwxr-xr-xtests/cp/deref-slink6
-rwxr-xr-xtests/cp/dir-rm-dest6
-rwxr-xr-xtests/cp/dir-slash8
-rwxr-xr-xtests/cp/dir-vs-file6
-rwxr-xr-xtests/cp/fail-perm6
-rwxr-xr-xtests/cp/into-self6
-rwxr-xr-xtests/cp/link6
-rwxr-xr-xtests/cp/link-preserve6
-rwxr-xr-xtests/cp/no-deref-link12
-rwxr-xr-xtests/cp/no-deref-link22
-rwxr-xr-xtests/cp/no-deref-link32
-rwxr-xr-xtests/cp/perm6
-rwxr-xr-xtests/cp/r-vs-symlink6
-rwxr-xr-xtests/cp/same-file6
-rwxr-xr-xtests/cp/slink-2-slink8
-rwxr-xr-xtests/cp/special-bits6
-rwxr-xr-xtests/cp/symlink-slash12
22 files changed, 60 insertions, 60 deletions
diff --git a/tests/cp/backup-1 b/tests/cp/backup-1
index a5bfee603..3116dd165 100755
--- a/tests/cp/backup-1
+++ b/tests/cp/backup-1
@@ -6,8 +6,8 @@ if test "$VERBOSE" = yes; then
fi
pwd=`pwd`
-tmp=`echo "$0"|sed 's,.*/,,'`.tmp
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
diff --git a/tests/cp/backup-is-src b/tests/cp/backup-is-src
index 07741ddcf..8c5bed468 100755
--- a/tests/cp/backup-is-src
+++ b/tests/cp/backup-is-src
@@ -31,4 +31,4 @@ cmp out2 exp || fail=1
rm -f out out2 exp a a~
-exit $fail
+(exit $fail); exit
diff --git a/tests/cp/cp-HL b/tests/cp/cp-HL
index c2b0cf7b4..239ecebcb 100755
--- a/tests/cp/cp-HL
+++ b/tests/cp/cp-HL
@@ -9,12 +9,12 @@ fi
. $srcdir/../envvar-check
pwd=`pwd`
-tmp=cp-HL.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
+trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir src-dir dest-dir || framework_failure=1
diff --git a/tests/cp/cp-mv-backup b/tests/cp/cp-mv-backup
index 1baadc66b..77f62fa6b 100755
--- a/tests/cp/cp-mv-backup
+++ b/tests/cp/cp-mv-backup
@@ -88,4 +88,4 @@ cmp $expected $actual || fail=1
# Uncomment this if you see a failure and want to try to diagnose it.
test $fail = 1 && diff -c $expected $actual 1>&2
-exit $fail
+(exit $fail); exit
diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents
index c11accbbf..7c693cf16 100755
--- a/tests/cp/cp-parents
+++ b/tests/cp/cp-parents
@@ -10,8 +10,8 @@ fi
umask 022
pwd=`pwd`
-tmp=cp-parents.$$
-trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $tmp && exit $status' 0
+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
@@ -23,7 +23,7 @@ cd $pwd || framework_failure=1
. $srcdir/../envvar-check
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
. $abs_srcdir/../setgid-check
diff --git a/tests/cp/deref-slink b/tests/cp/deref-slink
index 8874e64ca..99181e5b9 100755
--- a/tests/cp/deref-slink
+++ b/tests/cp/deref-slink
@@ -11,12 +11,12 @@ fi
. $srcdir/../lang-default
pwd=`pwd`
-tmp=FIXME.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch f slink-target || framework_failure=1
ln -s slink-target slink || framework_failure=1
diff --git a/tests/cp/dir-rm-dest b/tests/cp/dir-rm-dest
index a2c76f637..b602f2f17 100755
--- a/tests/cp/dir-rm-dest
+++ b/tests/cp/dir-rm-dest
@@ -7,12 +7,12 @@ if test "$VERBOSE" = yes; then
fi
pwd=`pwd`
-tmp=cprmdest.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir d e || framework_failure=1
diff --git a/tests/cp/dir-slash b/tests/cp/dir-slash
index 2694d6b34..4c2abe035 100755
--- a/tests/cp/dir-slash
+++ b/tests/cp/dir-slash
@@ -8,12 +8,12 @@ if test "$VERBOSE" = yes; then
fi
pwd=`pwd`
-tmp=t-cpdirsl.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp || exit $?; exit $status' 0
+t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
+trap 'status=$?; cd $pwd; rm -rf $t0 || exit $?; exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir dir1 dir2 || framework_failure=1
@@ -35,4 +35,4 @@ test -r dir2/dir1/file || fail=1
test -r dir1/file || fail=1
(exit $fail)
-exit $fail
+(exit $fail); exit
diff --git a/tests/cp/dir-vs-file b/tests/cp/dir-vs-file
index c141ed18b..9ac6bd0d6 100755
--- a/tests/cp/dir-vs-file
+++ b/tests/cp/dir-vs-file
@@ -9,12 +9,12 @@ fi
. $srcdir/../envvar-check
pwd=`pwd`
-tmp=dirvfile.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir dir || framework_failure=1
diff --git a/tests/cp/fail-perm b/tests/cp/fail-perm
index b6f745084..468b0c983 100755
--- a/tests/cp/fail-perm
+++ b/tests/cp/fail-perm
@@ -6,12 +6,12 @@ if test "$VERBOSE" = yes; then
fi
pwd=`pwd`
-tmp=fail-perm.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
+trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir D || framework_failure=1
diff --git a/tests/cp/into-self b/tests/cp/into-self
index 463485f68..0ca8bb92a 100755
--- a/tests/cp/into-self
+++ b/tests/cp/into-self
@@ -14,12 +14,12 @@ fi
. $srcdir/../lang-default
pwd=`pwd`
-tmp=into-self.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir dir || framework_failure=1
diff --git a/tests/cp/link b/tests/cp/link
index 663b9da4e..be8d2acea 100755
--- a/tests/cp/link
+++ b/tests/cp/link
@@ -8,12 +8,12 @@ if test "$VERBOSE" = yes; then
fi
pwd=`pwd`
-tmp=cp-link.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch src || framework_failure=1
diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve
index 79e355e6d..bb1dda6d6 100755
--- a/tests/cp/link-preserve
+++ b/tests/cp/link-preserve
@@ -11,12 +11,12 @@ fi
. $srcdir/../lang-default
pwd=`pwd`
-tmp=lp.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch a || framework_failure=1
ln a b || framework_failure=1
diff --git a/tests/cp/no-deref-link1 b/tests/cp/no-deref-link1
index 3a85c4994..0d9d462fc 100755
--- a/tests/cp/no-deref-link1
+++ b/tests/cp/no-deref-link1
@@ -28,4 +28,4 @@ test "`cat a/foo`" = $msg || fail=1
rm -rf a b
-exit $fail
+(exit $fail); exit
diff --git a/tests/cp/no-deref-link2 b/tests/cp/no-deref-link2
index 963e5af22..6af843d00 100755
--- a/tests/cp/no-deref-link2
+++ b/tests/cp/no-deref-link2
@@ -28,4 +28,4 @@ test "`cat a`" = $msg || fail=1
rm -rf a b
-exit $fail
+(exit $fail); exit
diff --git a/tests/cp/no-deref-link3 b/tests/cp/no-deref-link3
index 41910e1a3..9ad685f7a 100755
--- a/tests/cp/no-deref-link3
+++ b/tests/cp/no-deref-link3
@@ -25,4 +25,4 @@ test "`cat a`" = $msg || fail=1
rm -f a b
-exit $fail
+(exit $fail); exit
diff --git a/tests/cp/perm b/tests/cp/perm
index da238bec0..cb295c17e 100755
--- a/tests/cp/perm
+++ b/tests/cp/perm
@@ -12,12 +12,12 @@ fi
. $srcdir/../envvar-check
pwd=`pwd`
-tmp=perm.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
umask 037
diff --git a/tests/cp/r-vs-symlink b/tests/cp/r-vs-symlink
index 472ee5c78..a06409ff2 100755
--- a/tests/cp/r-vs-symlink
+++ b/tests/cp/r-vs-symlink
@@ -12,12 +12,12 @@ fi
. $srcdir/../envvar-check
pwd=`pwd`
-tmp=r-vs-slink.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
echo abc > foo || framework_failure=1
ln -s foo slink || framework_failure=1
diff --git a/tests/cp/same-file b/tests/cp/same-file
index 7ae7ec0bc..e9fbb307d 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -12,12 +12,12 @@ fi
VERSION_CONTROL=numbered; export VERSION_CONTROL
pwd=`pwd`
-tmp=same-f-$$
-trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $tmp && exit $status' 0
+t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
+trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $t0 && exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
if test $framework_failure = 1; then
diff --git a/tests/cp/slink-2-slink b/tests/cp/slink-2-slink
index 90a3f6f2d..837edd512 100755
--- a/tests/cp/slink-2-slink
+++ b/tests/cp/slink-2-slink
@@ -13,12 +13,12 @@ fi
. $srcdir/../lang-default
pwd=`pwd`
-tmp=sl2sl-$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
+trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp
touch file || framework_failure=1
@@ -36,4 +36,4 @@ fail=0
cp --update --no-dereference a b || fail=1
cp --update --no-dereference c d || fail=1
-exit $fail
+(exit $fail); exit
diff --git a/tests/cp/special-bits b/tests/cp/special-bits
index 231ba0037..5b31fda0d 100755
--- a/tests/cp/special-bits
+++ b/tests/cp/special-bits
@@ -13,12 +13,12 @@ fi
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
pwd=`pwd`
-tmp=spec-bits.$$
-trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch a b || framework_failure=1
diff --git a/tests/cp/symlink-slash b/tests/cp/symlink-slash
index 7fb0c0717..827888c68 100755
--- a/tests/cp/symlink-slash
+++ b/tests/cp/symlink-slash
@@ -9,10 +9,13 @@ fi
. $srcdir/../lang-default
-tmp=t-cpsymsl.$$
+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
framework_failure=0
-mkdir $tmp || framework_failure=1
+mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir dir || framework_failure=1
@@ -34,7 +37,4 @@ set `ls -l s`
# call and so cp ends up dereferencing the symlink and copying the directory.
test "$*" = 'total 0' && : || fail=1
-cd ..
-rm -rf $tmp
-
-exit $fail
+(exit $fail); exit