Skip to content

Commit f628825

Browse files
peffgitster
authored andcommitted
t/lib-httpd: handle running under --valgrind
Running the http tests with valgrind does not work for two reasons: 1. Apache complains about following the symbolic link from git-http-backend to valgrind.sh. 2. Apache does not pass through the GIT_VALGRIND variable to the backend CGI. This patch fixes both problems. Unfortunately, there is a slight hack we need to handle passing environment variables through Apache. If we just tell it: PassEnv GIT_VALGRIND then Apache will complain when GIT_VALGRIND is not set. If we try: SetEnv GIT_VALGRIND ${GIT_VALGRIND} then when GIT_VALGRIND is not set, it will pass through the literal "${GIT_VALGRIND}". Instead, we now unconditionally pass through GIT_VALGRIND from lib-httpd.sh into apache, even if it is empty. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ccc1188 commit f628825

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

t/lib-httpd.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ TEST_PATH="$TEST_DIRECTORY"/lib-httpd
4343
HTTPD_ROOT_PATH="$PWD"/httpd
4444
HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
4545

46+
# hack to suppress apache PassEnv warnings
47+
GIT_VALGRIND=$GIT_VALGRIND; export GIT_VALGRIND
48+
GIT_VALGRIND_OPTIONS=$GIT_VALGRIND_OPTIONS; export GIT_VALGRIND_OPTIONS
49+
4650
if ! test -x "$LIB_HTTPD_PATH"
4751
then
4852
skip_all="skipping test, no web server found at '$LIB_HTTPD_PATH'"

t/lib-httpd/apache.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ ErrorLog error.log
4242
</IfModule>
4343
</IfVersion>
4444

45+
PassEnv GIT_VALGRIND
46+
PassEnv GIT_VALGRIND_OPTIONS
47+
4548
Alias /dumb/ www/
4649
Alias /auth/ www/auth/
4750

@@ -62,7 +65,7 @@ ScriptAlias /smart/ ${GIT_EXEC_PATH}/git-http-backend/
6265
ScriptAlias /smart_noexport/ ${GIT_EXEC_PATH}/git-http-backend/
6366
ScriptAlias /smart_custom_env/ ${GIT_EXEC_PATH}/git-http-backend/
6467
<Directory ${GIT_EXEC_PATH}>
65-
Options None
68+
Options FollowSymlinks
6669
</Directory>
6770
<Files ${GIT_EXEC_PATH}/git-http-backend>
6871
Options ExecCGI

0 commit comments

Comments
 (0)