diff --git a/sharness.sh b/sharness.sh index eb6882dfe..15a34a29c 100644 --- a/sharness.sh +++ b/sharness.sh @@ -276,6 +276,7 @@ export SHARNESS_TEST_NB die() { code=$? + test_eval_ "$final_cleanup" if test -n "$EXIT_OK"; then exit $code else @@ -649,8 +650,6 @@ test_done() { fi say "1..$SHARNESS_TEST_NB$skip_all" - test_eval_ "$final_cleanup" - remove_trash_ exit 0 ;; @@ -659,8 +658,6 @@ test_done() { say_color error "# failed $test_failure among $msg" say "1..$SHARNESS_TEST_NB" - test_eval_ "$final_cleanup" - exit 1 ;; esac diff --git a/test/sharness.t b/test/sharness.t index d5d766778..83cbe91b8 100755 --- a/test/sharness.t +++ b/test/sharness.t @@ -443,6 +443,7 @@ test_expect_success 'cleanup functions run even on failure' " > \"$HOME\"/dont-clean-final && (exit 1) ' + exit 1 test_done EOF test -e dont-clean-final &&