bind9/lib/dns
Ondřej Surý 63fe9312ff Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.

This commit does several things:

1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
   conditionals.

2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
   implementations, test lists, and the main test routine, so we don't
   have to repeat this all over again.  The macros were modeled after
   libuv test suite but adapted to cmocka as the test driver.

   A simple example of a unit test would be:

    ISC_RUN_TEST_IMPL(test1) { assert_true(true); }

    ISC_TEST_LIST_START
    ISC_TEST_ENTRY(test1)
    ISC_TEST_LIST_END

    ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)

   For more complicated examples including group setup and teardown
   functions, and per-test setup and teardown functions.

3. The macros prefix the test functions and cmocka entries, so the name
   of the test can now match the tested function name, and we don't have
   to append `_test` because `run_test_` is automatically prepended to
   the main test function, and `setup_test_` and `teardown_test_` is
   prepended to setup and teardown function.

4. Update all the unit tests to use the new syntax and fix a few bits
   here and there.

5. In the future, we can separate the test declarations and test
   implementations which are going to greatly help with uncluttering the
   bigger unit tests like doh_test and netmgr_test, because the test
   implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
   and `ISC_RUN_TEST_IMPL` for more details.

NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros.  There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-28 14:52:56 -07:00
..
include Give the unit tests a big overhaul 2022-05-28 14:52:56 -07:00
rdata Check that SIG and RRSIG records for private algorithms are valid 2022-04-28 15:54:27 -07:00
tests Give the unit tests a big overhaul 2022-05-28 14:52:56 -07:00
.gitignore 4394. [func] Add rndc command "dnstap-reopen" to close and 2016-06-24 09:37:04 +10:00
acl.c Add isc_rwlock around dns_aclenv .localhost and .localnets member 2022-04-04 19:27:00 +02:00
adb.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
badcache.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
byaddr.c Remove dns_lookup and unused functions in dns_byaddr 2022-05-25 14:44:32 +02:00
cache.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
callbacks.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
catz.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
client.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
clientinfo.c allow dns_clientinfo to store client ECS data 2022-01-27 13:53:59 -08:00
compress.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
db.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
dbiterator.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
diff.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
dispatch.c Handle ISC_R_SUCCESS on a deactivated response in udp_recv() 2022-04-27 15:53:14 +00:00
dlz.c Set hard thread affinity for each zone 2022-04-01 23:50:34 +02:00
dns64.c Add isc_rwlock around dns_aclenv .localhost and .localnets member 2022-04-04 19:27:00 +02:00
dnsrps.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
dnssec.c Cleanup dns_message_gettemp*() functions - they cannot fail 2022-05-17 12:39:25 +02:00
dnstap.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
dnstap.proto Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
ds.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
dst_api.c Require valid key for dst_key functions 2022-05-23 11:36:36 +02:00
dst_internal.h Check if key metadata is modified before writing 2022-05-13 13:31:17 +02:00
dst_openssl.h Use autoconf check for BN_GENCB_new() 2022-03-02 10:48:09 +00:00
dst_parse.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
dst_parse.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
dyndb.c Move netmgr/uv-compat.h to <isc/uv.h> 2022-05-03 10:02:19 +02:00
ecs.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
fixedname.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
forward.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
gen.c Merge lib/dns/gen.h contents to lib/dns/gen.c 2022-03-04 14:13:58 +01:00
geoip2.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
gssapi_link.c Remove a redundant variable-length array 2022-03-18 15:06:31 +00:00
gssapictx.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
hmac_link.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
ipkeylist.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
iptable.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
journal.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
kasp.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
key.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
keydata.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
keymgr.c Check if key metadata is modified before writing 2022-05-13 13:31:17 +02:00
keytable.c Clean up #include <isc/string.h> 2022-05-03 12:38:59 +00:00
log.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
Makefile.am Remove dns_lookup and unused functions in dns_byaddr 2022-05-25 14:44:32 +02:00
master.c Prevent arithmetic overflow of 'i' in master.c:generate 2022-04-01 07:56:52 +00:00
masterdump.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
message.c Cleanup dns_message_gettemp*() functions - they cannot fail 2022-05-17 12:39:25 +02:00
name.c consolidate fibonacci hashing in one place 2022-03-28 14:44:21 -07:00
ncache.c Update the rdataset->trust field in ncache.c:rdataset_settrust 2022-04-19 08:38:26 +10:00
nsec.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
nsec3.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
nta.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
openssl_link.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
openssl_shim.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
openssl_shim.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
openssldh_link.c Use autoconf check for BN_GENCB_new() 2022-03-02 10:48:09 +00:00
opensslecdsa_link.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
openssleddsa_link.c Add couple missing braces around single-line statements 2022-03-17 18:27:45 +01:00
opensslrsa_link.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
order.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
peer.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
private.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rbt.c Remove unused rbtnode->rpz flag 2022-05-02 19:47:58 +01:00
rbtdb.c Cleanup dns_message_gettemp*() functions - they cannot fail 2022-05-17 12:39:25 +02:00
rbtdb.h Remove remaining checks for rbt64 2022-05-03 00:41:42 +01:00
rcode.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdata.c Additional safety check for negative array index 2022-04-29 11:22:40 +10:00
rdatalist.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdatalist_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdataset.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
rdatasetiter.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdataslab.c Clean up #include <isc/string.h> 2022-05-03 12:38:59 +00:00
request.c remove requestmgr whenshutdown events 2022-05-13 13:39:52 -07:00
resolver.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
result.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rootns.c Clean up #include <isc/string.h> 2022-05-03 12:38:59 +00:00
rpz.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
rriterator.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rrl.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
sdb.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
sdlz.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
soa.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
ssu.c Add isc_rwlock around dns_aclenv .localhost and .localnets member 2022-04-04 19:27:00 +02:00
ssu_external.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
stats.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
test.c Give the unit tests a big overhaul 2022-05-28 14:52:56 -07:00
time.c Clean up #include <isc/string.h> 2022-05-03 12:38:59 +00:00
tkey.c Cleanup dns_message_gettemp*() functions - they cannot fail 2022-05-17 12:39:25 +02:00
transport.c Rename "hostname" to "remote-hostname" within "tls" 2022-05-03 17:15:43 +03:00
tsec.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
tsig.c Cleanup dns_message_gettemp*() functions - they cannot fail 2022-05-17 12:39:25 +02:00
tsig_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
ttl.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
update.c Create per-thread task and memory context for zonemgr 2022-04-01 23:50:34 +02:00
validator.c the validator can attach to the view normally 2022-05-13 13:36:10 -07:00
view.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
xfrin.c CID 352848: split xfrin_start() and remove dead code 2022-05-25 12:38:38 +03:00
zone.c Make all tasks to be bound to a thread 2022-05-25 16:04:51 +02:00
zone_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
zonekey.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
zoneverify.c Eliminate a variable that can confuse the compiler 2022-05-02 21:11:12 +01:00
zt.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00