From: Aram Sargsyan Date: Thu, 6 Apr 2023 13:18:04 +0000 (+0000) Subject: unit tests: include an OpenSSL header before including cmocka.h X-Git-Tag: v9.19.13~33^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87db9ea84cb72ef9be3779e94407ccee7f8f2a4a;p=thirdparty%2Fbind9.git unit tests: include an OpenSSL header before including cmocka.h OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a redefined malloc in cmocka.h. As a workaround, include an OpenSSL header file before including cmocka.h in the unit tests where OpenSSL is used. --- diff --git a/tests/dns/dst_test.c b/tests/dns/dst_test.c index 570c19c876c..15b89d9d4ac 100644 --- a/tests/dns/dst_test.c +++ b/tests/dns/dst_test.c @@ -19,6 +19,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/dns/rsa_test.c b/tests/dns/rsa_test.c index 587dc4ea3e2..f19105fb015 100644 --- a/tests/dns/rsa_test.c +++ b/tests/dns/rsa_test.c @@ -20,6 +20,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/doh_test.c b/tests/isc/doh_test.c index bb19298df90..112b827257d 100644 --- a/tests/isc/doh_test.c +++ b/tests/isc/doh_test.c @@ -21,6 +21,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/hmac_test.c b/tests/isc/hmac_test.c index b4438a2853c..9984cc7208d 100644 --- a/tests/isc/hmac_test.c +++ b/tests/isc/hmac_test.c @@ -20,6 +20,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/netmgr_common.c b/tests/isc/netmgr_common.c index b8988b9154b..fa8faedbbf5 100644 --- a/tests/isc/netmgr_common.c +++ b/tests/isc/netmgr_common.c @@ -18,6 +18,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/tcp_test.c b/tests/isc/tcp_test.c index 1095fb66e0a..4239e178992 100644 --- a/tests/isc/tcp_test.c +++ b/tests/isc/tcp_test.c @@ -18,6 +18,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/tcpdns_test.c b/tests/isc/tcpdns_test.c index 7006add141b..8005f537b2e 100644 --- a/tests/isc/tcpdns_test.c +++ b/tests/isc/tcpdns_test.c @@ -18,6 +18,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/tls_test.c b/tests/isc/tls_test.c index 6ba62693362..e6c76aa07a0 100644 --- a/tests/isc/tls_test.c +++ b/tests/isc/tls_test.c @@ -18,6 +18,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/tlsdns_test.c b/tests/isc/tlsdns_test.c index e42be5e6bba..7c000687e20 100644 --- a/tests/isc/tlsdns_test.c +++ b/tests/isc/tlsdns_test.c @@ -18,6 +18,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include diff --git a/tests/isc/udp_test.c b/tests/isc/udp_test.c index ab6742d77b9..e88d7d4f2fb 100644 --- a/tests/isc/udp_test.c +++ b/tests/isc/udp_test.c @@ -18,6 +18,13 @@ #include #include +/* + * As a workaround, include an OpenSSL header file before including cmocka.h, + * because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a + * redefined malloc in cmocka.h. + */ +#include + #define UNIT_TESTING #include