Skip to content

Commit 69707d6

Browse files
jaysoffiangitster
authored andcommitted
Allow HTTP tests to run on Darwin
This patch allows the HTTP tests to run on OS X 10.5. It is not sufficient to be able to pass in LIB_HTTPD_PATH and LIB_HTTPD_MODULE_PATH alone, as the apache.conf also needs a couple tweaks. These changes are put into an <IfDefine> to keep them Darwin specific, but this means lib-httpd.sh needs to be modified to pass -DDarwin to apache when running on Darwin. As long as we're making this change to lib-httpd.sh, we may as well set LIB_HTTPD_PATH and LIB_HTTPD_MODULE_PATH to appropriate default values for the platform. Note that we now pass HTTPD_PARA to apache at shutdown as well. Otherwise apache will emit a harmless, but noisy warning that LogFormat is an unknown directive. Signed-off-by: Jay Soffian <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3dbe116 commit 69707d6

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

t/lib-httpd.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@ then
1111
exit
1212
fi
1313

14-
LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/apache2'}
14+
HTTPD_PARA=""
15+
16+
case $(uname) in
17+
Darwin)
18+
DEFAULT_HTTPD_PATH='/usr/sbin/httpd'
19+
DEFAULT_HTTPD_MODULE_PATH='/usr/libexec/apache2'
20+
HTTPD_PARA="$HTTPD_PARA -DDarwin"
21+
;;
22+
*)
23+
DEFAULT_HTTPD_PATH='/usr/sbin/apache2'
24+
DEFAULT_HTTPD_MODULE_PATH='/usr/lib/apache2/modules'
25+
;;
26+
esac
27+
28+
LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
1529
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
1630

1731
TEST_PATH="$TEST_DIRECTORY"/lib-httpd
@@ -39,14 +53,12 @@ then
3953
exit
4054
fi
4155

42-
LIB_HTTPD_MODULE_PATH='/usr/lib/apache2/modules'
56+
LIB_HTTPD_MODULE_PATH="$DEFAULT_HTTPD_MODULE_PATH"
4357
fi
4458
else
4559
error "Could not identify web server at '$LIB_HTTPD_PATH'"
4660
fi
4761

48-
HTTPD_PARA=""
49-
5062
prepare_httpd() {
5163
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
5264

@@ -95,5 +107,5 @@ stop_httpd() {
95107
trap 'die' EXIT
96108

97109
"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
98-
-f "$TEST_PATH/apache.conf" -k stop
110+
-f "$TEST_PATH/apache.conf" $HTTPD_PARA -k stop
99111
}

t/lib-httpd/apache.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ LogFormat "%h %l %u %t \"%r\" %>s %b" common
55
CustomLog access.log common
66
ErrorLog error.log
77

8+
<IfDefine Darwin>
9+
LoadModule log_config_module modules/mod_log_config.so
10+
LockFile accept.lock
11+
PidFile httpd.pid
12+
</IfDefine>
13+
814
<IfDefine SSL>
915
LoadModule ssl_module modules/mod_ssl.so
1016

0 commit comments

Comments
 (0)