Skip to content

Commit

Permalink
t/lib-httpd: handle running under --valgrind
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jul 24, 2012
1 parent ccc1188 commit f628825
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions t/lib-httpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ TEST_PATH="$TEST_DIRECTORY"/lib-httpd
HTTPD_ROOT_PATH="$PWD"/httpd
HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www

# hack to suppress apache PassEnv warnings
GIT_VALGRIND=$GIT_VALGRIND; export GIT_VALGRIND
GIT_VALGRIND_OPTIONS=$GIT_VALGRIND_OPTIONS; export GIT_VALGRIND_OPTIONS

if ! test -x "$LIB_HTTPD_PATH"
then
skip_all="skipping test, no web server found at '$LIB_HTTPD_PATH'"
Expand Down
5 changes: 4 additions & 1 deletion t/lib-httpd/apache.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ ErrorLog error.log
</IfModule>
</IfVersion>

PassEnv GIT_VALGRIND
PassEnv GIT_VALGRIND_OPTIONS

Alias /dumb/ www/
Alias /auth/ www/auth/

Expand All @@ -62,7 +65,7 @@ ScriptAlias /smart/ ${GIT_EXEC_PATH}/git-http-backend/
ScriptAlias /smart_noexport/ ${GIT_EXEC_PATH}/git-http-backend/
ScriptAlias /smart_custom_env/ ${GIT_EXEC_PATH}/git-http-backend/
<Directory ${GIT_EXEC_PATH}>
Options None
Options FollowSymlinks
</Directory>
<Files ${GIT_EXEC_PATH}/git-http-backend>
Options ExecCGI
Expand Down

0 comments on commit f628825

Please sign in to comment.