From 78afc0bf040d929e61616b158e569def0211c437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 18 May 2023 15:12:23 +0200 Subject: [PATCH 1/2] Include whenever including Development versions of cmocka require the intmax_t and uintmax_t types to be defined by the time the test code includes the header. These types are defined in the header, which is included by the header, which in turn is already explicitly included by some of the programs in the tests/ directory. Ensure all programs in that directory that include the header also include the header to future-proof the code while keeping the change set minimal and the resulting code consistent. Also prevent explicitly including the header in those programs as it is included by the header. (cherry picked from commit c2dcd055fe03f3ec5c76bc1c778b97aa4941e17b) --- tests/dns/acl_test.c | 1 + tests/dns/db_test.c | 1 + tests/dns/dbdiff_test.c | 1 + tests/dns/dbiterator_test.c | 1 + tests/dns/dbversion_test.c | 1 + tests/dns/dh_test.c | 1 + tests/dns/dns64_test.c | 1 + tests/dns/dst_test.c | 1 + tests/dns/geoip_test.c | 1 + tests/dns/master_test.c | 1 + tests/dns/nsec3_test.c | 1 + tests/dns/nsec3param_test.c | 1 + tests/dns/rbtdb_test.c | 1 + tests/dns/rdata_test.c | 1 + tests/dns/rdataset_test.c | 1 + tests/dns/resolver_test.c | 1 + tests/dns/rsa_test.c | 1 + tests/dns/sigs_test.c | 1 + tests/dns/tsig_test.c | 1 + tests/dns/zonemgr_test.c | 1 + tests/dns/zt_test.c | 1 + tests/irs/resconf_test.c | 1 + tests/isc/aes_test.c | 1 + tests/isc/buffer_test.c | 1 + tests/isc/counter_test.c | 1 + tests/isc/crc64_test.c | 1 + tests/isc/errno_test.c | 1 + tests/isc/file_test.c | 1 + tests/isc/heap_test.c | 1 + tests/isc/hmac_test.c | 1 + tests/isc/lex_test.c | 1 + tests/isc/md_test.c | 1 + tests/isc/netaddr_test.c | 1 + tests/isc/netmgr_test.c | 1 + tests/isc/pool_test.c | 1 + tests/isc/quota_test.c | 1 + tests/isc/radix_test.c | 1 + tests/isc/regex_test.c | 1 + tests/isc/result_test.c | 1 + tests/isc/safe_test.c | 1 + tests/isc/siphash_test.c | 1 + tests/isc/sockaddr_test.c | 1 + tests/isc/stats_test.c | 1 + tests/isc/symtab_test.c | 1 + tests/isc/taskpool_test.c | 1 + tests/isc/time_test.c | 1 + tests/isccfg/duration_test.c | 2 +- tests/isccfg/parser_test.c | 1 + tests/ns/listenlist_test.c | 1 + tests/ns/notify_test.c | 1 + tests/ns/plugin_test.c | 1 + 51 files changed, 51 insertions(+), 1 deletion(-) diff --git a/tests/dns/acl_test.c b/tests/dns/acl_test.c index 210ab45dfa..bb454b63ec 100644 --- a/tests/dns/acl_test.c +++ b/tests/dns/acl_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/db_test.c b/tests/dns/db_test.c index 786a4a8337..787ac850c2 100644 --- a/tests/dns/db_test.c +++ b/tests/dns/db_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/dbdiff_test.c b/tests/dns/dbdiff_test.c index 4857683e4c..f0fb8804f8 100644 --- a/tests/dns/dbdiff_test.c +++ b/tests/dns/dbdiff_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/dbiterator_test.c b/tests/dns/dbiterator_test.c index f8f008bd51..f0277b16b8 100644 --- a/tests/dns/dbiterator_test.c +++ b/tests/dns/dbiterator_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/dbversion_test.c b/tests/dns/dbversion_test.c index 1ef8f6c1db..4d52166cba 100644 --- a/tests/dns/dbversion_test.c +++ b/tests/dns/dbversion_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/dh_test.c b/tests/dns/dh_test.c index 9358a8f61f..5f4edd9037 100644 --- a/tests/dns/dh_test.c +++ b/tests/dns/dh_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/dns64_test.c b/tests/dns/dns64_test.c index 6ca96551e6..58349918ed 100644 --- a/tests/dns/dns64_test.c +++ b/tests/dns/dns64_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/dst_test.c b/tests/dns/dst_test.c index 0fecb908ea..283a7ba401 100644 --- a/tests/dns/dst_test.c +++ b/tests/dns/dst_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/geoip_test.c b/tests/dns/geoip_test.c index 8af48f448c..2f5b166dcf 100644 --- a/tests/dns/geoip_test.c +++ b/tests/dns/geoip_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/master_test.c b/tests/dns/master_test.c index 324edea8c5..eaebdddb83 100644 --- a/tests/dns/master_test.c +++ b/tests/dns/master_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/nsec3_test.c b/tests/dns/nsec3_test.c index 4cbf6a9324..c2fcacd994 100644 --- a/tests/dns/nsec3_test.c +++ b/tests/dns/nsec3_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/nsec3param_test.c b/tests/dns/nsec3param_test.c index 21879da023..50c8b85ae2 100644 --- a/tests/dns/nsec3param_test.c +++ b/tests/dns/nsec3param_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/rbtdb_test.c b/tests/dns/rbtdb_test.c index 817dd67e2f..681c077681 100644 --- a/tests/dns/rbtdb_test.c +++ b/tests/dns/rbtdb_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/rdata_test.c b/tests/dns/rdata_test.c index 387121e417..a11bbbeed6 100644 --- a/tests/dns/rdata_test.c +++ b/tests/dns/rdata_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/rdataset_test.c b/tests/dns/rdataset_test.c index e9b47ecbf3..fc21b29f9d 100644 --- a/tests/dns/rdataset_test.c +++ b/tests/dns/rdataset_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/resolver_test.c b/tests/dns/resolver_test.c index 452efdb8cd..4967ffc0a2 100644 --- a/tests/dns/resolver_test.c +++ b/tests/dns/resolver_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/rsa_test.c b/tests/dns/rsa_test.c index c814ab68d9..d5b7a7fc0a 100644 --- a/tests/dns/rsa_test.c +++ b/tests/dns/rsa_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/sigs_test.c b/tests/dns/sigs_test.c index dbb14ac86e..881c900628 100644 --- a/tests/dns/sigs_test.c +++ b/tests/dns/sigs_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/tsig_test.c b/tests/dns/tsig_test.c index f94a0fa016..2cc26c7158 100644 --- a/tests/dns/tsig_test.c +++ b/tests/dns/tsig_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/zonemgr_test.c b/tests/dns/zonemgr_test.c index 7eeaf770ef..0cbbca4752 100644 --- a/tests/dns/zonemgr_test.c +++ b/tests/dns/zonemgr_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/dns/zt_test.c b/tests/dns/zt_test.c index 54031c0ec3..c38e601f64 100644 --- a/tests/dns/zt_test.c +++ b/tests/dns/zt_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/irs/resconf_test.c b/tests/irs/resconf_test.c index cb122df763..367898f8c2 100644 --- a/tests/irs/resconf_test.c +++ b/tests/irs/resconf_test.c @@ -13,6 +13,7 @@ #if HAVE_CMOCKA +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/aes_test.c b/tests/isc/aes_test.c index c328b92b02..9e9ea22898 100644 --- a/tests/isc/aes_test.c +++ b/tests/isc/aes_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/buffer_test.c b/tests/isc/buffer_test.c index 8335248fa0..1c858d3c37 100644 --- a/tests/isc/buffer_test.c +++ b/tests/isc/buffer_test.c @@ -12,6 +12,7 @@ */ #include +#include #include #include /* IWYU pragma: keep */ #include diff --git a/tests/isc/counter_test.c b/tests/isc/counter_test.c index 065a6f0a3b..dc8dc50f6a 100644 --- a/tests/isc/counter_test.c +++ b/tests/isc/counter_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/crc64_test.c b/tests/isc/crc64_test.c index 9b8ff47b9e..cb96437c91 100644 --- a/tests/isc/crc64_test.c +++ b/tests/isc/crc64_test.c @@ -13,6 +13,7 @@ /* ! \file */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/errno_test.c b/tests/isc/errno_test.c index 11d48fa8f5..fbfe56ad4e 100644 --- a/tests/isc/errno_test.c +++ b/tests/isc/errno_test.c @@ -12,6 +12,7 @@ */ #include +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/file_test.c b/tests/isc/file_test.c index 39670b57eb..6b75ba2490 100644 --- a/tests/isc/file_test.c +++ b/tests/isc/file_test.c @@ -12,6 +12,7 @@ */ #include +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/heap_test.c b/tests/isc/heap_test.c index 9e29a4b812..19e3ba5a8c 100644 --- a/tests/isc/heap_test.c +++ b/tests/isc/heap_test.c @@ -13,6 +13,7 @@ /* ! \file */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/hmac_test.c b/tests/isc/hmac_test.c index 3d459d0a18..d980a5a0e9 100644 --- a/tests/isc/hmac_test.c +++ b/tests/isc/hmac_test.c @@ -13,6 +13,7 @@ /* ! \file */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/lex_test.c b/tests/isc/lex_test.c index cf6bfe2ea5..47a40ddb4a 100644 --- a/tests/isc/lex_test.c +++ b/tests/isc/lex_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/md_test.c b/tests/isc/md_test.c index d7d154c13b..aff12e43c7 100644 --- a/tests/isc/md_test.c +++ b/tests/isc/md_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/netaddr_test.c b/tests/isc/netaddr_test.c index b44982c26b..2394e11166 100644 --- a/tests/isc/netaddr_test.c +++ b/tests/isc/netaddr_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/netmgr_test.c b/tests/isc/netmgr_test.c index b2745521f7..a20db6b424 100644 --- a/tests/isc/netmgr_test.c +++ b/tests/isc/netmgr_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/pool_test.c b/tests/isc/pool_test.c index 7c44594b6c..35d556fd5f 100644 --- a/tests/isc/pool_test.c +++ b/tests/isc/pool_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/quota_test.c b/tests/isc/quota_test.c index 9ff0cc6d32..9b202b9390 100644 --- a/tests/isc/quota_test.c +++ b/tests/isc/quota_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/radix_test.c b/tests/isc/radix_test.c index 2fe9294d69..1e03e52f2d 100644 --- a/tests/isc/radix_test.c +++ b/tests/isc/radix_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/regex_test.c b/tests/isc/regex_test.c index dd44d3bc89..12051f18d9 100644 --- a/tests/isc/regex_test.c +++ b/tests/isc/regex_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/result_test.c b/tests/isc/result_test.c index cca66b85d6..cec195bef4 100644 --- a/tests/isc/result_test.c +++ b/tests/isc/result_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/safe_test.c b/tests/isc/safe_test.c index 39221649c2..a3f01fe9af 100644 --- a/tests/isc/safe_test.c +++ b/tests/isc/safe_test.c @@ -13,6 +13,7 @@ /* ! \file */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/siphash_test.c b/tests/isc/siphash_test.c index 5480afd791..5e93980197 100644 --- a/tests/isc/siphash_test.c +++ b/tests/isc/siphash_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/sockaddr_test.c b/tests/isc/sockaddr_test.c index 126bfa9fe4..c65ed7645d 100644 --- a/tests/isc/sockaddr_test.c +++ b/tests/isc/sockaddr_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/stats_test.c b/tests/isc/stats_test.c index 79d784e2df..a4753236e5 100644 --- a/tests/isc/stats_test.c +++ b/tests/isc/stats_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/symtab_test.c b/tests/isc/symtab_test.c index bcbc0c43bb..795a455142 100644 --- a/tests/isc/symtab_test.c +++ b/tests/isc/symtab_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/taskpool_test.c b/tests/isc/taskpool_test.c index a9416f647c..a92e0ad22e 100644 --- a/tests/isc/taskpool_test.c +++ b/tests/isc/taskpool_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isc/time_test.c b/tests/isc/time_test.c index 70858e90d6..6b0f32950f 100644 --- a/tests/isc/time_test.c +++ b/tests/isc/time_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/isccfg/duration_test.c b/tests/isccfg/duration_test.c index a1fc0ddfdb..32028a5f62 100644 --- a/tests/isccfg/duration_test.c +++ b/tests/isccfg/duration_test.c @@ -11,11 +11,11 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include #include -#include #include #include #include diff --git a/tests/isccfg/parser_test.c b/tests/isccfg/parser_test.c index 9a524ea2ad..89a3ba4018 100644 --- a/tests/isccfg/parser_test.c +++ b/tests/isccfg/parser_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/ns/listenlist_test.c b/tests/ns/listenlist_test.c index e15baf9adc..53d5783a8e 100644 --- a/tests/ns/listenlist_test.c +++ b/tests/ns/listenlist_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/ns/notify_test.c b/tests/ns/notify_test.c index 6373f0656d..1b962e3e82 100644 --- a/tests/ns/notify_test.c +++ b/tests/ns/notify_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include /* IWYU pragma: keep */ #include #include diff --git a/tests/ns/plugin_test.c b/tests/ns/plugin_test.c index 6434fae3a4..24d021e4c9 100644 --- a/tests/ns/plugin_test.c +++ b/tests/ns/plugin_test.c @@ -11,6 +11,7 @@ * information regarding copyright ownership. */ +#include #include #include /* IWYU pragma: keep */ #include From b2b3899af7f0704940958874763acd3b0999dae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 18 May 2023 15:12:23 +0200 Subject: [PATCH 2/2] Fix cmocka-related compiler warnings in ht_test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/isc/ht_test.c triggers the following compiler warnings when built against development versions of cmocka: In file included from ht_test.c:24: ht_test.c: In function ‘test_ht_full’: ht_test.c:69:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion] 69 | assert_ptr_equal((void *)i, (uintptr_t)f); /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’ 1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__) | ^ /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’ 2907 | const void *b, | ~~~~~~~~~~~~^ ht_test.c:164:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion] 164 | assert_ptr_equal((void *)i, (uintptr_t)f); /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’ 1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__) | ^ /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’ 2907 | const void *b, | ~~~~~~~~~~~~^ These are caused by a change to the definitions of pointer assert functions in cmocka's development branch [1]. Fix by casting the affected variables to (void *) instead of (uintptr_t). [1] https://git.cryptomilk.org/projects/cmocka.git/commit/?id=09621179af67535788a67957a910d9f17c975b45 (cherry picked from commit 8d36e68c7ae69ceab1d62ce70e95ecc930d746c4) --- tests/isc/ht_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/isc/ht_test.c b/tests/isc/ht_test.c index e656f03c84..89e18f37b5 100644 --- a/tests/isc/ht_test.c +++ b/tests/isc/ht_test.c @@ -66,7 +66,7 @@ test_ht_full(int bits, uintptr_t count) { strlcat((char *)key, " key of a raw hashtable!!", sizeof(key)); result = isc_ht_find(ht, key, 16, &f); assert_int_equal(result, ISC_R_SUCCESS); - assert_ptr_equal((void *)i, (uintptr_t)f); + assert_ptr_equal((void *)i, (void *)f); } for (i = 1; i < count; i++) { @@ -161,7 +161,7 @@ test_ht_full(int bits, uintptr_t count) { strlcat((char *)key, " KEY of a raw hashtable!!", sizeof(key)); result = isc_ht_find(ht, key, 16, &f); assert_int_equal(result, ISC_R_SUCCESS); - assert_ptr_equal((void *)i, (uintptr_t)f); + assert_ptr_equal((void *)i, (void *)f); } for (i = 1; i < count; i++) {