Skip to content

Commit 2cdc292

Browse files
avargitster
authored andcommitted
Makefile: add SANITIZE=leak flag to GIT-BUILD-OPTIONS
When SANITIZE=leak is specified we'll now add a SANITIZE_LEAK flag to GIT-BUILD-OPTIONS, this can then be picked up by the test-lib.sh, which sets a SANITIZE_LEAK prerequisite. We can then skip specific tests that are known to fail under SANITIZE=leak, add one such annotation to t0004-unwritable.sh, which now passes under SANITIZE=leak. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e0a2f5c commit 2cdc292

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,9 @@ PTHREAD_CFLAGS =
12211221
SPARSE_FLAGS ?=
12221222
SP_EXTRA_FLAGS = -Wno-universal-initializer
12231223

1224+
# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak target
1225+
SANITIZE_LEAK =
1226+
12241227
# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
12251228
# usually result in less CPU usage at the cost of higher peak memory.
12261229
# Setting it to 0 will feed all files in a single spatch invocation.
@@ -1265,6 +1268,7 @@ BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
12651268
endif
12661269
ifneq ($(filter leak,$(SANITIZERS)),)
12671270
BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
1271+
SANITIZE_LEAK = YesCompiledWithIt
12681272
endif
12691273
ifneq ($(filter address,$(SANITIZERS)),)
12701274
NO_REGEX = NeededForASAN
@@ -2812,6 +2816,7 @@ GIT-BUILD-OPTIONS: FORCE
28122816
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
28132817
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
28142818
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
2819+
@echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
28152820
@echo X=\'$(X)\' >>$@+
28162821
ifdef TEST_OUTPUT_DIRECTORY
28172822
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+

t/t0004-unwritable.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test_expect_success POSIXPERM,SANITY 'write-tree should notice unwritable reposi
2121
test_must_fail git write-tree
2222
'
2323

24-
test_expect_success POSIXPERM,SANITY 'commit should notice unwritable repository' '
24+
test_expect_success POSIXPERM,SANITY,!SANITIZE_LEAK 'commit should notice unwritable repository' '
2525
test_when_finished "chmod 775 .git/objects .git/objects/??" &&
2626
chmod a-w .git/objects .git/objects/?? &&
2727
test_must_fail git commit -m second

t/test-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,7 @@ test -z "$NO_PYTHON" && test_set_prereq PYTHON
15331533
test -n "$USE_LIBPCRE2" && test_set_prereq PCRE
15341534
test -n "$USE_LIBPCRE2" && test_set_prereq LIBPCRE2
15351535
test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
1536+
test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
15361537

15371538
if test -z "$GIT_TEST_CHECK_CACHE_TREE"
15381539
then

0 commit comments

Comments
 (0)