From cafeb66af80421709eb3e4c61cfc4aad489a5bf4 Mon Sep 17 00:00:00 2001 From: Carsten Burstedde Date: Fri, 15 Dec 2023 16:25:58 +0100 Subject: [PATCH] Test for zlib: conjunct test in p4est and sc --- src/p4est_base.c | 10 ++++++++++ src/p4est_base.h | 5 +++++ test/test_balance2.c | 2 +- test/test_balance_type2.c | 2 +- test/test_loadsave2.c | 2 +- test/test_partition2.c | 2 +- test/test_valid2.c | 2 +- 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/p4est_base.c b/src/p4est_base.c index 76730474b..f6f62a3b5 100644 --- a/src/p4est_base.c +++ b/src/p4est_base.c @@ -56,6 +56,16 @@ p4est_is_initialized (void) return p4est_initialized; } +int +p4est_have_zlib (void) +{ +#ifndef P4EST_HAVE_ZLIB + return 0; +#else + return sc_have_zlib (); +#endif +} + int p4est_get_package_id (void) { diff --git a/src/p4est_base.h b/src/p4est_base.h index 724ae5d06..25c9c9028 100644 --- a/src/p4est_base.h +++ b/src/p4est_base.h @@ -358,6 +358,11 @@ void p4est_init (sc_log_handler_t log_handler, */ int p4est_is_initialized (void); +/** Check for a sufficiently recent zlib installation. + * \return True if zlib is detected in both sc and p4est. + */ +int p4est_have_zlib (void); + /** Query the package identity as registered in libsc. * \return This is -1 before \ref p4est_init has been called * and a proper package identifier (>= 0) afterwards. diff --git a/test/test_balance2.c b/test/test_balance2.c index f86fbbdde..42da9b5c9 100644 --- a/test/test_balance2.c +++ b/test/test_balance2.c @@ -123,7 +123,7 @@ main (int argc, char **argv) p4est_init (NULL, SC_LP_DEFAULT); /* check for ZLIB usability */ - if (!(have_zlib = sc_have_zlib ())) { + if (!(have_zlib = p4est_have_zlib ())) { P4EST_GLOBAL_LERROR ("Not found a working ZLIB installation: ignoring CRCs\n"); } diff --git a/test/test_balance_type2.c b/test/test_balance_type2.c index 469ef724a..017fad095 100644 --- a/test/test_balance_type2.c +++ b/test/test_balance_type2.c @@ -113,7 +113,7 @@ main (int argc, char **argv) p4est_init (NULL, SC_LP_DEFAULT); /* check for ZLIB usability */ - if (!(have_zlib = sc_have_zlib ())) { + if (!(have_zlib = p4est_have_zlib ())) { P4EST_GLOBAL_LERROR ("Not found a working ZLIB installation: ignoring CRCs\n"); } diff --git a/test/test_loadsave2.c b/test/test_loadsave2.c index 7363dc20f..d6bd1a695 100644 --- a/test/test_loadsave2.c +++ b/test/test_loadsave2.c @@ -174,7 +174,7 @@ test_loadsave (p4est_connectivity_t * connectivity, const char *prefix, P4EST_GLOBAL_INFOF ("Using file names %s and %s\n", conn_name, p4est_name); /* check for ZLIB usability */ - if (!(have_zlib = sc_have_zlib ())) { + if (!(have_zlib = p4est_have_zlib ())) { P4EST_GLOBAL_LERROR ("Not found a working ZLIB installation: ignoring CRCs\n"); } diff --git a/test/test_partition2.c b/test/test_partition2.c index ed82a5267..db825ed9a 100644 --- a/test/test_partition2.c +++ b/test/test_partition2.c @@ -449,7 +449,7 @@ main (int argc, char **argv) p4est_init (NULL, SC_LP_DEFAULT); /* check for ZLIB usability */ - if (!(have_zlib = sc_have_zlib ())) { + if (!(have_zlib = p4est_have_zlib ())) { P4EST_GLOBAL_LERROR ("Not found a working ZLIB installation: ignoring CRCs\n"); } diff --git a/test/test_valid2.c b/test/test_valid2.c index ebc1ffc84..44fb77256 100644 --- a/test/test_valid2.c +++ b/test/test_valid2.c @@ -112,7 +112,7 @@ check_all (sc_MPI_Comm mpicomm, p4est_connectivity_t * conn, P4EST_GLOBAL_STATISTICSF ("Testing configuration %s\n", vtkname); /* check for ZLIB usability */ - if (!(have_zlib = sc_have_zlib ())) { + if (!(have_zlib = p4est_have_zlib ())) { P4EST_GLOBAL_LERROR ("Not found a working ZLIB installation: ignoring CRCs\n"); crc_expected = crc_partition_expected = gcrc_expected = 0;