All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 3/3 v2] test-lib: fix http exit codes
Date: Mon, 1 Jun 2009 14:28:25 +0200	[thread overview]
Message-ID: <20090601122825.GA29406@localhost> (raw)
In-Reply-To: <1243858482-6353-4-git-send-email-drizzd@aon.at>

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>
---

On Mon, Jun 01, 2009 at 02:14:42PM +0200, Clemens Buchacher wrote:
> Previously, die() would report the exit code of stop_httpd. Instead,
> save the exit code and pass it to die() explicitly.

Oops, I forgot to fix the commit message. (I tried to pass the exit code to
die() explicitly, but then I realized that this is much easier.)

Clemens

 t/lib-httpd.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index cde659d..6765b08 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -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
 }
-- 
1.6.3.1.147.g637c3

      reply	other threads:[~2009-06-01 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01 12:14 various fixes to the test library Clemens Buchacher
2009-06-01 12:14 ` [PATCH 1/3] test-lib: fail if invalid options are passed Clemens Buchacher
2009-06-01 12:14   ` [PATCH 2/3] test-lib: allow exit trap to be used for cleanup by tests Clemens Buchacher
2009-06-01 12:14     ` [PATCH 3/3] test-lib: fix http exit codes Clemens Buchacher
2009-06-01 12:28       ` Clemens Buchacher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090601122825.GA29406@localhost \
    --to=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.