diff options
author | Jeff King <peff@peff.net> | 2014-12-08 02:47:06 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-12-11 14:13:17 -0800 |
commit | b0f4c9087e1e016667e34c6c413c57435e591b45 (patch) | |
tree | 4fcaad9928c0a4128baaf688011253f6fc939c29 /t/lib-httpd | |
parent | First batch for 2.3 cycle (diff) | |
download | tgif-b0f4c9087e1e016667e34c6c413c57435e591b45.tar.xz |
t: support clang/gcc AddressSanitizer
When git is compiled with "-fsanitize=address" (using clang
or gcc >= 4.8), all invocations of git will check for buffer
overflows. This is similar to running with valgrind, except
that it is more thorough (because of the compiler support,
function-local buffers can be checked, too) and runs much
faster (making it much less painful to run the whole test
suite with the checks turned on).
Unlike valgrind, the magic happens at compile-time, so we
don't need the same infrastructure in the test suite that we
did to support --valgrind. But there are two things we can
help with:
1. On some platforms, the leak-detector is on by default,
and causes every invocation of "git init" (and thus
every test script) to fail. Since running git with
the leak detector is pointless, let's shut it off
automatically in the tests, unless the user has already
configured it.
2. When apache runs a CGI, it clears the environment of
unknown variables. This means that the $ASAN_OPTIONS
config doesn't make it to git-http-backend, and it
dies due to the leak detector. Let's mark the variable
as OK for apache to pass.
With these two changes, running
make CC=clang CFLAGS=-fsanitize=address test
works out of the box.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-httpd')
-rw-r--r-- | t/lib-httpd/apache.conf | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf index 7713dd2609..03a4c2ee84 100644 --- a/t/lib-httpd/apache.conf +++ b/t/lib-httpd/apache.conf @@ -69,6 +69,7 @@ LockFile accept.lock PassEnv GIT_VALGRIND PassEnv GIT_VALGRIND_OPTIONS PassEnv GNUPGHOME +PassEnv ASAN_OPTIONS Alias /dumb/ www/ Alias /auth/dumb/ www/auth/dumb/ |