summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-04-19 21:17:45 +0000
committerJim Meyering <jim@meyering.net>2002-04-19 21:17:45 +0000
commitd0ae660607f2d438654a2adf13231e586c62fc3f (patch)
tree11f8d5d1802ac28c86b5a96ab301fba06019e7ef /tests
parent5aaccdf6a7b9a56aff56d6e5be211151df2acf71 (diff)
downloadcoreutils-d0ae660607f2d438654a2adf13231e586c62fc3f.tar.xz
Use better trap.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/mkdir/concurrent-111
-rwxr-xr-xtests/mkdir/p-115
2 files changed, 10 insertions, 16 deletions
diff --git a/tests/mkdir/concurrent-1 b/tests/mkdir/concurrent-1
index 738ac146c..0b1a9ae89 100755
--- a/tests/mkdir/concurrent-1
+++ b/tests/mkdir/concurrent-1
@@ -9,14 +9,13 @@ if test "$VERBOSE" = yes; then
mkdir --version
fi
-temp_dir=$TMPDIR/t-mkdir.$$
-tmp=$temp_dir/a/b/c
-rm -rf $temp_dir
+pwd=`pwd`
+tmp=`echo "$0"|sed 's,.*/,,'`.tmp
+trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+trap '(exit $?); exit' 1 2 13 15
-mkdir --parents $tmp || fail=1
+mkdir --parents $pwd/$tmp/a/b/c || fail=1
test -d $tmp || fail=1
-rm -rf $temp_dir
-
exit $fail
diff --git a/tests/mkdir/p-1 b/tests/mkdir/p-1
index 738ac146c..272e35eee 100755
--- a/tests/mkdir/p-1
+++ b/tests/mkdir/p-1
@@ -1,22 +1,17 @@
#!/bin/sh
-# TMPDIR should be an absolute dir for this test.
-# FIXME: enforce it
-: ${TMPDIR=/tmp}
-
if test "$VERBOSE" = yes; then
set -x
mkdir --version
fi
-temp_dir=$TMPDIR/t-mkdir.$$
-tmp=$temp_dir/a/b/c
-rm -rf $temp_dir
+pwd=`pwd`
+tmp=`echo "$0"|sed 's,.*/,,'`.tmp
+trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+trap '(exit $?); exit' 1 2 13 15
-mkdir --parents $tmp || fail=1
+mkdir --parents $pwd/$tmp || fail=1
test -d $tmp || fail=1
-rm -rf $temp_dir
-
exit $fail