public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
To: libc-alpha@sourceware.org
Subject: [PATCH][trivial] More mcheck -> malloc-check refactoring
Date: Tue, 22 Jun 2021 15:50:13 +0530	[thread overview]
Message-ID: <20210622102013.2807141-1-siddhesh@sourceware.org> (raw)

Refactored malloc-check rules for tests that are automatically
generated and executed with MALLOC_CHECK_=3.

This does not affect codegen and tests run pretty much the same way too,
so I'll push this shortly if there are no objections.
---
 Rules           | 20 ++++++++++----------
 malloc/Makefile | 30 +++++++++++++++++-------------
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/Rules b/Rules
index 082625bb71..c6b635c3f7 100644
--- a/Rules
+++ b/Rules
@@ -155,7 +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)
 endif
@@ -166,7 +166,7 @@ ifeq ($(run-built-tests),no)
 tests-expected =
 else
 tests-expected = $(tests) $(tests-internal) $(tests-printers) \
-	$(tests-container) $(tests-mcheck:%=%-mcheck)
+	$(tests-container) $(tests-malloc-check:%=%-malloc-check)
 endif
 tests:
 	$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
@@ -192,7 +192,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 =
 binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs)
@@ -202,7 +202,7 @@ binaries-static-tests =
 binaries-static =
 binaries-pie-tests =
 binaries-pie-notests =
-binaries-mcheck-tests =
+binaries-malloc-check-tests =
 endif
 
 binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests)
@@ -226,8 +226,8 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \
 	$(+link-tests)
 endif
 
-ifneq "$(strip $(binaries-mcheck-tests))" ""
-$(addprefix $(objpfx),$(binaries-mcheck-tests)): %-mcheck: %.o \
+ifneq "$(strip $(binaries-malloc-check-tests))" ""
+$(addprefix $(objpfx),$(binaries-malloc-check-tests)): %-malloc-check: %.o \
   $(link-extra-libs-tests) \
   $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
@@ -264,11 +264,11 @@ $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \
 	$(+link-static-tests)
 endif
 
-# All mcheck tests will be run with MALLOC_CHECK_=3
-define mcheck-ENVS
-$(1)-mcheck-ENV = MALLOC_CHECK_=3
+# All malloc-check tests will be run with MALLOC_CHECK_=3
+define malloc-check-ENVS
+$(1)-malloc-check-ENV = MALLOC_CHECK_=3
 endef
-$(foreach t,$(tests-mcheck),$(eval $(call mcheck-ENVS,$(t))))
+$(foreach t,$(tests-malloc-check),$(eval $(call malloc-check-ENVS,$(t))))
 
 ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" ""
 # These are the implicit rules for making test outputs
diff --git a/malloc/Makefile b/malloc/Makefile
index f606c70fed..3162301fba 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -70,13 +70,11 @@ test-srcs = tst-mtrace
 
 # These tests either are run with MALLOC_CHECK_=3 by default or do not work
 # with MALLOC_CHECK_=3 because they expect a specific failure.
-tests-exclude-mcheck = tst-malloc-check tst-malloc-usable \
-	tst-interpose-nothread tst-interpose-static-nothread \
-	tst-interpose-static-thread \
+tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
 	tst-mxfast tst-safe-linking
 
 # Run all tests with MALLOC_CHECK_=3
-tests-mcheck = $(filter-out $(tests-exclude-mcheck),$(tests))
+tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests))
 
 routines = malloc morecore mcheck mtrace obstack reallocarray \
   scratch_buffer_dupfree \
@@ -117,11 +115,11 @@ $(objpfx)tst-malloc-thread-exit: $(shared-thread-library)
 $(objpfx)tst-malloc-thread-fail: $(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)
+$(objpfx)tst-malloc-fork-deadlock-malloc-check: $(shared-thread-library)
+$(objpfx)tst-malloc-stats-cancellation-malloc-check: $(shared-thread-library)
 
 # These should be removed by `make clean'.
 extra-objs = mcheck-init.o libmcheck.a
@@ -252,13 +250,19 @@ $(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-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-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-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-malloc-check: \
+  $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
 
 tst-dynarray-ENV = MALLOC_TRACE=$(objpfx)tst-dynarray.mtrace
 $(objpfx)tst-dynarray-mem.out: $(objpfx)tst-dynarray.out
@@ -273,6 +277,6 @@ $(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


             reply	other threads:[~2021-06-22 10:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 10:20 Siddhesh Poyarekar [this message]
2021-06-23  4:01 ` Siddhesh Poyarekar

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210622102013.2807141-1-siddhesh@sourceware.org \
    --to=siddhesh@sourceware.org \
    --cc=libc-alpha@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).