diff options
author | Jim Meyering <jim@meyering.net> | 2000-06-12 08:42:08 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-06-12 08:42:08 +0000 |
commit | 1af3ad04de472aaba614440c7dc90f4db3c0e4fe (patch) | |
tree | b3897cf6ac3983a3fbddf33e158fe4e989e3cb74 /tests/rm/r-1 | |
parent | 0eaacfd00ad688e3dee46f05e11602688580179f (diff) | |
download | coreutils-1af3ad04de472aaba614440c7dc90f4db3c0e4fe.tar.xz |
Clean up.
Be careful to remove temp directory upon interrupt.
Diffstat (limited to 'tests/rm/r-1')
-rwxr-xr-x | tests/rm/r-1 | 14 |
1 files changed, 9 insertions, 5 deletions
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 <<EOF > $tmp/$test.E || test_failure=1 +cat <<EOF > $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 |