git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3 v2] test-lib: fix http exit codes

From
Clemens Buchacher <drizzd@aon.at>
Date
Jun 1, 2009, 12:28 UTC
Message-ID
<20090601122825.GA29406@localhost>
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
Previous: Clemens Buchacher
Message 5 of 5 in “various fixes to the test library”
  1. Clemens BuchacherJun 1, 2009
  2. 1/3 test-lib: fail if invalid options are passedClemens Buchacher, Jun 1, 2009
  3. 2/3 test-lib: allow exit trap to be used for cleanup by testsClemens Buchacher, Jun 1, 2009
  4. 3/3 test-lib: fix http exit codesClemens Buchacher, Jun 1, 2009
  5. Clemens BuchacherJun 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.