test-lib: fix http exit codes
authorClemens Buchacher <drizzd@aon.at>
Mon, 1 Jun 2009 12:28:25 +0000 (14:28 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Jun 2009 05:45:01 +0000 (22:45 -0700)
Previously, die() would report the exit code of stop_httpd. Instead,
save and reset the exit code before dying.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-httpd.sh

index cde659d14ac599e78bb4cd12a2ad88eab179549e..6765b08065e8959dcec38940188818b952d2fcd0 100644 (file)
@@ -93,14 +93,16 @@ prepare_httpd() {
 start_httpd() {
        prepare_httpd >&3 2>&4
 
-       trap 'stop_httpd; die' EXIT
+       trap 'code=$?; stop_httpd; (exit $code); die' EXIT
 
        "$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
                -f "$TEST_PATH/apache.conf" $HTTPD_PARA \
                -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start \
                >&3 2>&4
-       if ! test $? = 0; then
+       if test $? -ne 0
+       then
                say "skipping test, web server setup failed"
+               trap 'die' EXIT
                test_done
        fi
 }