{"thread":{"id":"31085","subject":"[PATCH] t/lib-httpd: handle running under --valgrind","startedAt":"2012-07-24T13:43:59Z","lastAt":"2012-07-24T13:43:59Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"195630","messageId":"20120724134358.GA14788@sigill.intra.peff.net","threadId":"31085","inReplyTo":null,"subject":"[PATCH] t/lib-httpd: handle running under --valgrind","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-07-24T13:43:59Z","receivedAt":"2012-07-24T13:43:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Running the http tests with valgrind does not work for two\nreasons:\n\n  1. Apache complains about following the symbolic link from\n     git-http-backend to valgrind.sh.\n\n  2. Apache does not pass through the GIT_VALGRIND variable\n     to the backend CGI.\n\nThis patch fixes both problems. Unfortunately, there is a\nslight hack we need to handle passing environment variables\nthrough Apache. If we just tell it:\n\n  PassEnv GIT_VALGRIND\n\nthen Apache will complain when GIT_VALGRIND is not set. If\nwe try:\n\n  SetEnv GIT_VALGRIND ${GIT_VALGRIND}\n\nthen when GIT_VALGRIND is not set, it will pass through the\nliteral \"${GIT_VALGRIND}\". Instead, we now unconditionally\npass through GIT_VALGRIND from lib-httpd.sh into apache,\neven if it is empty.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI rolled this a few weeks ago while searching for a bug that turned out\nnot to be in git at all. But even without hunting a specific bug, it\nallows us to expand our valgrind test coverage, which is a good thing.\n\n t/lib-httpd.sh          | 4 ++++\n t/lib-httpd/apache.conf | 5 ++++-\n 2 files changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\nindex 094d490..d773542 100644\n--- a/t/lib-httpd.sh\n+++ b/t/lib-httpd.sh\n@@ -43,6 +43,10 @@ TEST_PATH=\"$TEST_DIRECTORY\"/lib-httpd\n HTTPD_ROOT_PATH=\"$PWD\"/httpd\n HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www\n \n+# hack to suppress apache PassEnv warnings\n+GIT_VALGRIND=$GIT_VALGRIND; export GIT_VALGRIND\n+GIT_VALGRIND_OPTIONS=$GIT_VALGRIND_OPTIONS; export GIT_VALGRIND_OPTIONS\n+\n if ! test -x \"$LIB_HTTPD_PATH\"\n then\n \tskip_all=\"skipping test, no web server found at '$LIB_HTTPD_PATH'\"\ndiff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\nindex de3762e..36b1596 100644\n--- a/t/lib-httpd/apache.conf\n+++ b/t/lib-httpd/apache.conf\n@@ -42,6 +42,9 @@ ErrorLog error.log\n </IfModule>\n </IfVersion>\n \n+PassEnv GIT_VALGRIND\n+PassEnv GIT_VALGRIND_OPTIONS\n+\n Alias /dumb/ www/\n Alias /auth/ www/auth/\n \n@@ -62,7 +65,7 @@ ScriptAlias /smart/ ${GIT_EXEC_PATH}/git-http-backend/\n ScriptAlias /smart_noexport/ ${GIT_EXEC_PATH}/git-http-backend/\n ScriptAlias /smart_custom_env/ ${GIT_EXEC_PATH}/git-http-backend/\n <Directory ${GIT_EXEC_PATH}>\n-\tOptions None\n+\tOptions FollowSymlinks\n </Directory>\n <Files ${GIT_EXEC_PATH}/git-http-backend>\n \tOptions ExecCGI\n-- \n1.7.11.3.4.g9f70dbb\n"}]}