1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

malloc: add testing for large tcache support

This patch adds large tcache support tests by re-executing malloc tests
using the tunable:  glibc.malloc.tcache_max=1048576
Test names are postfixed with "largetcache".

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
This commit is contained in:
Cupertino Miranda
2025-06-16 12:51:53 +00:00
committed by Wilco Dijkstra
parent cbfd798810
commit cde5caa4bb
2 changed files with 35 additions and 0 deletions

19
Rules
View File

@@ -153,6 +153,7 @@ tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported), \
$(tests-malloc-check:%=%-malloc-check) \ $(tests-malloc-check:%=%-malloc-check) \
$(tests-malloc-hugetlb1:%=%-malloc-hugetlb1) \ $(tests-malloc-hugetlb1:%=%-malloc-hugetlb1) \
$(tests-malloc-hugetlb2:%=%-malloc-hugetlb2)) \ $(tests-malloc-hugetlb2:%=%-malloc-hugetlb2)) \
$(tests-malloc-largetcache:%=%-malloc-largetcache)) \
$(test-srcs)) $(tests-special) \ $(test-srcs)) $(tests-special) \
$(tests-printers-programs) $(tests-printers-programs)
xtests: tests $(xtests-special) xtests: tests $(xtests-special)
@@ -165,6 +166,7 @@ tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \
$(tests-malloc-check:%=$(objpfx)%-malloc-check.out) \ $(tests-malloc-check:%=$(objpfx)%-malloc-check.out) \
$(tests-malloc-hugetlb1:%=$(objpfx)%-malloc-hugetlb1.out) \ $(tests-malloc-hugetlb1:%=$(objpfx)%-malloc-hugetlb1.out) \
$(tests-malloc-hugetlb2:%=$(objpfx)%-malloc-hugetlb2.out) \ $(tests-malloc-hugetlb2:%=$(objpfx)%-malloc-hugetlb2.out) \
$(tests-malloc-largetcache:%=$(objpfx)%-malloc-largetcache.out) \
$(tests-special) $(tests-printers-out) $(tests-special) $(tests-printers-out)
xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
endif # $(run-built-tests) != no endif # $(run-built-tests) != no
@@ -179,6 +181,7 @@ tests-expected = $(tests) $(tests-internal) $(tests-printers) \
$(tests-container) $(tests-malloc-check:%=%-malloc-check) \ $(tests-container) $(tests-malloc-check:%=%-malloc-check) \
$(tests-malloc-hugetlb1:%=%-malloc-hugetlb1) \ $(tests-malloc-hugetlb1:%=%-malloc-hugetlb1) \
$(tests-malloc-hugetlb2:%=%-malloc-hugetlb2) \ $(tests-malloc-hugetlb2:%=%-malloc-hugetlb2) \
$(tests-malloc-largetcache:%=%-malloc-largetcache) \
$(tests-mcheck:%=%-mcheck) $(tests-mcheck:%=%-mcheck)
xtests-expected = $(xtests) xtests-expected = $(xtests)
endif # $(run-built-tests) != no endif # $(run-built-tests) != no
@@ -211,6 +214,7 @@ binaries-mcheck-tests = $(tests-mcheck:%=%-mcheck)
binaries-malloc-check-tests = $(tests-malloc-check:%=%-malloc-check) binaries-malloc-check-tests = $(tests-malloc-check:%=%-malloc-check)
binaries-malloc-hugetlb1-tests = $(tests-malloc-hugetlb1:%=%-malloc-hugetlb1) binaries-malloc-hugetlb1-tests = $(tests-malloc-hugetlb1:%=%-malloc-hugetlb1)
binaries-malloc-hugetlb2-tests = $(tests-malloc-hugetlb2:%=%-malloc-hugetlb2) binaries-malloc-hugetlb2-tests = $(tests-malloc-hugetlb2:%=%-malloc-hugetlb2)
binaries-malloc-largetcache-tests = $(tests-malloc-largetcache:%=%-malloc-largetcache)
else else
binaries-all-notests = binaries-all-notests =
binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs)
@@ -224,6 +228,7 @@ binaries-mcheck-tests =
binaries-malloc-check-tests = binaries-malloc-check-tests =
binaries-malloc-hugetlb1-tests = binaries-malloc-hugetlb1-tests =
binaries-malloc-hugetlb2-tests = binaries-malloc-hugetlb2-tests =
binaries-malloc-largetcache-tests =
endif endif
binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests) binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests)
@@ -290,6 +295,14 @@ $(addprefix $(objpfx),$(binaries-malloc-hugetlb2-tests)): %-malloc-hugetlb2: %.o
$(+link-tests) $(+link-tests)
endif endif
ifneq "$(strip $(binaries-malloc-largetcache-tests))" ""
$(addprefix $(objpfx),$(binaries-malloc-largetcache-tests)): %-malloc-largetcache: %.o \
$(link-extra-libs-tests) \
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
$(+link-tests)
endif
ifneq "$(strip $(binaries-pie-tests))" "" ifneq "$(strip $(binaries-pie-tests))" ""
$(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \ $(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \
$(link-extra-libs-tests) \ $(link-extra-libs-tests) \
@@ -339,6 +352,12 @@ $(1)-malloc-hugetlb2-ENV += GLIBC_TUNABLES=glibc.malloc.hugetlb=2
endef endef
$(foreach t,$(tests-malloc-hugetlb2),$(eval $(call malloc-hugetlb2-ENVS,$(t)))) $(foreach t,$(tests-malloc-hugetlb2),$(eval $(call malloc-hugetlb2-ENVS,$(t))))
# All malloc-largetcache tests will be run with GLIBC_TUNABLE=glibc.malloc.tcache_max=1048576
define malloc-largetcache-ENVS
$(1)-malloc-largetcache-ENV += GLIBC_TUNABLES=glibc.malloc.tcache_max=1048576
endef
$(foreach t,$(tests-malloc-largetcache),$(eval $(call malloc-largetcache-ENVS,$(t))))
# mcheck tests need the debug DSO to support -lmcheck. # mcheck tests need the debug DSO to support -lmcheck.
define mcheck-ENVS define mcheck-ENVS
$(1)-mcheck-ENV = LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so $(1)-mcheck-ENV = LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so

View File

@@ -147,6 +147,22 @@ tests-malloc-hugetlb1 = \
tests-malloc-hugetlb2 = \ tests-malloc-hugetlb2 = \
$(filter-out $(tests-exclude-hugetlb2), $(tests)) $(filter-out $(tests-exclude-hugetlb2), $(tests))
tests-exclude-largetcache = \
tst-compathooks-off \
tst-compathooks-on \
tst-interpose-thread \
tst-interpose-nothread \
tst-interpose-static-nothread \
tst-interpose-static-thread \
tst-mallocstate \
tst-malloc-backtrace \
tst-malloc-usable \
tst-malloc-usable-tunables \
# tests-exclude-largetcache
tests-malloc-largetcache = \
$(filter-out $(tests-exclude-largetcache), $(tests))
# -lmcheck needs __malloc_initialize_hook, which was deprecated in 2.24. # -lmcheck needs __malloc_initialize_hook, which was deprecated in 2.24.
ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes) ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
# Tests that don't play well with mcheck. They are either bugs in mcheck or # Tests that don't play well with mcheck. They are either bugs in mcheck or