From 1af3ad04de472aaba614440c7dc90f4db3c0e4fe Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 12 Jun 2000 08:42:08 +0000 Subject: Clean up. Be careful to remove temp directory upon interrupt. --- tests/rm/r-1 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tests/rm/r-1') diff --git a/tests/rm/r-1 b/tests/rm/r-1 index 59726e161..3e5ab79e6 100755 --- a/tests/rm/r-1 +++ b/tests/rm/r-1 @@ -11,15 +11,18 @@ if test "$VERBOSE" = yes; then rm --version fi +pwd=`pwd` tmp=$TMPDIR/t-rm.$$ +trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0 +trap 'exit $?' 1 2 13 15 test_failure=0 -mkdir $tmp || test_failure=1 -mkdir $tmp/a $tmp/a/a || test_failure=1 -> $tmp/b || test_failure=1 +mkdir $tmp || framework_failure=1 +mkdir $tmp/a $tmp/a/a || framework_failure=1 +> $tmp/b || framework_failure=1 -cat < $tmp/$test.E || test_failure=1 +cat < $tmp/$test.E || framework_failure=1 removing all entries of directory $tmp/a removing all entries of directory $tmp/a/a removing the directory itself: $tmp/a/a @@ -27,7 +30,7 @@ removing the directory itself: $tmp/a removing $tmp/b EOF -if test $test_failure = 1; then +if test $framework_failure = 1; then echo 'failure in testing framework' exit 1 fi @@ -51,4 +54,5 @@ cmp $tmp/$test.E $tmp/$test.O || fail=1 rm -rf $tmp +(exit $fail) exit $fail -- cgit v1.2.3-54-g00ecf