From: Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org
Cc: fweimer@redhat.com
Subject: [PATCH v3 02/10] Add mcheck tests to malloc
Date: Fri, 2 Jul 2021 08:05:38 +0530 [thread overview]
Message-ID: <20210702023546.3081774-3-siddhesh@sourceware.org> (raw)
In-Reply-To: <20210702023546.3081774-1-siddhesh@sourceware.org>
Like malloc-check, add generic rules to run all tests in malloc by
linking with libmcheck.a so as to provide coverage for mcheck().
Currently the following 12 tests fail:
FAIL: malloc/tst-malloc-backtrace-mcheck
FAIL: malloc/tst-malloc-fork-deadlock-mcheck
FAIL: malloc/tst-malloc-stats-cancellation-mcheck
FAIL: malloc/tst-malloc-tcache-leak-mcheck
FAIL: malloc/tst-malloc-thread-exit-mcheck
FAIL: malloc/tst-malloc-thread-fail-mcheck
FAIL: malloc/tst-malloc-usable-static-mcheck
FAIL: malloc/tst-malloc-usable-static-tunables-mcheck
FAIL: malloc/tst-malloc-usable-tunables-mcheck
FAIL: malloc/tst-malloc_info-mcheck
FAIL: malloc/tst-memalign-mcheck
FAIL: malloc/tst-posix_memalign-mcheck
and they have been added to tests-exclude-mcheck for now to keep
status quo. At least the last two can be attributed to bugs in
mcheck() but I haven't fixed them here since they should be fixed by
removing malloc hooks. Others need to be triaged to check if they're
due to mcheck bugs or due to actual bugs.
Reviewed-by: DJ Delorie <dj@redhat.com>
---
Rules | 15 ++++++++++++++-
malloc/Makefile | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/Rules b/Rules
index c6b635c3f7..ba13598df6 100644
--- a/Rules
+++ b/Rules
@@ -155,6 +155,7 @@ xtests: tests $(xtests-special)
else
tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \
$(tests-container:%=$(objpfx)%.out) \
+ $(tests-mcheck:%=$(objpfx)%-mcheck.out) \
$(tests-malloc-check:%=$(objpfx)%-malloc-check.out) \
$(tests-special) $(tests-printers-out)
xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
@@ -166,7 +167,8 @@ ifeq ($(run-built-tests),no)
tests-expected =
else
tests-expected = $(tests) $(tests-internal) $(tests-printers) \
- $(tests-container) $(tests-malloc-check:%=%-malloc-check)
+ $(tests-container) $(tests-malloc-check:%=%-malloc-check) \
+ $(tests-mcheck:%=%-mcheck)
endif
tests:
$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
@@ -192,6 +194,7 @@ else
binaries-pie-tests =
binaries-pie-notests =
endif
+binaries-mcheck-tests = $(tests-mcheck:%=%-mcheck)
binaries-malloc-check-tests = $(tests-malloc-check:%=%-malloc-check)
else
binaries-all-notests =
@@ -202,6 +205,7 @@ binaries-static-tests =
binaries-static =
binaries-pie-tests =
binaries-pie-notests =
+binaries-mcheck-tests =
binaries-malloc-check-tests =
endif
@@ -226,6 +230,15 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \
$(+link-tests)
endif
+ifneq "$(strip $(binaries-mcheck-tests))" ""
+$(addprefix $(objpfx),$(binaries-mcheck-tests)): %-mcheck: %.o \
+ $(link-extra-libs-tests) \
+ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+ $(common-objpfx)malloc/libmcheck.a \
+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
+ $(+link-tests)
+endif
+
ifneq "$(strip $(binaries-malloc-check-tests))" ""
$(addprefix $(objpfx),$(binaries-malloc-check-tests)): %-malloc-check: %.o \
$(link-extra-libs-tests) \
diff --git a/malloc/Makefile b/malloc/Makefile
index 9bc2e50a9a..c8256abbbf 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -77,6 +77,26 @@ tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
# Run all tests with MALLOC_CHECK_=3
tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests))
+# Tests that don't play well with mcheck. They are either bugs in mcheck or
+# the tests expect specific internal behavior that is changed due to linking to
+# libmcheck.a.
+tests-exclude-mcheck = tst-mallocstate \
+ tst-safe-linking tst-malloc-usable \
+ tst-malloc-backtrace \
+ tst-malloc-fork-deadlock \
+ tst-malloc-stats-cancellation \
+ tst-malloc-tcache-leak \
+ tst-malloc-thread-exit \
+ tst-malloc-thread-fail \
+ tst-malloc-usable-static \
+ tst-malloc-usable-static-tunables \
+ tst-malloc-usable-tunables \
+ tst-malloc_info \
+ tst-memalign \
+ tst-posix_memalign
+
+tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))
+
routines = malloc morecore mcheck mtrace obstack reallocarray \
scratch_buffer_dupfree \
scratch_buffer_grow scratch_buffer_grow_preserve \
@@ -118,6 +138,11 @@ $(objpfx)tst-mallocfork3: $(shared-thread-library)
$(objpfx)tst-mallocfork3-mcheck: $(shared-thread-library)
$(objpfx)tst-malloc-fork-deadlock: $(shared-thread-library)
$(objpfx)tst-malloc-stats-cancellation: $(shared-thread-library)
+$(objpfx)tst-malloc-backtrace-mcheck: $(shared-thread-library)
+$(objpfx)tst-malloc-thread-exit-mcheck: $(shared-thread-library)
+$(objpfx)tst-malloc-thread-fail-mcheck: $(shared-thread-library)
+$(objpfx)tst-malloc-fork-deadlock-mcheck: $(shared-thread-library)
+$(objpfx)tst-malloc-stats-cancellation-mcheck: $(shared-thread-library)
$(objpfx)tst-malloc-backtrace-malloc-check: $(shared-thread-library)
$(objpfx)tst-malloc-thread-exit-malloc-check: $(shared-thread-library)
$(objpfx)tst-malloc-thread-fail-malloc-check: $(shared-thread-library)
@@ -253,17 +278,24 @@ $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
$(tests:%=$(objpfx)%.o): CPPFLAGS += -DTEST_NO_MALLOPT
$(objpfx)tst-interpose-nothread: $(objpfx)tst-interpose-aux-nothread.o
+$(objpfx)tst-interpose-nothread-mcheck: $(objpfx)tst-interpose-aux-nothread.o
$(objpfx)tst-interpose-nothread-malloc-check: \
$(objpfx)tst-interpose-aux-nothread.o
$(objpfx)tst-interpose-thread: \
$(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
+$(objpfx)tst-interpose-thread-mcheck: \
+ $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
$(objpfx)tst-interpose-thread-malloc-check: \
$(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
$(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothread.o
+$(objpfx)tst-interpose-static-nothread-mcheck: \
+ $(objpfx)tst-interpose-aux-nothread.o
$(objpfx)tst-interpose-static-nothread-malloc-check: \
$(objpfx)tst-interpose-aux-nothread.o
$(objpfx)tst-interpose-static-thread: \
$(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
+$(objpfx)tst-interpose-static-thread-mcheck: \
+ $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
$(objpfx)tst-interpose-static-thread-malloc-check: \
$(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
@@ -280,6 +312,9 @@ $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out
$(objpfx)tst-malloc-tcache-leak: $(shared-thread-library)
$(objpfx)tst-malloc_info: $(shared-thread-library)
$(objpfx)tst-mallocfork2: $(shared-thread-library)
+$(objpfx)tst-malloc-tcache-leak-mcheck: $(shared-thread-library)
+$(objpfx)tst-malloc_info-mcheck: $(shared-thread-library)
+$(objpfx)tst-mallocfork2-mcheck: $(shared-thread-library)
$(objpfx)tst-malloc-tcache-leak-malloc-check: $(shared-thread-library)
$(objpfx)tst-malloc_info-malloc-check: $(shared-thread-library)
$(objpfx)tst-mallocfork2-malloc-check: $(shared-thread-library)
--
2.31.1
next prev parent reply other threads:[~2021-07-02 2:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 2:35 [PATCH v3 00/10] Remove malloc hooks Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 01/10] mtrace: Deprecate mallwatch and tr_break Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` Siddhesh Poyarekar via Libc-alpha [this message]
2021-07-06 14:50 ` [PATCH v3 02/10] Add mcheck tests to malloc Stefan Liebler via Libc-alpha
2021-07-06 15:54 ` Siddhesh Poyarekar
2021-07-08 23:37 ` H.J. Lu via Libc-alpha
2021-07-09 0:06 ` H.J. Lu via Libc-alpha
2021-07-09 1:46 ` Siddhesh Poyarekar
2021-07-09 3:53 ` [PATCH] Add a generic malloc test for MALLOC_ALIGNMENT H.J. Lu via Libc-alpha
2021-07-09 4:07 ` Siddhesh Poyarekar
2021-07-09 12:24 ` [PATCH v2] " H.J. Lu via Libc-alpha
2021-07-09 13:00 ` Siddhesh Poyarekar
2021-07-09 13:31 ` [PATCH v3] " H.J. Lu via Libc-alpha
2021-07-09 13:34 ` Siddhesh Poyarekar
2021-07-12 18:02 ` [PATCH v3 02/10] Add mcheck tests to malloc Matheus Castanho via Libc-alpha
2021-07-13 1:06 ` Siddhesh Poyarekar
2021-07-13 12:11 ` Matheus Castanho via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 03/10] Move glibc.malloc.check implementation into its own file Siddhesh Poyarekar via Libc-alpha
2021-07-02 9:05 ` Andreas Schwab
2021-07-02 9:29 ` Siddhesh Poyarekar via Libc-alpha
2021-07-02 9:59 ` Andreas Schwab
2021-07-02 2:35 ` [PATCH v3 04/10] malloc: Move malloc hook references to hooks.c Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 05/10] glibc.malloc.check: Wean away from malloc hooks Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 06/10] mcheck: " Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 07/10] mtrace: " Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 08/10] Remove " Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 09/10] Remove __after_morecore_hook Siddhesh Poyarekar via Libc-alpha
2021-07-02 2:35 ` [PATCH v3 10/10] Remove __morecore and __default_morecore Siddhesh Poyarekar via Libc-alpha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210702023546.3081774-3-siddhesh@sourceware.org \
--to=libc-alpha@sourceware.org \
--cc=fweimer@redhat.com \
--cc=siddhesh@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).