Skip to content

Commit 85b81b3

Browse files
peffgitster
authored andcommitted
test-lib: set LSAN_OPTIONS to abort by default
We already set ASAN_OPTIONS to abort if it finds any errors. As we start to experiment with LSAN, the leak sanitizer, it's convenient if we give it the same treatment. Note that ASAN is actually a superset of LSAN and can do the leak detection itself. So this only has an effect if you specifically build with "make SANITIZE=leak" (leak detection but not the rest of ASAN). Building with just LSAN results in a build that runs much faster. That makes the build-test-fix cycle more pleasant. In the long run, once we've fixed or suppressed all the leaks, it will probably be worth turning leak-detection on for ASAN and just using that (to check both leaks _and_ memory errors in a single test run). But there's still a lot of work before we get there. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 88c6e9d commit 85b81b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

t/test-lib.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ GIT_BUILD_DIR="$TEST_DIRECTORY"/..
4444
: ${ASAN_OPTIONS=detect_leaks=0:abort_on_error=1}
4545
export ASAN_OPTIONS
4646

47+
# If LSAN is in effect we _do_ want leak checking, but we still
48+
# want to abort so that we notice the problems.
49+
: ${LSAN_OPTIONS=abort_on_error=1}
50+
export LSAN_OPTIONS
51+
4752
################################################################
4853
# It appears that people try to run tests without building...
4954
"$GIT_BUILD_DIR/git" >/dev/null

0 commit comments

Comments
 (0)