Skip to content

Commit

Permalink
test scripts: refactor start_httpd helper
Browse files Browse the repository at this point in the history
There are some redirects and some error checking that need
to be done by the caller; let's move both into the
start_httpd function so that all callers don't have to
repeat them (there is only one caller now, but another will
follow in this series).

This doesn't violate any assumptions that aren't already
being made by lib-httpd, which is happy to say "skipping"
and call test_done for a number of other cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Feb 26, 2009
1 parent 661763a commit 75318a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 7 additions & 2 deletions t/lib-httpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,18 @@ prepare_httpd() {
}

start_httpd() {
prepare_httpd
prepare_httpd >&3 2>&4

trap 'stop_httpd; 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
-c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start \
>&3 2>&4
if ! test $? = 0; then
say "skipping test, web server setup failed"
test_done
fi
}

stop_httpd() {
Expand Down
8 changes: 1 addition & 7 deletions t/t5540-http-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ then
fi

. "$TEST_DIRECTORY"/lib-httpd.sh

if ! start_httpd >&3 2>&4
then
say "skipping test, web server setup failed"
test_done
exit
fi
start_httpd

test_expect_success 'setup remote repository' '
cd "$ROOT_PATH" &&
Expand Down

0 comments on commit 75318a3

Please sign in to comment.