about summary refs log tree commit diff
path: root/malloc/Makefile
diff options
context:
space:
mode:
authorJoe Simmons-Talbott <josimmon@redhat.com>2024-05-14 14:36:50 +0000
committerJoe Simmons-Talbott <josimmon@redhat.com>2024-05-14 14:36:50 +0000
commit3395157ff2b0657d70c36169156f67440205c8bf (patch)
treea8f4c5f02ff31b640f664fb2df3d8cbe2476ef20 /malloc/Makefile
parent90a6ca8b28bf34e361e577e526e1b0f4c39a32a5 (diff)
downloadglibc-3395157ff2b0657d70c36169156f67440205c8bf.tar.gz
glibc-3395157ff2b0657d70c36169156f67440205c8bf.tar.xz
glibc-3395157ff2b0657d70c36169156f67440205c8bf.zip
malloc: Improve aligned_alloc and calloc test coverage.
Add a DSO (malloc/tst-aligned_alloc-lib.so) that can be used during
testing to interpose malloc with a call that randomly uses either
aligned_alloc, __libc_malloc, or __libc_calloc in the place of malloc.
Use LD_PRELOAD with the DSO to mirror malloc/tst-malloc.c testing as an
example in malloc/tst-malloc-random.c.  Add malloc/tst-aligned-alloc-random.c
as another example that does a number of malloc calls with randomly sized,
but limited to 0xffff, requests.

The intention is to be able to utilize existing malloc testing to ensure
that similar allocation APIs are also exposed to the same rigors.

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'malloc/Makefile')
-rw-r--r--malloc/Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/malloc/Makefile b/malloc/Makefile
index 77ba1a9109..c1a03f3cb0 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -27,6 +27,7 @@ headers := $(dist-headers) obstack.h mcheck.h
 tests := \
   mallocbug \
   tst-aligned-alloc \
+  tst-aligned-alloc-random \
   tst-alloc_buffer \
   tst-calloc \
   tst-free-errno \
@@ -36,6 +37,7 @@ tests := \
   tst-malloc-backtrace \
   tst-malloc-check \
   tst-malloc-fork-deadlock \
+  tst-malloc-random \
   tst-malloc-stats-cancellation \
   tst-malloc-tcache-leak \
   tst-malloc-thread-exit \
@@ -193,6 +195,7 @@ extra-libs-others = $(extra-libs)
 
 # Helper objects for some tests.
 extra-test-objs += \
+  tst-aligned_alloc-lib.so \
   tst-interpose-aux-nothread.o \
   tst-interpose-aux-thread.o \
 # extra-test-objs
@@ -202,6 +205,9 @@ test-extras = \
   tst-interpose-aux-thread \
 # test-extras
 
+modules-names = \
+  tst-aligned_alloc-lib
+
 libmemusage-routines = memusage
 libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
 
@@ -408,3 +414,9 @@ tst-mallocstate-malloc-check-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so
 # libc_malloc_debug.so.
 $(objpfx)tst-mallocstate: $(objpfx)libc_malloc_debug.so
 $(objpfx)tst-mallocstate-malloc-check: $(objpfx)libc_malloc_debug.so
+
+$(objpfx)tst-aligned-alloc-random.out: $(objpfx)tst-aligned_alloc-lib.so
+$(objpfx)tst-malloc-random.out: $(objpfx)tst-aligned_alloc-lib.so
+
+tst-aligned-alloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so
+tst-malloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so