@matheusbsbs / matheus-bagliano / commits / 75318a3bad
Fork 0

test scripts: refactor start_httpd helper

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>

Jeff King committed Feb 25, 2009 at 03:32 UTC 75318a3bad4b7a25f617217891bfbcec26a9161a
2 files changed +8 -9
t/lib-httpd.sh
+7 -2
@@ -94,13 +94,18 @@ prepare_httpd() {
94 }
95
96 start_httpd() {
97 - prepare_httpd
97 + prepare_httpd >&3 2>&4
98
99 trap 'stop_httpd; die' EXIT
100
101 "$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
102 -f "$TEST_PATH/apache.conf" $HTTPD_PARA \
103 - -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start
103 + -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start \
104 + >&3 2>&4
105 + if ! test $? = 0; then
106 + say "skipping test, web server setup failed"
107 + test_done
108 + fi
109 }
110
111 stop_httpd() {
t/t5540-http-push.sh
+1 -7
@@ -20,13 +20,7 @@ then
20 fi
21
22 . "$TEST_DIRECTORY"/lib-httpd.sh
23 -
24 -if ! start_httpd >&3 2>&4
25 -then
26 - say "skipping test, web server setup failed"
27 - test_done
28 - exit
29 -fi
23 +start_httpd
24
25 test_expect_success 'setup remote repository' '
26 cd "$ROOT_PATH" &&