summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1f729dc)
raw | patch | inline | side by side (parent: 1f729dc)
author | Clemens Buchacher <drizzd@aon.at> | |
Mon, 1 Jun 2009 12:14:41 +0000 (14:14 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 2 Jun 2009 05:44:54 +0000 (22:44 -0700) |
Exit trap should not be removed in case tests require cleanup code. This
is especially important if tests are executed with the --immediate option.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
is especially important if tests are executed with the --immediate option.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh | patch | blob | history |
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6e83ceb3606c705fa4b4f5fe7e31636fe4d47444..5fdc5d94a20cfcf231bf23590784c5146a3e44bc 100644 (file)
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
error () {
say_color error "error: $*"
- trap - EXIT
+ GIT_EXIT_OK=t
exit 1
}
test_success=0
die () {
- echo >&5 "FATAL: Unexpected exit with code $?"
- exit 1
+ code=$?
+ if test -n "$GIT_EXIT_OK"
+ then
+ exit $code
+ else
+ echo >&5 "FATAL: Unexpected exit with code $code"
+ exit 1
+ fi
}
+GIT_EXIT_OK=
trap 'die' EXIT
# The semantics of the editor variables are that of invoking
say_color error "FAIL $test_count: $1"
shift
echo "$@" | sed -e 's/^/ /'
- test "$immediate" = "" || { trap - EXIT; exit 1; }
+ test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
}
test_known_broken_ok_ () {
then
test_known_broken_ok_ "$1"
else
- test_known_broken_failure_ "$1"
+ test_known_broken_failure_ "$1"
fi
fi
echo >&3 ""
}
test_done () {
- trap - EXIT
+ GIT_EXIT_OK=t
test_results_dir="$TEST_DIRECTORY/test-results"
mkdir -p "$test_results_dir"
test_results_path="$test_results_dir/${0%.sh}-$$"
test="trash directory.$(basename "$0" .sh)"
test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
rm -fr "$test" || {
- trap - EXIT
+ GIT_EXIT_OK=t
echo >&5 "FATAL: Cannot prepare test area"
exit 1
}