public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/siddhesh/other-lib-compat] Avoid running __malloc_initialize_hook tests on newer targets
@ 2021-07-09 11:01 Siddhesh Poyarekar
  0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2021-07-09 11:01 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=606de233c42c9e8060fc0ac631b1c2f62c9dcb37

commit 606de233c42c9e8060fc0ac631b1c2f62c9dcb37
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Fri Jul 9 16:29:45 2021 +0530

    Avoid running __malloc_initialize_hook tests on newer targets
    
    Newer targets do not have __malloc_initialize_hook because of which
    this test should fail on those targets.  Make the test conditional on
    the ABI versions.  A new macro OTHER_LIB_COMPAT has been introduced to
    allow this check.

Diff:
---
 include/shlib-compat.h   | 13 +++++++++----
 malloc/tst-mallocstate.c |  5 +++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index 6c423c8cb0..76398a9add 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -43,6 +43,14 @@
    && (!(ABI_##lib##_##obsoleted - 0)					      \
        || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))))
 
+/* Like LIB_COMPAT, but it can check versions in other libraries.  It is
+   not always false for !IS_IN (LIB).  */
+#define OTHER_LIB_COMPAT(lib, introduced, obsoleted)	\
+  _OTHER_LIB_COMPAT (lib, introduced, obsoleted)
+#define _OTHER_LIB_COMPAT(lib, introduced, obsoleted)			\
+  (!(ABI_##lib##_##obsoleted - 0)					\
+   || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+
 #ifdef SHARED
 
 /* Similar to LIB_COMPAT, but evaluate to 0 for static build.  The
@@ -56,10 +64,7 @@
 /* Like SHLIB_COMPAT, but it can check versions in other libraries.  It is
    not always false for !IS_IN (LIB).  */
 #define OTHER_SHLIB_COMPAT(lib, introduced, obsoleted)	\
-  _OTHER_SHLIB_COMPAT (lib, introduced, obsoleted)
-#define _OTHER_SHLIB_COMPAT(lib, introduced, obsoleted)			\
-  (!(ABI_##lib##_##obsoleted - 0)					\
-   || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+  _OTHER_LIB_COMPAT (lib, introduced, obsoleted)
 
 /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to
    the version set name to use for e.g. symbols first introduced into
diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c
index ba726505e7..73d3f85b01 100644
--- a/malloc/tst-mallocstate.c
+++ b/malloc/tst-mallocstate.c
@@ -377,6 +377,11 @@ my_free (void *ptr)
 static int
 do_test (void)
 {
+/* The test will not work on newer targets since __malloc_initialize_hook was
+   deprecated in 2.24.  */
+#if !OTHER_LIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_24)
+  FAIL_UNSUPPORTED ("Target does not have __malloc_initialize_hook");
+#endif
   my_free (malloc (1));
   TEST_VERIFY_EXIT (heap_initialized);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-09 11:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 11:01 [glibc/siddhesh/other-lib-compat] Avoid running __malloc_initialize_hook tests on newer targets Siddhesh Poyarekar

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).