From 2c3b2dabe9a6b3c4a10f6498a1169f39ed031eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 3 May 2022 11:37:31 +0200 Subject: [PATCH] Move all the unit tests to /tests// The unit tests are now using a common base, which means that lib/dns/tests/ code now has to include lib/isc/include/isc/test.h and link with lib/isc/test.c and lib/ns/tests has to include both libisc and libdns parts. Instead of cross-linking code between the directories, move the /lib//test.c to /tests/.c and /lib//include/test.h to /tests/include/tests/.h and create a single libtest.la convenience library in /tests/. At the same time, move the /lib//tests/ to /tests// (but keep it symlinked to the old location) and adjust paths accordingly. In few places, we are now using absolute paths instead of relative paths, because the directory level has changed. By moving the directories under the /tests/ directory, the test-related code is kept in a single place and we can avoid referencing files between libns->libdns->libisc which is unhealthy because they live in a separate Makefile-space. In the future, the /bin/tests/ should be merged to /tests/ and symlink kept, and the /fuzz/ directory moved to /tests/fuzz/. --- .clang-format | 8 ++--- .clang-format.headers | 8 ++--- Makefile.am | 6 +++- Makefile.tests | 7 ++-- configure.ac | 15 +++++---- lib/dns/Makefile.am | 4 --- lib/dns/tests | 1 + lib/irs/Makefile.am | 4 --- lib/irs/tests | 1 + lib/isc/Makefile.am | 4 --- lib/isc/tests | 1 + lib/isccfg/Makefile.am | 4 --- lib/isccfg/tests | 1 + lib/ns/Makefile.am | 4 --- lib/ns/tests | 1 + tests/.gitignore | 1 + tests/Makefile.am | 30 ++++++++++++++++++ lib/dns/test.c => tests/dns.c | 2 +- {lib/dns/tests => tests/dns}/.gitignore | 0 .../tests => tests/dns}/Kdh.+002+18602.key | 0 .../tests => tests/dns}/Krsa.+005+29235.key | 0 {lib/dns/tests => tests/dns}/Makefile.am | 15 +++------ {lib/dns/tests => tests/dns}/acl_test.c | 2 +- .../comparekeys/Kexample-d.+008+53461.key | 0 .../comparekeys/Kexample-d.+008+53461.private | 0 .../comparekeys/Kexample-e.+008+53973.key | 0 .../comparekeys/Kexample-e.+008+53973.private | 0 .../comparekeys/Kexample-n.+008+37464.key | 0 .../comparekeys/Kexample-n.+008+37464.private | 0 .../comparekeys/Kexample-p.+008+53461.key | 0 .../comparekeys/Kexample-p.+008+53461.private | 0 .../Kexample-private.+002+65316.key | 0 .../Kexample-private.+002+65316.private | 0 .../comparekeys/Kexample-q.+008+53461.key | 0 .../comparekeys/Kexample-q.+008+53461.private | 0 .../dns}/comparekeys/Kexample.+002+65316.key | 0 .../comparekeys/Kexample.+002+65316.private | 0 .../dns}/comparekeys/Kexample.+008+53461.key | 0 .../comparekeys/Kexample.+008+53461.private | 0 .../dns}/comparekeys/Kexample.+013+19786.key | 0 .../comparekeys/Kexample.+013+19786.private | 0 .../dns}/comparekeys/Kexample.+015+63663.key | 0 .../comparekeys/Kexample.+015+63663.private | 0 .../dns}/comparekeys/Kexample2.+002+19823.key | 0 .../comparekeys/Kexample2.+002+19823.private | 0 .../dns}/comparekeys/Kexample2.+008+37993.key | 0 .../comparekeys/Kexample2.+008+37993.private | 0 .../dns}/comparekeys/Kexample2.+013+16384.key | 0 .../comparekeys/Kexample2.+013+16384.private | 0 .../dns}/comparekeys/Kexample2.+015+37529.key | 0 .../comparekeys/Kexample2.+015+37529.private | 0 .../dns}/comparekeys/Kexample3.+002+17187.key | 0 .../comparekeys/Kexample3.+002+17187.private | 0 {lib/dns/tests => tests/dns}/db_test.c | 2 +- {lib/dns/tests => tests/dns}/dbdiff_test.c | 2 +- .../dns/tests => tests/dns}/dbiterator_test.c | 2 +- {lib/dns/tests => tests/dns}/dbversion_test.c | 2 +- {lib/dns/tests => tests/dns}/dh_test.c | 4 +-- {lib/dns/tests => tests/dns}/dispatch_test.c | 2 +- {lib/dns/tests => tests/dns}/dns64_test.c | 2 +- {lib/dns/tests => tests/dns}/dnstap_test.c | 10 +++--- {lib/dns/tests => tests/dns}/dst_test.c | 4 +-- {lib/dns/tests => tests/dns}/geoip_test.c | 7 ++-- {lib/dns/tests => tests/dns}/keytable_test.c | 2 +- {lib/dns/tests => tests/dns}/master_test.c | 2 +- {lib/dns/tests => tests/dns}/mkraw.pl | 0 {lib/dns/tests => tests/dns}/name_test.c | 2 +- {lib/dns/tests => tests/dns}/nsec3_test.c | 2 +- .../dns/tests => tests/dns}/nsec3param_test.c | 4 +-- {lib/dns/tests => tests/dns}/peer_test.c | 2 +- {lib/dns/tests => tests/dns}/private_test.c | 2 +- {lib/dns/tests => tests/dns}/rbt_test.c | 2 +- {lib/dns/tests => tests/dns}/rbtdb_test.c | 8 +++-- {lib/dns/tests => tests/dns}/rdata_test.c | 2 +- {lib/dns/tests => tests/dns}/rdataset_test.c | 2 +- .../tests => tests/dns}/rdatasetstats_test.c | 2 +- {lib/dns/tests => tests/dns}/resolver_test.c | 2 +- {lib/dns/tests => tests/dns}/rsa_test.c | 4 +-- {lib/dns/tests => tests/dns}/sigs_test.c | 4 +-- .../tests => tests/dns}/testdata/db/data.db | 0 .../dns}/testdata/dbiterator/zone1.data | 0 .../dns}/testdata/dbiterator/zone2.data | 0 .../dns}/testdata/diff/zone1.data | 0 .../dns}/testdata/diff/zone2.data | 0 .../dns}/testdata/diff/zone3.data | 0 .../dns}/testdata/dnstap/dnstap.saved | Bin .../dns}/testdata/dnstap/dnstap.text | 0 .../dns}/testdata/dnstap/query.auth | 0 .../dns}/testdata/dnstap/query.recursive | 0 .../dns}/testdata/dnstap/response.auth | 0 .../dns}/testdata/dnstap/response.recursive | 0 .../dns}/testdata/dst/Ktest.+008+11349.key | 0 .../testdata/dst/Ktest.+008+11349.private | 0 .../dns}/testdata/dst/Ktest.+013+49130.key | 0 .../testdata/dst/Ktest.+013+49130.private | 0 .../dns}/testdata/dst/test1.data | 0 .../dns}/testdata/dst/test1.ecdsa256sig | 0 .../dns}/testdata/dst/test1.rsasha256sig | 0 .../dns}/testdata/dst/test2.data | 0 .../dns}/testdata/dstrandom/random.data | Bin .../dns}/testdata/master/.gitignore | 0 .../dns}/testdata/master/master1.data | 0 .../dns}/testdata/master/master10.data | 0 .../dns}/testdata/master/master11.data | 0 .../dns}/testdata/master/master12.data.in | 0 .../dns}/testdata/master/master13.data.in | 0 .../dns}/testdata/master/master14.data.in | 0 .../dns}/testdata/master/master15.data | 0 .../dns}/testdata/master/master16.data | 0 .../dns}/testdata/master/master17.data | 0 .../dns}/testdata/master/master18.data | 0 .../dns}/testdata/master/master2.data | 0 .../dns}/testdata/master/master3.data | 0 .../dns}/testdata/master/master4.data | 0 .../dns}/testdata/master/master5.data | 0 .../dns}/testdata/master/master6.data | 0 .../dns}/testdata/master/master7.data | 0 .../dns}/testdata/master/master8.data | 0 .../dns}/testdata/master/master9.data | 0 .../dns}/testdata/nsec3/1024.db | 0 .../dns}/testdata/nsec3/2048.db | 0 .../dns}/testdata/nsec3/4096.db | 0 .../dns}/testdata/nsec3/min-1024.db | 0 .../dns}/testdata/nsec3/min-2048.db | 0 .../dns}/testdata/nsec3param/nsec3.db.signed | 0 .../tests => tests/dns}/testdata/zt/zone1.db | 0 .../dns}/testkeys/Kexample.+008+20386.key | 0 .../dns}/testkeys/Kexample.+008+20386.private | 0 .../dns}/testkeys/Kexample.+008+37464.key | 0 .../dns}/testkeys/Kexample.+008+37464.private | 0 {lib/dns/tests => tests/dns}/time_test.c | 2 +- {lib/dns/tests => tests/dns}/tsig_test.c | 4 +-- {lib/dns/tests => tests/dns}/update_test.c | 8 +++-- {lib/dns/tests => tests/dns}/zonemgr_test.c | 2 +- {lib/dns/tests => tests/dns}/zt_test.c | 2 +- tests/include/tests/.clang-format | 1 + .../dns/test.h => tests/include/tests/dns.h | 2 +- .../isc/test.h => tests/include/tests/isc.h | 6 ++-- .../ns/test.h => tests/include/tests/ns.h | 2 +- {lib/irs/tests => tests/irs}/Makefile.am | 0 {lib/irs/tests => tests/irs}/resconf_test.c | 0 .../tests => tests/irs}/testdata/domain.conf | 0 .../irs}/testdata/nameserver-v4.conf | 0 .../irs}/testdata/nameserver-v6-scoped.conf | 0 .../irs}/testdata/nameserver-v6.conf | 0 .../irs}/testdata/options-attempts.conf | 0 .../irs}/testdata/options-bad-ndots.conf | 0 .../irs}/testdata/options-debug.conf | 0 .../irs}/testdata/options-empty.conf | 0 .../irs}/testdata/options-ndots.conf | 0 .../irs}/testdata/options-timeout.conf | 0 .../irs}/testdata/options-unknown.conf | 0 .../tests => tests/irs}/testdata/options.conf | 0 .../tests => tests/irs}/testdata/port.conf | 0 .../tests => tests/irs}/testdata/resolv.conf | 0 .../tests => tests/irs}/testdata/search.conf | 0 .../irs}/testdata/sortlist-v4.conf | 0 .../tests => tests/irs}/testdata/timeout.conf | 0 .../tests => tests/irs}/testdata/unknown.conf | 0 lib/isc/test.c => tests/isc.c | 8 ++--- {lib/isc/tests => tests/isc}/Makefile.am | 9 +----- {lib/isc/tests => tests/isc}/aes_test.c | 2 +- {lib/isc/tests => tests/isc}/buffer_test.c | 2 +- {lib/isc/tests => tests/isc}/counter_test.c | 2 +- {lib/isc/tests => tests/isc}/crc64_test.c | 2 +- {lib/isc/tests => tests/isc}/doh_test.c | 10 +++--- {lib/isc/tests => tests/isc}/errno_test.c | 2 +- {lib/isc/tests => tests/isc}/file_test.c | 2 +- {lib/isc/tests => tests/isc}/hash_test.c | 2 +- {lib/isc/tests => tests/isc}/heap_test.c | 2 +- {lib/isc/tests => tests/isc}/hmac_test.c | 4 +-- {lib/isc/tests => tests/isc}/ht_test.c | 4 +-- {lib/isc/tests => tests/isc}/lex_test.c | 2 +- {lib/isc/tests => tests/isc}/md_test.c | 4 +-- {lib/isc/tests => tests/isc}/mem_test.c | 4 +-- {lib/isc/tests => tests/isc}/netaddr_test.c | 2 +- {lib/isc/tests => tests/isc}/netmgr_test.c | 10 +++--- {lib/isc/tests => tests/isc}/parse_test.c | 2 +- {lib/isc/tests => tests/isc}/quota_test.c | 6 ++-- {lib/isc/tests => tests/isc}/radix_test.c | 2 +- {lib/isc/tests => tests/isc}/random_test.c | 2 +- {lib/isc/tests => tests/isc}/regex_test.c | 2 +- {lib/isc/tests => tests/isc}/result_test.c | 2 +- {lib/isc/tests => tests/isc}/safe_test.c | 2 +- {lib/isc/tests => tests/isc}/siphash_test.c | 4 +-- {lib/isc/tests => tests/isc}/sockaddr_test.c | 2 +- {lib/isc/tests => tests/isc}/stats_test.c | 2 +- {lib/isc/tests => tests/isc}/symtab_test.c | 2 +- {lib/isc/tests => tests/isc}/task_test.c | 8 ++--- .../tests => tests/isc}/testdata/file/keep | 0 {lib/isc/tests => tests/isc}/time_test.c | 4 +-- {lib/isc/tests => tests/isc}/timer_test.c | 8 ++--- {lib/isc/tests => tests/isc}/uv_wrap.h | 0 .../isccfg/tests => tests/isccfg}/Makefile.am | 9 ++---- .../tests => tests/isccfg}/duration_test.c | 2 +- .../tests => tests/isccfg}/parser_test.c | 2 +- lib/ns/test.c => tests/ns.c | 2 +- {lib/ns/tests => tests/ns}/Makefile.am | 14 ++------ {lib/ns/tests => tests/ns}/listenlist_test.c | 2 +- {lib/ns/tests => tests/ns}/notify_test.c | 5 ++- {lib/ns/tests => tests/ns}/plugin_test.c | 2 +- {lib/ns/tests => tests/ns}/query_test.c | 2 +- .../ns}/testdata/notify/notify1.msg | 0 .../ns}/testdata/notify/zone1.db | 0 .../tests => tests/ns}/testdata/query/foo.db | 0 {lib => tests}/unit-test-driver.sh.in | 0 206 files changed, 190 insertions(+), 198 deletions(-) create mode 120000 lib/dns/tests create mode 120000 lib/irs/tests create mode 120000 lib/isc/tests create mode 120000 lib/isccfg/tests create mode 120000 lib/ns/tests create mode 100644 tests/.gitignore create mode 100644 tests/Makefile.am rename lib/dns/test.c => tests/dns.c (99%) rename {lib/dns/tests => tests/dns}/.gitignore (100%) rename {lib/dns/tests => tests/dns}/Kdh.+002+18602.key (100%) rename {lib/dns/tests => tests/dns}/Krsa.+005+29235.key (100%) rename {lib/dns/tests => tests/dns}/Makefile.am (89%) rename {lib/dns/tests => tests/dns}/acl_test.c (99%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-d.+008+53461.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-d.+008+53461.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-e.+008+53973.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-e.+008+53973.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-n.+008+37464.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-n.+008+37464.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-p.+008+53461.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-p.+008+53461.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-private.+002+65316.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-private.+002+65316.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-q.+008+53461.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample-q.+008+53461.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+002+65316.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+002+65316.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+008+53461.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+008+53461.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+013+19786.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+013+19786.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+015+63663.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample.+015+63663.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+002+19823.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+002+19823.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+008+37993.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+008+37993.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+013+16384.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+013+16384.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+015+37529.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample2.+015+37529.private (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample3.+002+17187.key (100%) rename {lib/dns/tests => tests/dns}/comparekeys/Kexample3.+002+17187.private (100%) rename {lib/dns/tests => tests/dns}/db_test.c (99%) rename {lib/dns/tests => tests/dns}/dbdiff_test.c (99%) rename {lib/dns/tests => tests/dns}/dbiterator_test.c (99%) rename {lib/dns/tests => tests/dns}/dbversion_test.c (99%) rename {lib/dns/tests => tests/dns}/dh_test.c (97%) rename {lib/dns/tests => tests/dns}/dispatch_test.c (99%) rename {lib/dns/tests => tests/dns}/dns64_test.c (99%) rename {lib/dns/tests => tests/dns}/dnstap_test.c (97%) rename {lib/dns/tests => tests/dns}/dst_test.c (99%) rename {lib/dns/tests => tests/dns}/geoip_test.c (98%) rename {lib/dns/tests => tests/dns}/keytable_test.c (99%) rename {lib/dns/tests => tests/dns}/master_test.c (99%) rename {lib/dns/tests => tests/dns}/mkraw.pl (100%) rename {lib/dns/tests => tests/dns}/name_test.c (99%) rename {lib/dns/tests => tests/dns}/nsec3_test.c (99%) rename {lib/dns/tests => tests/dns}/nsec3param_test.c (99%) rename {lib/dns/tests => tests/dns}/peer_test.c (99%) rename {lib/dns/tests => tests/dns}/private_test.c (99%) rename {lib/dns/tests => tests/dns}/rbt_test.c (99%) rename {lib/dns/tests => tests/dns}/rbtdb_test.c (98%) rename {lib/dns/tests => tests/dns}/rdata_test.c (99%) rename {lib/dns/tests => tests/dns}/rdataset_test.c (99%) rename {lib/dns/tests => tests/dns}/rdatasetstats_test.c (99%) rename {lib/dns/tests => tests/dns}/resolver_test.c (99%) rename {lib/dns/tests => tests/dns}/rsa_test.c (99%) rename {lib/dns/tests => tests/dns}/sigs_test.c (99%) rename {lib/dns/tests => tests/dns}/testdata/db/data.db (100%) rename {lib/dns/tests => tests/dns}/testdata/dbiterator/zone1.data (100%) rename {lib/dns/tests => tests/dns}/testdata/dbiterator/zone2.data (100%) rename {lib/dns/tests => tests/dns}/testdata/diff/zone1.data (100%) rename {lib/dns/tests => tests/dns}/testdata/diff/zone2.data (100%) rename {lib/dns/tests => tests/dns}/testdata/diff/zone3.data (100%) rename {lib/dns/tests => tests/dns}/testdata/dnstap/dnstap.saved (100%) rename {lib/dns/tests => tests/dns}/testdata/dnstap/dnstap.text (100%) rename {lib/dns/tests => tests/dns}/testdata/dnstap/query.auth (100%) rename {lib/dns/tests => tests/dns}/testdata/dnstap/query.recursive (100%) rename {lib/dns/tests => tests/dns}/testdata/dnstap/response.auth (100%) rename {lib/dns/tests => tests/dns}/testdata/dnstap/response.recursive (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/Ktest.+008+11349.key (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/Ktest.+008+11349.private (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/Ktest.+013+49130.key (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/Ktest.+013+49130.private (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/test1.data (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/test1.ecdsa256sig (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/test1.rsasha256sig (100%) rename {lib/dns/tests => tests/dns}/testdata/dst/test2.data (100%) rename {lib/dns/tests => tests/dns}/testdata/dstrandom/random.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/.gitignore (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master1.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master10.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master11.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master12.data.in (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master13.data.in (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master14.data.in (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master15.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master16.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master17.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master18.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master2.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master3.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master4.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master5.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master6.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master7.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master8.data (100%) rename {lib/dns/tests => tests/dns}/testdata/master/master9.data (100%) rename {lib/dns/tests => tests/dns}/testdata/nsec3/1024.db (100%) rename {lib/dns/tests => tests/dns}/testdata/nsec3/2048.db (100%) rename {lib/dns/tests => tests/dns}/testdata/nsec3/4096.db (100%) rename {lib/dns/tests => tests/dns}/testdata/nsec3/min-1024.db (100%) rename {lib/dns/tests => tests/dns}/testdata/nsec3/min-2048.db (100%) rename {lib/dns/tests => tests/dns}/testdata/nsec3param/nsec3.db.signed (100%) rename {lib/dns/tests => tests/dns}/testdata/zt/zone1.db (100%) rename {lib/dns/tests => tests/dns}/testkeys/Kexample.+008+20386.key (100%) rename {lib/dns/tests => tests/dns}/testkeys/Kexample.+008+20386.private (100%) rename {lib/dns/tests => tests/dns}/testkeys/Kexample.+008+37464.key (100%) rename {lib/dns/tests => tests/dns}/testkeys/Kexample.+008+37464.private (100%) rename {lib/dns/tests => tests/dns}/time_test.c (99%) rename {lib/dns/tests => tests/dns}/tsig_test.c (99%) rename {lib/dns/tests => tests/dns}/update_test.c (99%) rename {lib/dns/tests => tests/dns}/zonemgr_test.c (99%) rename {lib/dns/tests => tests/dns}/zt_test.c (99%) create mode 120000 tests/include/tests/.clang-format rename lib/dns/include/dns/test.h => tests/include/tests/dns.h (99%) rename lib/isc/include/isc/test.h => tests/include/tests/isc.h (98%) rename lib/ns/include/ns/test.h => tests/include/tests/ns.h (99%) rename {lib/irs/tests => tests/irs}/Makefile.am (100%) rename {lib/irs/tests => tests/irs}/resconf_test.c (100%) rename {lib/irs/tests => tests/irs}/testdata/domain.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/nameserver-v4.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/nameserver-v6-scoped.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/nameserver-v6.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options-attempts.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options-bad-ndots.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options-debug.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options-empty.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options-ndots.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options-timeout.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options-unknown.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/options.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/port.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/resolv.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/search.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/sortlist-v4.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/timeout.conf (100%) rename {lib/irs/tests => tests/irs}/testdata/unknown.conf (100%) rename lib/isc/test.c => tests/isc.c (94%) rename {lib/isc/tests => tests/isc}/Makefile.am (90%) rename {lib/isc/tests => tests/isc}/aes_test.c (99%) rename {lib/isc/tests => tests/isc}/buffer_test.c (99%) rename {lib/isc/tests => tests/isc}/counter_test.c (98%) rename {lib/isc/tests => tests/isc}/crc64_test.c (98%) rename {lib/isc/tests => tests/isc}/doh_test.c (99%) rename {lib/isc/tests => tests/isc}/errno_test.c (99%) rename {lib/isc/tests => tests/isc}/file_test.c (99%) rename {lib/isc/tests => tests/isc}/hash_test.c (98%) rename {lib/isc/tests => tests/isc}/heap_test.c (98%) rename {lib/isc/tests => tests/isc}/hmac_test.c (99%) rename {lib/isc/tests => tests/isc}/ht_test.c (99%) rename {lib/isc/tests => tests/isc}/lex_test.c (99%) rename {lib/isc/tests => tests/isc}/md_test.c (99%) rename {lib/isc/tests => tests/isc}/mem_test.c (99%) rename {lib/isc/tests => tests/isc}/netaddr_test.c (99%) rename {lib/isc/tests => tests/isc}/netmgr_test.c (99%) rename {lib/isc/tests => tests/isc}/parse_test.c (98%) rename {lib/isc/tests => tests/isc}/quota_test.c (99%) rename {lib/isc/tests => tests/isc}/radix_test.c (98%) rename {lib/isc/tests => tests/isc}/random_test.c (99%) rename {lib/isc/tests => tests/isc}/regex_test.c (99%) rename {lib/isc/tests => tests/isc}/result_test.c (98%) rename {lib/isc/tests => tests/isc}/safe_test.c (98%) rename {lib/isc/tests => tests/isc}/siphash_test.c (99%) rename {lib/isc/tests => tests/isc}/sockaddr_test.c (99%) rename {lib/isc/tests => tests/isc}/stats_test.c (99%) rename {lib/isc/tests => tests/isc}/symtab_test.c (99%) rename {lib/isc/tests => tests/isc}/task_test.c (99%) rename {lib/isc/tests => tests/isc}/testdata/file/keep (100%) rename {lib/isc/tests => tests/isc}/time_test.c (99%) rename {lib/isc/tests => tests/isc}/timer_test.c (99%) rename {lib/isc/tests => tests/isc}/uv_wrap.h (100%) rename {lib/isccfg/tests => tests/isccfg}/Makefile.am (61%) rename {lib/isccfg/tests => tests/isccfg}/duration_test.c (99%) rename {lib/isccfg/tests => tests/isccfg}/parser_test.c (99%) rename lib/ns/test.c => tests/ns.c (99%) rename {lib/ns/tests => tests/ns}/Makefile.am (55%) rename {lib/ns/tests => tests/ns}/listenlist_test.c (99%) rename {lib/ns/tests => tests/ns}/notify_test.c (98%) rename {lib/ns/tests => tests/ns}/plugin_test.c (99%) rename {lib/ns/tests => tests/ns}/query_test.c (99%) rename {lib/ns/tests => tests/ns}/testdata/notify/notify1.msg (100%) rename {lib/ns/tests => tests/ns}/testdata/notify/zone1.db (100%) rename {lib/ns/tests => tests/ns}/testdata/query/foo.db (100%) rename {lib => tests}/unit-test-driver.sh.in (100%) diff --git a/.clang-format b/.clang-format index 44f50b0851..41a90bf5bb 100644 --- a/.clang-format +++ b/.clang-format @@ -34,12 +34,6 @@ PointerAlignment: Right PointerBindsToType: false IncludeBlocks: Regroup IncludeCategories: - - Regex: '^$' - Priority: 100 - - Regex: '^$' - Priority: 101 - - Regex: '^$' - Priority: 102 - Regex: '^$' - Priority: 100 - - Regex: '^$' - Priority: 101 - - Regex: '^$' - Priority: 102 - Regex: '^' Priority: 1 - Regex: '".*"' diff --git a/Makefile.am b/Makefile.am index f2005cfab7..2f09561659 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,10 @@ include $(top_srcdir)/Makefile.top SUBDIRS = . lib doc bin fuzz +if HAVE_CMOCKA +SUBDIRS += tests +endif HAVE_CMOCKA + BUILT_SOURCES = bind.keys.h CLEANFILES = bind.keys.h @@ -12,7 +16,7 @@ dist_sysconf_DATA = bind.keys .PHONY: doc -EXTRA_DIST = \ +EXTRA_DIST = \ util/bindkeys.pl \ contrib \ CHANGES \ diff --git a/Makefile.tests b/Makefile.tests index 7ae2c5ada1..d7b2e948e0 100644 --- a/Makefile.tests +++ b/Makefile.tests @@ -3,18 +3,21 @@ unit-local: check +if HAVE_CMOCKA TESTS = $(check_PROGRAMS) +endif HAVE_CMOCKA -LOG_COMPILER = $(builddir)/../../unit-test-driver.sh +LOG_COMPILER = $(top_builddir)/tests/unit-test-driver.sh AM_CFLAGS += \ + -I$(top_srcdir)/tests/include \ $(TEST_CFLAGS) AM_CPPFLAGS += \ $(CMOCKA_CFLAGS) \ -DNAMED_PLUGINDIR=\"$(pkglibdir)\" \ - -DSKIPPED_TEST_EXIT_CODE=77 \ -DTESTS_DIR=\"$(abs_srcdir)\" LDADD += \ + $(top_builddir)/tests/libtest.la \ $(CMOCKA_LIBS) diff --git a/configure.ac b/configure.ac index 7b284ef6da..b6b546e6c4 100644 --- a/configure.ac +++ b/configure.ac @@ -1581,14 +1581,15 @@ AC_CONFIG_FILES([doc/Makefile # Unit Tests -AC_CONFIG_FILES([lib/isc/tests/Makefile - lib/dns/tests/Makefile - lib/ns/tests/Makefile - lib/irs/tests/Makefile - lib/isccfg/tests/Makefile]) +AC_CONFIG_FILES([tests/Makefile + tests/isc/Makefile + tests/dns/Makefile + tests/ns/Makefile + tests/irs/Makefile + tests/isccfg/Makefile]) -AC_CONFIG_FILES([lib/unit-test-driver.sh], - [chmod +x lib/unit-test-driver.sh]) +AC_CONFIG_FILES([tests/unit-test-driver.sh], + [chmod +x tests/unit-test-driver.sh]) # System Tests diff --git a/lib/dns/Makefile.am b/lib/dns/Makefile.am index cf49c33b38..35602b2259 100644 --- a/lib/dns/Makefile.am +++ b/lib/dns/Makefile.am @@ -321,7 +321,3 @@ if HAVE_LMDB libdns_la_CPPFLAGS += $(LMDB_CFLAGS) libdns_la_LIBADD += $(LMDB_LIBS) endif - -if HAVE_CMOCKA -SUBDIRS = tests -endif diff --git a/lib/dns/tests b/lib/dns/tests new file mode 120000 index 0000000000..e4acc10b18 --- /dev/null +++ b/lib/dns/tests @@ -0,0 +1 @@ +../../tests/dns \ No newline at end of file diff --git a/lib/irs/Makefile.am b/lib/irs/Makefile.am index eac972b26d..85c4065af3 100644 --- a/lib/irs/Makefile.am +++ b/lib/irs/Makefile.am @@ -25,7 +25,3 @@ libirs_la_LIBADD = \ libirs_la_LDFLAGS = \ $(AM_LDFLAGS) \ -release "$(PACKAGE_VERSION)" - -if HAVE_CMOCKA -SUBDIRS = tests -endif diff --git a/lib/irs/tests b/lib/irs/tests new file mode 120000 index 0000000000..247a63e1e5 --- /dev/null +++ b/lib/irs/tests @@ -0,0 +1 @@ +../../tests/irs \ No newline at end of file diff --git a/lib/isc/Makefile.am b/lib/isc/Makefile.am index 16bb818f46..fb443b5d6e 100644 --- a/lib/isc/Makefile.am +++ b/lib/isc/Makefile.am @@ -251,7 +251,3 @@ libisc_la_CPPFLAGS += \ libisc_la_LIBADD += \ $(LIBXML2_LIBS) endif HAVE_LIBXML2 - -if HAVE_CMOCKA -SUBDIRS = tests -endif diff --git a/lib/isc/tests b/lib/isc/tests new file mode 120000 index 0000000000..9c8d7ce1d0 --- /dev/null +++ b/lib/isc/tests @@ -0,0 +1 @@ +../../tests/isc \ No newline at end of file diff --git a/lib/isccfg/Makefile.am b/lib/isccfg/Makefile.am index 3205e3b93b..32e905aa96 100644 --- a/lib/isccfg/Makefile.am +++ b/lib/isccfg/Makefile.am @@ -33,7 +33,3 @@ libisccfg_la_LIBADD = \ libisccfg_la_LDFLAGS = \ $(AM_LDFLAGS) \ -release "$(PACKAGE_VERSION)" - -if HAVE_CMOCKA -SUBDIRS = tests -endif diff --git a/lib/isccfg/tests b/lib/isccfg/tests new file mode 120000 index 0000000000..1d7dfaf423 --- /dev/null +++ b/lib/isccfg/tests @@ -0,0 +1 @@ +../../tests/isccfg \ No newline at end of file diff --git a/lib/ns/Makefile.am b/lib/ns/Makefile.am index b2d5d73b4c..eb86aebe18 100644 --- a/lib/ns/Makefile.am +++ b/lib/ns/Makefile.am @@ -55,7 +55,3 @@ libns_la_LIBADD = \ libns_la_LDFLAGS = \ $(AM_LDFLAGS) \ -release "$(PACKAGE_VERSION)" - -if HAVE_CMOCKA -SUBDIRS = tests -endif diff --git a/lib/ns/tests b/lib/ns/tests new file mode 120000 index 0000000000..0ec3da8d12 --- /dev/null +++ b/lib/ns/tests @@ -0,0 +1 @@ +../../tests/ns \ No newline at end of file diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000000..78fe21f457 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +/unit-test-driver.sh diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000000..0a19bb1d1f --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,30 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBNS_CFLAGS) \ + $(LIBUV_CFLAGS) \ + -I$(top_srcdir)/lib/isc + +LDADD += \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBNS_LIBS) + +SUBDIRS = . isc dns ns isccfg irs + +check_LTLIBRARIES = libtest.la + +noinst_libtest_ladir = . +noinst_libtest_la_HEADERS = \ + include/tests/dns.h \ + include/tests/isc.h \ + include/tests/ns.h +libtest_la_SOURCES = \ + $(noinst_libtest_la_HEADERS) \ + dns.c \ + isc.c \ + ns.c + +include $(top_srcdir)/Makefile.tests diff --git a/lib/dns/test.c b/tests/dns.c similarity index 99% rename from lib/dns/test.c rename to tests/dns.c index fa93486f00..bbe8ce6e43 100644 --- a/lib/dns/test.c +++ b/tests/dns.c @@ -53,7 +53,7 @@ #include #include -#include +#include dns_zonemgr_t *zonemgr = NULL; diff --git a/lib/dns/tests/.gitignore b/tests/dns/.gitignore similarity index 100% rename from lib/dns/tests/.gitignore rename to tests/dns/.gitignore diff --git a/lib/dns/tests/Kdh.+002+18602.key b/tests/dns/Kdh.+002+18602.key similarity index 100% rename from lib/dns/tests/Kdh.+002+18602.key rename to tests/dns/Kdh.+002+18602.key diff --git a/lib/dns/tests/Krsa.+005+29235.key b/tests/dns/Krsa.+005+29235.key similarity index 100% rename from lib/dns/tests/Krsa.+005+29235.key rename to tests/dns/Krsa.+005+29235.key diff --git a/lib/dns/tests/Makefile.am b/tests/dns/Makefile.am similarity index 89% rename from lib/dns/tests/Makefile.am rename to tests/dns/Makefile.am index 4dd04b39e4..0164a4ad87 100644 --- a/lib/dns/tests/Makefile.am +++ b/tests/dns/Makefile.am @@ -6,21 +6,15 @@ AM_CPPFLAGS += \ $(LIBUV_CFLAGS) \ $(KRB5_CFLAGS) \ -DSRCDIR=\"$(abs_srcdir)\" \ - -DBUILDDIR=\"$(abs_builddir)\" + -DBUILDDIR=\"$(abs_builddir)\" \ + -I$(top_srcdir)/lib/isc \ + -I$(top_srcdir)/lib/dns LDADD += \ - libdnstest.la \ $(LIBISC_LIBS) \ $(LIBUV_LIBS) \ $(LIBDNS_LIBS) -check_LTLIBRARIES = libdnstest.la -libdnstest_la_SOURCES = \ - ../../isc/test.c \ - ../../isc/include/isc/test.h \ - ../../dns/test.c \ - ../../dns/include/dns/test.h - check_PROGRAMS = \ acl_test \ db_test \ @@ -79,7 +73,8 @@ check_PROGRAMS += \ geoip_test_CPPFLAGS = \ $(AM_CPPFLAGS) \ - $(MAXMINDDB_CFLAGS) + $(MAXMINDDB_CFLAGS) \ + -DTEST_GEOIP_DATA=\"$(top_srcdir)/bin/tests/system/geoip2/data\" geoip_test_LDADD = \ $(LDADD) \ diff --git a/lib/dns/tests/acl_test.c b/tests/dns/acl_test.c similarity index 99% rename from lib/dns/tests/acl_test.c rename to tests/dns/acl_test.c index 9e3359c267..210ab45dfa 100644 --- a/lib/dns/tests/acl_test.c +++ b/tests/dns/acl_test.c @@ -29,7 +29,7 @@ #include -#include +#include #define BUFLEN 255 #define BIGBUFLEN (70 * 1024) diff --git a/lib/dns/tests/comparekeys/Kexample-d.+008+53461.key b/tests/dns/comparekeys/Kexample-d.+008+53461.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-d.+008+53461.key rename to tests/dns/comparekeys/Kexample-d.+008+53461.key diff --git a/lib/dns/tests/comparekeys/Kexample-d.+008+53461.private b/tests/dns/comparekeys/Kexample-d.+008+53461.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-d.+008+53461.private rename to tests/dns/comparekeys/Kexample-d.+008+53461.private diff --git a/lib/dns/tests/comparekeys/Kexample-e.+008+53973.key b/tests/dns/comparekeys/Kexample-e.+008+53973.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-e.+008+53973.key rename to tests/dns/comparekeys/Kexample-e.+008+53973.key diff --git a/lib/dns/tests/comparekeys/Kexample-e.+008+53973.private b/tests/dns/comparekeys/Kexample-e.+008+53973.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-e.+008+53973.private rename to tests/dns/comparekeys/Kexample-e.+008+53973.private diff --git a/lib/dns/tests/comparekeys/Kexample-n.+008+37464.key b/tests/dns/comparekeys/Kexample-n.+008+37464.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-n.+008+37464.key rename to tests/dns/comparekeys/Kexample-n.+008+37464.key diff --git a/lib/dns/tests/comparekeys/Kexample-n.+008+37464.private b/tests/dns/comparekeys/Kexample-n.+008+37464.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-n.+008+37464.private rename to tests/dns/comparekeys/Kexample-n.+008+37464.private diff --git a/lib/dns/tests/comparekeys/Kexample-p.+008+53461.key b/tests/dns/comparekeys/Kexample-p.+008+53461.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-p.+008+53461.key rename to tests/dns/comparekeys/Kexample-p.+008+53461.key diff --git a/lib/dns/tests/comparekeys/Kexample-p.+008+53461.private b/tests/dns/comparekeys/Kexample-p.+008+53461.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-p.+008+53461.private rename to tests/dns/comparekeys/Kexample-p.+008+53461.private diff --git a/lib/dns/tests/comparekeys/Kexample-private.+002+65316.key b/tests/dns/comparekeys/Kexample-private.+002+65316.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-private.+002+65316.key rename to tests/dns/comparekeys/Kexample-private.+002+65316.key diff --git a/lib/dns/tests/comparekeys/Kexample-private.+002+65316.private b/tests/dns/comparekeys/Kexample-private.+002+65316.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-private.+002+65316.private rename to tests/dns/comparekeys/Kexample-private.+002+65316.private diff --git a/lib/dns/tests/comparekeys/Kexample-q.+008+53461.key b/tests/dns/comparekeys/Kexample-q.+008+53461.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-q.+008+53461.key rename to tests/dns/comparekeys/Kexample-q.+008+53461.key diff --git a/lib/dns/tests/comparekeys/Kexample-q.+008+53461.private b/tests/dns/comparekeys/Kexample-q.+008+53461.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample-q.+008+53461.private rename to tests/dns/comparekeys/Kexample-q.+008+53461.private diff --git a/lib/dns/tests/comparekeys/Kexample.+002+65316.key b/tests/dns/comparekeys/Kexample.+002+65316.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+002+65316.key rename to tests/dns/comparekeys/Kexample.+002+65316.key diff --git a/lib/dns/tests/comparekeys/Kexample.+002+65316.private b/tests/dns/comparekeys/Kexample.+002+65316.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+002+65316.private rename to tests/dns/comparekeys/Kexample.+002+65316.private diff --git a/lib/dns/tests/comparekeys/Kexample.+008+53461.key b/tests/dns/comparekeys/Kexample.+008+53461.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+008+53461.key rename to tests/dns/comparekeys/Kexample.+008+53461.key diff --git a/lib/dns/tests/comparekeys/Kexample.+008+53461.private b/tests/dns/comparekeys/Kexample.+008+53461.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+008+53461.private rename to tests/dns/comparekeys/Kexample.+008+53461.private diff --git a/lib/dns/tests/comparekeys/Kexample.+013+19786.key b/tests/dns/comparekeys/Kexample.+013+19786.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+013+19786.key rename to tests/dns/comparekeys/Kexample.+013+19786.key diff --git a/lib/dns/tests/comparekeys/Kexample.+013+19786.private b/tests/dns/comparekeys/Kexample.+013+19786.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+013+19786.private rename to tests/dns/comparekeys/Kexample.+013+19786.private diff --git a/lib/dns/tests/comparekeys/Kexample.+015+63663.key b/tests/dns/comparekeys/Kexample.+015+63663.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+015+63663.key rename to tests/dns/comparekeys/Kexample.+015+63663.key diff --git a/lib/dns/tests/comparekeys/Kexample.+015+63663.private b/tests/dns/comparekeys/Kexample.+015+63663.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample.+015+63663.private rename to tests/dns/comparekeys/Kexample.+015+63663.private diff --git a/lib/dns/tests/comparekeys/Kexample2.+002+19823.key b/tests/dns/comparekeys/Kexample2.+002+19823.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+002+19823.key rename to tests/dns/comparekeys/Kexample2.+002+19823.key diff --git a/lib/dns/tests/comparekeys/Kexample2.+002+19823.private b/tests/dns/comparekeys/Kexample2.+002+19823.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+002+19823.private rename to tests/dns/comparekeys/Kexample2.+002+19823.private diff --git a/lib/dns/tests/comparekeys/Kexample2.+008+37993.key b/tests/dns/comparekeys/Kexample2.+008+37993.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+008+37993.key rename to tests/dns/comparekeys/Kexample2.+008+37993.key diff --git a/lib/dns/tests/comparekeys/Kexample2.+008+37993.private b/tests/dns/comparekeys/Kexample2.+008+37993.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+008+37993.private rename to tests/dns/comparekeys/Kexample2.+008+37993.private diff --git a/lib/dns/tests/comparekeys/Kexample2.+013+16384.key b/tests/dns/comparekeys/Kexample2.+013+16384.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+013+16384.key rename to tests/dns/comparekeys/Kexample2.+013+16384.key diff --git a/lib/dns/tests/comparekeys/Kexample2.+013+16384.private b/tests/dns/comparekeys/Kexample2.+013+16384.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+013+16384.private rename to tests/dns/comparekeys/Kexample2.+013+16384.private diff --git a/lib/dns/tests/comparekeys/Kexample2.+015+37529.key b/tests/dns/comparekeys/Kexample2.+015+37529.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+015+37529.key rename to tests/dns/comparekeys/Kexample2.+015+37529.key diff --git a/lib/dns/tests/comparekeys/Kexample2.+015+37529.private b/tests/dns/comparekeys/Kexample2.+015+37529.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample2.+015+37529.private rename to tests/dns/comparekeys/Kexample2.+015+37529.private diff --git a/lib/dns/tests/comparekeys/Kexample3.+002+17187.key b/tests/dns/comparekeys/Kexample3.+002+17187.key similarity index 100% rename from lib/dns/tests/comparekeys/Kexample3.+002+17187.key rename to tests/dns/comparekeys/Kexample3.+002+17187.key diff --git a/lib/dns/tests/comparekeys/Kexample3.+002+17187.private b/tests/dns/comparekeys/Kexample3.+002+17187.private similarity index 100% rename from lib/dns/tests/comparekeys/Kexample3.+002+17187.private rename to tests/dns/comparekeys/Kexample3.+002+17187.private diff --git a/lib/dns/tests/db_test.c b/tests/dns/db_test.c similarity index 99% rename from lib/dns/tests/db_test.c rename to tests/dns/db_test.c index 7898874620..27fcf7deea 100644 --- a/lib/dns/tests/db_test.c +++ b/tests/dns/db_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include #define BUFLEN 255 #define BIGBUFLEN (64 * 1024) diff --git a/lib/dns/tests/dbdiff_test.c b/tests/dns/dbdiff_test.c similarity index 99% rename from lib/dns/tests/dbdiff_test.c rename to tests/dns/dbdiff_test.c index 5f0c7dfc25..12490a8dca 100644 --- a/lib/dns/tests/dbdiff_test.c +++ b/tests/dns/dbdiff_test.c @@ -29,7 +29,7 @@ #include #include -#include +#include #define BUFLEN 255 #define BIGBUFLEN (64 * 1024) diff --git a/lib/dns/tests/dbiterator_test.c b/tests/dns/dbiterator_test.c similarity index 99% rename from lib/dns/tests/dbiterator_test.c rename to tests/dns/dbiterator_test.c index 9daa4b6290..90e8536fc2 100644 --- a/lib/dns/tests/dbiterator_test.c +++ b/tests/dns/dbiterator_test.c @@ -28,7 +28,7 @@ #include #include -#include +#include #define BUFLEN 255 #define BIGBUFLEN (64 * 1024) diff --git a/lib/dns/tests/dbversion_test.c b/tests/dns/dbversion_test.c similarity index 99% rename from lib/dns/tests/dbversion_test.c rename to tests/dns/dbversion_test.c index 81d52581bd..8124563f49 100644 --- a/lib/dns/tests/dbversion_test.c +++ b/tests/dns/dbversion_test.c @@ -35,7 +35,7 @@ #include #include -#include +#include static char tempname[11] = "dtXXXXXXXX"; static dns_db_t *db1 = NULL, *db2 = NULL; diff --git a/lib/dns/tests/dh_test.c b/tests/dns/dh_test.c similarity index 97% rename from lib/dns/tests/dh_test.c rename to tests/dns/dh_test.c index d1a938fb3c..acc7c697fc 100644 --- a/lib/dns/tests/dh_test.c +++ b/tests/dns/dh_test.c @@ -28,9 +28,9 @@ #include -#include "../dst_internal.h" +#include "dst_internal.h" -#include +#include static int setup_test(void **state) { diff --git a/lib/dns/tests/dispatch_test.c b/tests/dns/dispatch_test.c similarity index 99% rename from lib/dns/tests/dispatch_test.c rename to tests/dns/dispatch_test.c index e90edea9cc..a297330864 100644 --- a/lib/dns/tests/dispatch_test.c +++ b/tests/dns/dispatch_test.c @@ -35,7 +35,7 @@ #include #include -#include +#include uv_sem_t sem; diff --git a/lib/dns/tests/dns64_test.c b/tests/dns/dns64_test.c similarity index 99% rename from lib/dns/tests/dns64_test.c rename to tests/dns/dns64_test.c index fd02504c18..6ca96551e6 100644 --- a/lib/dns/tests/dns64_test.c +++ b/tests/dns/dns64_test.c @@ -32,7 +32,7 @@ #include #include -#include +#include static void multiple_prefixes(void) { diff --git a/lib/dns/tests/dnstap_test.c b/tests/dns/dnstap_test.c similarity index 97% rename from lib/dns/tests/dnstap_test.c rename to tests/dns/dnstap_test.c index 25e68c4763..8fdb952a38 100644 --- a/lib/dns/tests/dnstap_test.c +++ b/tests/dns/dnstap_test.c @@ -36,13 +36,13 @@ #include #include -#include +#include -#define TAPFILE "testdata/dnstap/dnstap.file" -#define TAPSOCK "testdata/dnstap/dnstap.sock" +#define TAPFILE TESTS_DIR "/testdata/dnstap/dnstap.file" +#define TAPSOCK TESTS_DIR "/testdata/dnstap/dnstap.sock" -#define TAPSAVED "testdata/dnstap/dnstap.saved" -#define TAPTEXT "testdata/dnstap/dnstap.text" +#define TAPSAVED TESTS_DIR "/testdata/dnstap/dnstap.saved" +#define TAPTEXT TESTS_DIR "/testdata/dnstap/dnstap.text" static int cleanup(void **state __attribute__((__unused__))) { diff --git a/lib/dns/tests/dst_test.c b/tests/dns/dst_test.c similarity index 99% rename from lib/dns/tests/dst_test.c rename to tests/dns/dst_test.c index 3073580b42..28bd2ec72e 100644 --- a/lib/dns/tests/dst_test.c +++ b/tests/dns/dst_test.c @@ -31,9 +31,9 @@ #include -#include "../dst_internal.h" +#include "dst_internal.h" -#include +#include static int setup_test(void **state) { diff --git a/lib/dns/tests/geoip_test.c b/tests/dns/geoip_test.c similarity index 98% rename from lib/dns/tests/geoip_test.c rename to tests/dns/geoip_test.c index 9c7ba7d71e..8af48f448c 100644 --- a/lib/dns/tests/geoip_test.c +++ b/tests/dns/geoip_test.c @@ -32,12 +32,9 @@ #include -#include "../geoip2.c" +#include "geoip2.c" -#include - -/* Use GeoIP2 databases from the 'geoip2' system test */ -#define TEST_GEOIP_DATA "../../../bin/tests/system/geoip2/data" +#include static dns_geoip_databases_t geoip; diff --git a/lib/dns/tests/keytable_test.c b/tests/dns/keytable_test.c similarity index 99% rename from lib/dns/tests/keytable_test.c rename to tests/dns/keytable_test.c index e6aab79760..bc7b60d12e 100644 --- a/lib/dns/tests/keytable_test.c +++ b/tests/dns/keytable_test.c @@ -40,7 +40,7 @@ #include -#include +#include dns_keytable_t *keytable = NULL; dns_ntatable_t *ntatable = NULL; diff --git a/lib/dns/tests/master_test.c b/tests/dns/master_test.c similarity index 99% rename from lib/dns/tests/master_test.c rename to tests/dns/master_test.c index 755ad459a2..1642b0d12e 100644 --- a/lib/dns/tests/master_test.c +++ b/tests/dns/master_test.c @@ -38,7 +38,7 @@ #include #include -#include +#include static void nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...) { diff --git a/lib/dns/tests/mkraw.pl b/tests/dns/mkraw.pl similarity index 100% rename from lib/dns/tests/mkraw.pl rename to tests/dns/mkraw.pl diff --git a/lib/dns/tests/name_test.c b/tests/dns/name_test.c similarity index 99% rename from lib/dns/tests/name_test.c rename to tests/dns/name_test.c index d89100e856..511ee3c8b3 100644 --- a/lib/dns/tests/name_test.c +++ b/tests/dns/name_test.c @@ -36,7 +36,7 @@ #include #include -#include +#include /* Set to true (or use -v option) for verbose output */ static bool verbose = false; diff --git a/lib/dns/tests/nsec3_test.c b/tests/dns/nsec3_test.c similarity index 99% rename from lib/dns/tests/nsec3_test.c rename to tests/dns/nsec3_test.c index f417bdd8c1..7d6e424705 100644 --- a/lib/dns/tests/nsec3_test.c +++ b/tests/dns/nsec3_test.c @@ -28,7 +28,7 @@ #include #include -#include +#include static void iteration_test(const char *file, unsigned int expected) { diff --git a/lib/dns/tests/nsec3param_test.c b/tests/dns/nsec3param_test.c similarity index 99% rename from lib/dns/tests/nsec3param_test.c rename to tests/dns/nsec3param_test.c index c2ddee3199..3bd50e59a4 100644 --- a/lib/dns/tests/nsec3param_test.c +++ b/tests/dns/nsec3param_test.c @@ -30,9 +30,9 @@ #include #include -#include "../zone_p.h" +#include "zone_p.h" -#include +#include #define HASH 1 #define FLAGS 0 diff --git a/lib/dns/tests/peer_test.c b/tests/dns/peer_test.c similarity index 99% rename from lib/dns/tests/peer_test.c rename to tests/dns/peer_test.c index 40eb48d1e7..32ef932d93 100644 --- a/lib/dns/tests/peer_test.c +++ b/tests/dns/peer_test.c @@ -26,7 +26,7 @@ #include -#include +#include /* Test DSCP set/get functions */ ISC_RUN_TEST_IMPL(dscp) { diff --git a/lib/dns/tests/private_test.c b/tests/dns/private_test.c similarity index 99% rename from lib/dns/tests/private_test.c rename to tests/dns/private_test.c index db7284a6a8..adaf441cf4 100644 --- a/lib/dns/tests/private_test.c +++ b/tests/dns/private_test.c @@ -33,7 +33,7 @@ #include -#include +#include static dns_rdatatype_t privatetype = 65534; diff --git a/lib/dns/tests/rbt_test.c b/tests/dns/rbt_test.c similarity index 99% rename from lib/dns/tests/rbt_test.c rename to tests/dns/rbt_test.c index 9b88dff287..c66c365e59 100644 --- a/lib/dns/tests/rbt_test.c +++ b/tests/dns/rbt_test.c @@ -51,7 +51,7 @@ #include -#include +#include typedef struct { dns_rbt_t *rbt; diff --git a/lib/dns/tests/rbtdb_test.c b/tests/dns/rbtdb_test.c similarity index 98% rename from lib/dns/tests/rbtdb_test.c rename to tests/dns/rbtdb_test.c index f7ac532551..817dd67e2f 100644 --- a/lib/dns/tests/rbtdb_test.c +++ b/tests/dns/rbtdb_test.c @@ -27,17 +27,19 @@ #include #include #include - -#include +#define KEEP_BEFORE /* Include the main file */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" #undef CHECK -#include "../rbtdb.c" +#include "rbtdb.c" #pragma GCC diagnostic pop +#undef CHECK +#include + const char *ownercase_vectors[12][2] = { { "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz", diff --git a/lib/dns/tests/rdata_test.c b/tests/dns/rdata_test.c similarity index 99% rename from lib/dns/tests/rdata_test.c rename to tests/dns/rdata_test.c index cee2e0b148..71149eafaf 100644 --- a/lib/dns/tests/rdata_test.c +++ b/tests/dns/rdata_test.c @@ -33,7 +33,7 @@ #include -#include +#include static bool debug = false; diff --git a/lib/dns/tests/rdataset_test.c b/tests/dns/rdataset_test.c similarity index 99% rename from lib/dns/tests/rdataset_test.c rename to tests/dns/rdataset_test.c index 3d340cf111..e9b47ecbf3 100644 --- a/lib/dns/tests/rdataset_test.c +++ b/tests/dns/rdataset_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include /* test trimming of rdataset TTLs */ ISC_RUN_TEST_IMPL(trimttl) { diff --git a/lib/dns/tests/rdatasetstats_test.c b/tests/dns/rdatasetstats_test.c similarity index 99% rename from lib/dns/tests/rdatasetstats_test.c rename to tests/dns/rdatasetstats_test.c index cfb9c489ad..743803474c 100644 --- a/lib/dns/tests/rdatasetstats_test.c +++ b/tests/dns/rdatasetstats_test.c @@ -29,7 +29,7 @@ #include -#include +#include static void set_typestats(dns_stats_t *stats, dns_rdatatype_t type) { diff --git a/lib/dns/tests/resolver_test.c b/tests/dns/resolver_test.c similarity index 99% rename from lib/dns/tests/resolver_test.c rename to tests/dns/resolver_test.c index c11c6aeff6..634dbc4a28 100644 --- a/lib/dns/tests/resolver_test.c +++ b/tests/dns/resolver_test.c @@ -34,7 +34,7 @@ #include #include -#include +#include static dns_dispatchmgr_t *dispatchmgr = NULL; static dns_dispatch_t *dispatch = NULL; diff --git a/lib/dns/tests/rsa_test.c b/tests/dns/rsa_test.c similarity index 99% rename from lib/dns/tests/rsa_test.c rename to tests/dns/rsa_test.c index 0b169c3603..8b2bd89219 100644 --- a/lib/dns/tests/rsa_test.c +++ b/tests/dns/rsa_test.c @@ -26,9 +26,9 @@ #include #include -#include "../dst_internal.h" +#include "dst_internal.h" -#include +#include static int setup_test(void **state) { diff --git a/lib/dns/tests/sigs_test.c b/tests/dns/sigs_test.c similarity index 99% rename from lib/dns/tests/sigs_test.c rename to tests/dns/sigs_test.c index 135bdddef5..55183057f1 100644 --- a/lib/dns/tests/sigs_test.c +++ b/tests/dns/sigs_test.c @@ -43,9 +43,9 @@ #include -#include "../zone_p.h" +#include "zone_p.h" -#include +#include /*% * Structure characterizing a single diff tuple in the dns_diff_t structure diff --git a/lib/dns/tests/testdata/db/data.db b/tests/dns/testdata/db/data.db similarity index 100% rename from lib/dns/tests/testdata/db/data.db rename to tests/dns/testdata/db/data.db diff --git a/lib/dns/tests/testdata/dbiterator/zone1.data b/tests/dns/testdata/dbiterator/zone1.data similarity index 100% rename from lib/dns/tests/testdata/dbiterator/zone1.data rename to tests/dns/testdata/dbiterator/zone1.data diff --git a/lib/dns/tests/testdata/dbiterator/zone2.data b/tests/dns/testdata/dbiterator/zone2.data similarity index 100% rename from lib/dns/tests/testdata/dbiterator/zone2.data rename to tests/dns/testdata/dbiterator/zone2.data diff --git a/lib/dns/tests/testdata/diff/zone1.data b/tests/dns/testdata/diff/zone1.data similarity index 100% rename from lib/dns/tests/testdata/diff/zone1.data rename to tests/dns/testdata/diff/zone1.data diff --git a/lib/dns/tests/testdata/diff/zone2.data b/tests/dns/testdata/diff/zone2.data similarity index 100% rename from lib/dns/tests/testdata/diff/zone2.data rename to tests/dns/testdata/diff/zone2.data diff --git a/lib/dns/tests/testdata/diff/zone3.data b/tests/dns/testdata/diff/zone3.data similarity index 100% rename from lib/dns/tests/testdata/diff/zone3.data rename to tests/dns/testdata/diff/zone3.data diff --git a/lib/dns/tests/testdata/dnstap/dnstap.saved b/tests/dns/testdata/dnstap/dnstap.saved similarity index 100% rename from lib/dns/tests/testdata/dnstap/dnstap.saved rename to tests/dns/testdata/dnstap/dnstap.saved diff --git a/lib/dns/tests/testdata/dnstap/dnstap.text b/tests/dns/testdata/dnstap/dnstap.text similarity index 100% rename from lib/dns/tests/testdata/dnstap/dnstap.text rename to tests/dns/testdata/dnstap/dnstap.text diff --git a/lib/dns/tests/testdata/dnstap/query.auth b/tests/dns/testdata/dnstap/query.auth similarity index 100% rename from lib/dns/tests/testdata/dnstap/query.auth rename to tests/dns/testdata/dnstap/query.auth diff --git a/lib/dns/tests/testdata/dnstap/query.recursive b/tests/dns/testdata/dnstap/query.recursive similarity index 100% rename from lib/dns/tests/testdata/dnstap/query.recursive rename to tests/dns/testdata/dnstap/query.recursive diff --git a/lib/dns/tests/testdata/dnstap/response.auth b/tests/dns/testdata/dnstap/response.auth similarity index 100% rename from lib/dns/tests/testdata/dnstap/response.auth rename to tests/dns/testdata/dnstap/response.auth diff --git a/lib/dns/tests/testdata/dnstap/response.recursive b/tests/dns/testdata/dnstap/response.recursive similarity index 100% rename from lib/dns/tests/testdata/dnstap/response.recursive rename to tests/dns/testdata/dnstap/response.recursive diff --git a/lib/dns/tests/testdata/dst/Ktest.+008+11349.key b/tests/dns/testdata/dst/Ktest.+008+11349.key similarity index 100% rename from lib/dns/tests/testdata/dst/Ktest.+008+11349.key rename to tests/dns/testdata/dst/Ktest.+008+11349.key diff --git a/lib/dns/tests/testdata/dst/Ktest.+008+11349.private b/tests/dns/testdata/dst/Ktest.+008+11349.private similarity index 100% rename from lib/dns/tests/testdata/dst/Ktest.+008+11349.private rename to tests/dns/testdata/dst/Ktest.+008+11349.private diff --git a/lib/dns/tests/testdata/dst/Ktest.+013+49130.key b/tests/dns/testdata/dst/Ktest.+013+49130.key similarity index 100% rename from lib/dns/tests/testdata/dst/Ktest.+013+49130.key rename to tests/dns/testdata/dst/Ktest.+013+49130.key diff --git a/lib/dns/tests/testdata/dst/Ktest.+013+49130.private b/tests/dns/testdata/dst/Ktest.+013+49130.private similarity index 100% rename from lib/dns/tests/testdata/dst/Ktest.+013+49130.private rename to tests/dns/testdata/dst/Ktest.+013+49130.private diff --git a/lib/dns/tests/testdata/dst/test1.data b/tests/dns/testdata/dst/test1.data similarity index 100% rename from lib/dns/tests/testdata/dst/test1.data rename to tests/dns/testdata/dst/test1.data diff --git a/lib/dns/tests/testdata/dst/test1.ecdsa256sig b/tests/dns/testdata/dst/test1.ecdsa256sig similarity index 100% rename from lib/dns/tests/testdata/dst/test1.ecdsa256sig rename to tests/dns/testdata/dst/test1.ecdsa256sig diff --git a/lib/dns/tests/testdata/dst/test1.rsasha256sig b/tests/dns/testdata/dst/test1.rsasha256sig similarity index 100% rename from lib/dns/tests/testdata/dst/test1.rsasha256sig rename to tests/dns/testdata/dst/test1.rsasha256sig diff --git a/lib/dns/tests/testdata/dst/test2.data b/tests/dns/testdata/dst/test2.data similarity index 100% rename from lib/dns/tests/testdata/dst/test2.data rename to tests/dns/testdata/dst/test2.data diff --git a/lib/dns/tests/testdata/dstrandom/random.data b/tests/dns/testdata/dstrandom/random.data similarity index 100% rename from lib/dns/tests/testdata/dstrandom/random.data rename to tests/dns/testdata/dstrandom/random.data diff --git a/lib/dns/tests/testdata/master/.gitignore b/tests/dns/testdata/master/.gitignore similarity index 100% rename from lib/dns/tests/testdata/master/.gitignore rename to tests/dns/testdata/master/.gitignore diff --git a/lib/dns/tests/testdata/master/master1.data b/tests/dns/testdata/master/master1.data similarity index 100% rename from lib/dns/tests/testdata/master/master1.data rename to tests/dns/testdata/master/master1.data diff --git a/lib/dns/tests/testdata/master/master10.data b/tests/dns/testdata/master/master10.data similarity index 100% rename from lib/dns/tests/testdata/master/master10.data rename to tests/dns/testdata/master/master10.data diff --git a/lib/dns/tests/testdata/master/master11.data b/tests/dns/testdata/master/master11.data similarity index 100% rename from lib/dns/tests/testdata/master/master11.data rename to tests/dns/testdata/master/master11.data diff --git a/lib/dns/tests/testdata/master/master12.data.in b/tests/dns/testdata/master/master12.data.in similarity index 100% rename from lib/dns/tests/testdata/master/master12.data.in rename to tests/dns/testdata/master/master12.data.in diff --git a/lib/dns/tests/testdata/master/master13.data.in b/tests/dns/testdata/master/master13.data.in similarity index 100% rename from lib/dns/tests/testdata/master/master13.data.in rename to tests/dns/testdata/master/master13.data.in diff --git a/lib/dns/tests/testdata/master/master14.data.in b/tests/dns/testdata/master/master14.data.in similarity index 100% rename from lib/dns/tests/testdata/master/master14.data.in rename to tests/dns/testdata/master/master14.data.in diff --git a/lib/dns/tests/testdata/master/master15.data b/tests/dns/testdata/master/master15.data similarity index 100% rename from lib/dns/tests/testdata/master/master15.data rename to tests/dns/testdata/master/master15.data diff --git a/lib/dns/tests/testdata/master/master16.data b/tests/dns/testdata/master/master16.data similarity index 100% rename from lib/dns/tests/testdata/master/master16.data rename to tests/dns/testdata/master/master16.data diff --git a/lib/dns/tests/testdata/master/master17.data b/tests/dns/testdata/master/master17.data similarity index 100% rename from lib/dns/tests/testdata/master/master17.data rename to tests/dns/testdata/master/master17.data diff --git a/lib/dns/tests/testdata/master/master18.data b/tests/dns/testdata/master/master18.data similarity index 100% rename from lib/dns/tests/testdata/master/master18.data rename to tests/dns/testdata/master/master18.data diff --git a/lib/dns/tests/testdata/master/master2.data b/tests/dns/testdata/master/master2.data similarity index 100% rename from lib/dns/tests/testdata/master/master2.data rename to tests/dns/testdata/master/master2.data diff --git a/lib/dns/tests/testdata/master/master3.data b/tests/dns/testdata/master/master3.data similarity index 100% rename from lib/dns/tests/testdata/master/master3.data rename to tests/dns/testdata/master/master3.data diff --git a/lib/dns/tests/testdata/master/master4.data b/tests/dns/testdata/master/master4.data similarity index 100% rename from lib/dns/tests/testdata/master/master4.data rename to tests/dns/testdata/master/master4.data diff --git a/lib/dns/tests/testdata/master/master5.data b/tests/dns/testdata/master/master5.data similarity index 100% rename from lib/dns/tests/testdata/master/master5.data rename to tests/dns/testdata/master/master5.data diff --git a/lib/dns/tests/testdata/master/master6.data b/tests/dns/testdata/master/master6.data similarity index 100% rename from lib/dns/tests/testdata/master/master6.data rename to tests/dns/testdata/master/master6.data diff --git a/lib/dns/tests/testdata/master/master7.data b/tests/dns/testdata/master/master7.data similarity index 100% rename from lib/dns/tests/testdata/master/master7.data rename to tests/dns/testdata/master/master7.data diff --git a/lib/dns/tests/testdata/master/master8.data b/tests/dns/testdata/master/master8.data similarity index 100% rename from lib/dns/tests/testdata/master/master8.data rename to tests/dns/testdata/master/master8.data diff --git a/lib/dns/tests/testdata/master/master9.data b/tests/dns/testdata/master/master9.data similarity index 100% rename from lib/dns/tests/testdata/master/master9.data rename to tests/dns/testdata/master/master9.data diff --git a/lib/dns/tests/testdata/nsec3/1024.db b/tests/dns/testdata/nsec3/1024.db similarity index 100% rename from lib/dns/tests/testdata/nsec3/1024.db rename to tests/dns/testdata/nsec3/1024.db diff --git a/lib/dns/tests/testdata/nsec3/2048.db b/tests/dns/testdata/nsec3/2048.db similarity index 100% rename from lib/dns/tests/testdata/nsec3/2048.db rename to tests/dns/testdata/nsec3/2048.db diff --git a/lib/dns/tests/testdata/nsec3/4096.db b/tests/dns/testdata/nsec3/4096.db similarity index 100% rename from lib/dns/tests/testdata/nsec3/4096.db rename to tests/dns/testdata/nsec3/4096.db diff --git a/lib/dns/tests/testdata/nsec3/min-1024.db b/tests/dns/testdata/nsec3/min-1024.db similarity index 100% rename from lib/dns/tests/testdata/nsec3/min-1024.db rename to tests/dns/testdata/nsec3/min-1024.db diff --git a/lib/dns/tests/testdata/nsec3/min-2048.db b/tests/dns/testdata/nsec3/min-2048.db similarity index 100% rename from lib/dns/tests/testdata/nsec3/min-2048.db rename to tests/dns/testdata/nsec3/min-2048.db diff --git a/lib/dns/tests/testdata/nsec3param/nsec3.db.signed b/tests/dns/testdata/nsec3param/nsec3.db.signed similarity index 100% rename from lib/dns/tests/testdata/nsec3param/nsec3.db.signed rename to tests/dns/testdata/nsec3param/nsec3.db.signed diff --git a/lib/dns/tests/testdata/zt/zone1.db b/tests/dns/testdata/zt/zone1.db similarity index 100% rename from lib/dns/tests/testdata/zt/zone1.db rename to tests/dns/testdata/zt/zone1.db diff --git a/lib/dns/tests/testkeys/Kexample.+008+20386.key b/tests/dns/testkeys/Kexample.+008+20386.key similarity index 100% rename from lib/dns/tests/testkeys/Kexample.+008+20386.key rename to tests/dns/testkeys/Kexample.+008+20386.key diff --git a/lib/dns/tests/testkeys/Kexample.+008+20386.private b/tests/dns/testkeys/Kexample.+008+20386.private similarity index 100% rename from lib/dns/tests/testkeys/Kexample.+008+20386.private rename to tests/dns/testkeys/Kexample.+008+20386.private diff --git a/lib/dns/tests/testkeys/Kexample.+008+37464.key b/tests/dns/testkeys/Kexample.+008+37464.key similarity index 100% rename from lib/dns/tests/testkeys/Kexample.+008+37464.key rename to tests/dns/testkeys/Kexample.+008+37464.key diff --git a/lib/dns/tests/testkeys/Kexample.+008+37464.private b/tests/dns/testkeys/Kexample.+008+37464.private similarity index 100% rename from lib/dns/tests/testkeys/Kexample.+008+37464.private rename to tests/dns/testkeys/Kexample.+008+37464.private diff --git a/lib/dns/tests/time_test.c b/tests/dns/time_test.c similarity index 99% rename from lib/dns/tests/time_test.c rename to tests/dns/time_test.c index c11b4b9fd4..f6e19481f4 100644 --- a/lib/dns/tests/time_test.c +++ b/tests/dns/time_test.c @@ -27,7 +27,7 @@ #include -#include +#include #define TEST_ORIGIN "test" diff --git a/lib/dns/tests/tsig_test.c b/tests/dns/tsig_test.c similarity index 99% rename from lib/dns/tests/tsig_test.c rename to tests/dns/tsig_test.c index dead784185..f94a0fa016 100644 --- a/lib/dns/tests/tsig_test.c +++ b/tests/dns/tsig_test.c @@ -30,9 +30,9 @@ #include #include -#include "../tsig_p.h" +#include "tsig_p.h" -#include +#include #define TEST_ORIGIN "test" diff --git a/lib/dns/tests/update_test.c b/tests/dns/update_test.c similarity index 99% rename from lib/dns/tests/update_test.c rename to tests/dns/update_test.c index 7c50192a84..afeaa5ce83 100644 --- a/lib/dns/tests/update_test.c +++ b/tests/dns/update_test.c @@ -29,8 +29,7 @@ #include #include - -#include +#define KEEP_BEFORE /* * Fix the linking order problem for overridden isc_stdtime_get() by making @@ -40,9 +39,12 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" #undef CHECK -#include "../update.c" +#include "update.c" #pragma GCC diagnostic pop +#undef CHECK +#include + static int setup_test(void **state) { UNUSED(state); diff --git a/lib/dns/tests/zonemgr_test.c b/tests/dns/zonemgr_test.c similarity index 99% rename from lib/dns/tests/zonemgr_test.c rename to tests/dns/zonemgr_test.c index bca643887e..cf1c718ba2 100644 --- a/lib/dns/tests/zonemgr_test.c +++ b/tests/dns/zonemgr_test.c @@ -31,7 +31,7 @@ #include #include -#include +#include /* create zone manager */ ISC_RUN_TEST_IMPL(dns_zonemgr_create) { diff --git a/lib/dns/tests/zt_test.c b/tests/dns/zt_test.c similarity index 99% rename from lib/dns/tests/zt_test.c rename to tests/dns/zt_test.c index 981831349c..74cbe059a2 100644 --- a/lib/dns/tests/zt_test.c +++ b/tests/dns/zt_test.c @@ -37,7 +37,7 @@ #include #include -#include +#include static int _setup(void **state) { diff --git a/tests/include/tests/.clang-format b/tests/include/tests/.clang-format new file mode 120000 index 0000000000..0e62f72bcf --- /dev/null +++ b/tests/include/tests/.clang-format @@ -0,0 +1 @@ +../../../.clang-format.headers \ No newline at end of file diff --git a/lib/dns/include/dns/test.h b/tests/include/tests/dns.h similarity index 99% rename from lib/dns/include/dns/test.h rename to tests/include/tests/dns.h index e4e3e7c292..64a265b660 100644 --- a/lib/dns/include/dns/test.h +++ b/tests/include/tests/dns.h @@ -32,7 +32,7 @@ #include #include -#include +#include extern dns_zonemgr_t *zonemgr; diff --git a/lib/isc/include/isc/test.h b/tests/include/tests/isc.h similarity index 98% rename from lib/isc/include/isc/test.h rename to tests/include/tests/isc.h index 14f464ef24..38dadb4679 100644 --- a/lib/isc/include/isc/test.h +++ b/tests/include/tests/isc.h @@ -31,9 +31,9 @@ #include #include -#include "../netmgr_p.h" -#include "../task_p.h" -#include "../timer_p.h" +#include "netmgr_p.h" +#include "task_p.h" +#include "timer_p.h" #define CHECK(r) \ do { \ diff --git a/lib/ns/include/ns/test.h b/tests/include/tests/ns.h similarity index 99% rename from lib/ns/include/ns/test.h rename to tests/include/tests/ns.h index 3b5fec1a86..2317e7daee 100644 --- a/lib/ns/include/ns/test.h +++ b/tests/include/tests/ns.h @@ -34,7 +34,7 @@ #include #include -#include +#include typedef struct ns_test_id { const char *description; diff --git a/lib/irs/tests/Makefile.am b/tests/irs/Makefile.am similarity index 100% rename from lib/irs/tests/Makefile.am rename to tests/irs/Makefile.am diff --git a/lib/irs/tests/resconf_test.c b/tests/irs/resconf_test.c similarity index 100% rename from lib/irs/tests/resconf_test.c rename to tests/irs/resconf_test.c diff --git a/lib/irs/tests/testdata/domain.conf b/tests/irs/testdata/domain.conf similarity index 100% rename from lib/irs/tests/testdata/domain.conf rename to tests/irs/testdata/domain.conf diff --git a/lib/irs/tests/testdata/nameserver-v4.conf b/tests/irs/testdata/nameserver-v4.conf similarity index 100% rename from lib/irs/tests/testdata/nameserver-v4.conf rename to tests/irs/testdata/nameserver-v4.conf diff --git a/lib/irs/tests/testdata/nameserver-v6-scoped.conf b/tests/irs/testdata/nameserver-v6-scoped.conf similarity index 100% rename from lib/irs/tests/testdata/nameserver-v6-scoped.conf rename to tests/irs/testdata/nameserver-v6-scoped.conf diff --git a/lib/irs/tests/testdata/nameserver-v6.conf b/tests/irs/testdata/nameserver-v6.conf similarity index 100% rename from lib/irs/tests/testdata/nameserver-v6.conf rename to tests/irs/testdata/nameserver-v6.conf diff --git a/lib/irs/tests/testdata/options-attempts.conf b/tests/irs/testdata/options-attempts.conf similarity index 100% rename from lib/irs/tests/testdata/options-attempts.conf rename to tests/irs/testdata/options-attempts.conf diff --git a/lib/irs/tests/testdata/options-bad-ndots.conf b/tests/irs/testdata/options-bad-ndots.conf similarity index 100% rename from lib/irs/tests/testdata/options-bad-ndots.conf rename to tests/irs/testdata/options-bad-ndots.conf diff --git a/lib/irs/tests/testdata/options-debug.conf b/tests/irs/testdata/options-debug.conf similarity index 100% rename from lib/irs/tests/testdata/options-debug.conf rename to tests/irs/testdata/options-debug.conf diff --git a/lib/irs/tests/testdata/options-empty.conf b/tests/irs/testdata/options-empty.conf similarity index 100% rename from lib/irs/tests/testdata/options-empty.conf rename to tests/irs/testdata/options-empty.conf diff --git a/lib/irs/tests/testdata/options-ndots.conf b/tests/irs/testdata/options-ndots.conf similarity index 100% rename from lib/irs/tests/testdata/options-ndots.conf rename to tests/irs/testdata/options-ndots.conf diff --git a/lib/irs/tests/testdata/options-timeout.conf b/tests/irs/testdata/options-timeout.conf similarity index 100% rename from lib/irs/tests/testdata/options-timeout.conf rename to tests/irs/testdata/options-timeout.conf diff --git a/lib/irs/tests/testdata/options-unknown.conf b/tests/irs/testdata/options-unknown.conf similarity index 100% rename from lib/irs/tests/testdata/options-unknown.conf rename to tests/irs/testdata/options-unknown.conf diff --git a/lib/irs/tests/testdata/options.conf b/tests/irs/testdata/options.conf similarity index 100% rename from lib/irs/tests/testdata/options.conf rename to tests/irs/testdata/options.conf diff --git a/lib/irs/tests/testdata/port.conf b/tests/irs/testdata/port.conf similarity index 100% rename from lib/irs/tests/testdata/port.conf rename to tests/irs/testdata/port.conf diff --git a/lib/irs/tests/testdata/resolv.conf b/tests/irs/testdata/resolv.conf similarity index 100% rename from lib/irs/tests/testdata/resolv.conf rename to tests/irs/testdata/resolv.conf diff --git a/lib/irs/tests/testdata/search.conf b/tests/irs/testdata/search.conf similarity index 100% rename from lib/irs/tests/testdata/search.conf rename to tests/irs/testdata/search.conf diff --git a/lib/irs/tests/testdata/sortlist-v4.conf b/tests/irs/testdata/sortlist-v4.conf similarity index 100% rename from lib/irs/tests/testdata/sortlist-v4.conf rename to tests/irs/testdata/sortlist-v4.conf diff --git a/lib/irs/tests/testdata/timeout.conf b/tests/irs/testdata/timeout.conf similarity index 100% rename from lib/irs/tests/testdata/timeout.conf rename to tests/irs/testdata/timeout.conf diff --git a/lib/irs/tests/testdata/unknown.conf b/tests/irs/testdata/unknown.conf similarity index 100% rename from lib/irs/tests/testdata/unknown.conf rename to tests/irs/testdata/unknown.conf diff --git a/lib/isc/test.c b/tests/isc.c similarity index 94% rename from lib/isc/test.c rename to tests/isc.c index bcdda1eefd..61e29c2a34 100644 --- a/lib/isc/test.c +++ b/tests/isc.c @@ -29,11 +29,11 @@ #include #include -#include "../netmgr_p.h" -#include "../task_p.h" -#include "../timer_p.h" +#include "netmgr_p.h" +#include "task_p.h" +#include "timer_p.h" -#include +#include isc_mem_t *mctx = NULL; isc_taskmgr_t *taskmgr = NULL; diff --git a/lib/isc/tests/Makefile.am b/tests/isc/Makefile.am similarity index 90% rename from lib/isc/tests/Makefile.am rename to tests/isc/Makefile.am index 8ea6da0d29..6ce570c882 100644 --- a/lib/isc/tests/Makefile.am +++ b/tests/isc/Makefile.am @@ -3,19 +3,12 @@ include $(top_srcdir)/Makefile.top AM_CPPFLAGS += \ $(LIBISC_CFLAGS) \ $(LIBUV_CFLAGS) \ - -I.. + -I$(top_srcdir)/lib/isc LDADD += \ - libisctest.la \ $(LIBISC_LIBS) \ $(LIBUV_LIBS) -check_LTLIBRARIES = libisctest.la -libisctest_la_SOURCES = \ - ../../isc/test.c \ - ../../isc/include/isc/test.h \ - uv_wrap.h - check_PROGRAMS = \ aes_test \ buffer_test \ diff --git a/lib/isc/tests/aes_test.c b/tests/isc/aes_test.c similarity index 99% rename from lib/isc/tests/aes_test.c rename to tests/isc/aes_test.c index 8cc9d90def..c328b92b02 100644 --- a/lib/isc/tests/aes_test.c +++ b/tests/isc/aes_test.c @@ -29,7 +29,7 @@ #include #include -#include +#include /* * Test data from NIST KAT diff --git a/lib/isc/tests/buffer_test.c b/tests/isc/buffer_test.c similarity index 99% rename from lib/isc/tests/buffer_test.c rename to tests/isc/buffer_test.c index 43317ca46a..8335248fa0 100644 --- a/lib/isc/tests/buffer_test.c +++ b/tests/isc/buffer_test.c @@ -32,7 +32,7 @@ #include #include -#include +#include /* reserve space in dynamic buffers */ ISC_RUN_TEST_IMPL(isc_buffer_reserve) { diff --git a/lib/isc/tests/counter_test.c b/tests/isc/counter_test.c similarity index 98% rename from lib/isc/tests/counter_test.c rename to tests/isc/counter_test.c index d32390849a..065a6f0a3b 100644 --- a/lib/isc/tests/counter_test.c +++ b/tests/isc/counter_test.c @@ -25,7 +25,7 @@ #include #include -#include +#include /* test isc_counter object */ ISC_RUN_TEST_IMPL(isc_counter) { diff --git a/lib/isc/tests/crc64_test.c b/tests/isc/crc64_test.c similarity index 98% rename from lib/isc/tests/crc64_test.c rename to tests/isc/crc64_test.c index d6253d6a54..9b8ff47b9e 100644 --- a/lib/isc/tests/crc64_test.c +++ b/tests/isc/crc64_test.c @@ -28,7 +28,7 @@ #include #include -#include +#include #define TEST_INPUT(x) (x), sizeof(x) - 1 diff --git a/lib/isc/tests/doh_test.c b/tests/isc/doh_test.c similarity index 99% rename from lib/isc/tests/doh_test.c rename to tests/isc/doh_test.c index 244fc6a07e..b8c5d1f81f 100644 --- a/lib/isc/tests/doh_test.c +++ b/tests/isc/doh_test.c @@ -40,12 +40,12 @@ #include "uv_wrap.h" #define KEEP_BEFORE -#include "../netmgr/http.c" -#include "../netmgr/netmgr-int.h" -#include "../netmgr/socket.c" -#include "../netmgr_p.h" +#include "netmgr/http.c" +#include "netmgr/netmgr-int.h" +#include "netmgr/socket.c" +#include "netmgr_p.h" -#include +#include #define MAX_NM 2 diff --git a/lib/isc/tests/errno_test.c b/tests/isc/errno_test.c similarity index 99% rename from lib/isc/tests/errno_test.c rename to tests/isc/errno_test.c index c5ddbcb366..11d48fa8f5 100644 --- a/lib/isc/tests/errno_test.c +++ b/tests/isc/errno_test.c @@ -26,7 +26,7 @@ #include #include -#include +#include typedef struct { int err; diff --git a/lib/isc/tests/file_test.c b/tests/isc/file_test.c similarity index 99% rename from lib/isc/tests/file_test.c rename to tests/isc/file_test.c index 7333fa8a0a..39670b57eb 100644 --- a/lib/isc/tests/file_test.c +++ b/tests/isc/file_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include #define NAME "internal" #define SHA "3bed2cb3a3acf7b6a8ef408420cc682d5520e26976d354254f528c965612054f" diff --git a/lib/isc/tests/hash_test.c b/tests/isc/hash_test.c similarity index 98% rename from lib/isc/tests/hash_test.c rename to tests/isc/hash_test.c index 4c6f020eb0..10a8c27e58 100644 --- a/lib/isc/tests/hash_test.c +++ b/tests/isc/hash_test.c @@ -32,7 +32,7 @@ #include #include -#include +#include /* Hash function test */ ISC_RUN_TEST_IMPL(isc_hash_function) { diff --git a/lib/isc/tests/heap_test.c b/tests/isc/heap_test.c similarity index 98% rename from lib/isc/tests/heap_test.c rename to tests/isc/heap_test.c index 0281afb041..9e29a4b812 100644 --- a/lib/isc/tests/heap_test.c +++ b/tests/isc/heap_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include struct e { unsigned int value; diff --git a/lib/isc/tests/hmac_test.c b/tests/isc/hmac_test.c similarity index 99% rename from lib/isc/tests/hmac_test.c rename to tests/isc/hmac_test.c index a6834766f9..ac567d6884 100644 --- a/lib/isc/tests/hmac_test.c +++ b/tests/isc/hmac_test.c @@ -29,9 +29,9 @@ #include #include -#include "../hmac.c" +#include "hmac.c" -#include +#include #define TEST_INPUT(x) (x), sizeof(x) - 1 diff --git a/lib/isc/tests/ht_test.c b/tests/isc/ht_test.c similarity index 99% rename from lib/isc/tests/ht_test.c rename to tests/isc/ht_test.c index d1b138cb24..152994e47d 100644 --- a/lib/isc/tests/ht_test.c +++ b/tests/isc/ht_test.c @@ -30,12 +30,12 @@ #include #include -#include +#include /* INCLUDE LAST */ #define mctx __mctx -#include "../ht.c" +#include "ht.c" #undef mctx static void diff --git a/lib/isc/tests/lex_test.c b/tests/isc/lex_test.c similarity index 99% rename from lib/isc/tests/lex_test.c rename to tests/isc/lex_test.c index f792f6d131..cf6bfe2ea5 100644 --- a/lib/isc/tests/lex_test.c +++ b/tests/isc/lex_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include #define AS_STR(x) (x).value.as_textregion.base diff --git a/lib/isc/tests/md_test.c b/tests/isc/md_test.c similarity index 99% rename from lib/isc/tests/md_test.c rename to tests/isc/md_test.c index 5f8eb74a52..d7d154c13b 100644 --- a/lib/isc/tests/md_test.c +++ b/tests/isc/md_test.c @@ -29,9 +29,9 @@ #include #include -#include "../md.c" +#include "md.c" -#include +#include #define TEST_INPUT(x) (x), sizeof(x) - 1 diff --git a/lib/isc/tests/mem_test.c b/tests/isc/mem_test.c similarity index 99% rename from lib/isc/tests/mem_test.c rename to tests/isc/mem_test.c index e3d838dc26..f2bbdbd3f4 100644 --- a/lib/isc/tests/mem_test.c +++ b/tests/isc/mem_test.c @@ -35,9 +35,9 @@ #include #include -#include "../mem_p.h" +#include "mem_p.h" -#include +#include #define MP1_FREEMAX 10 #define MP1_FILLCNT 10 diff --git a/lib/isc/tests/netaddr_test.c b/tests/isc/netaddr_test.c similarity index 99% rename from lib/isc/tests/netaddr_test.c rename to tests/isc/netaddr_test.c index 924c55e67c..b44982c26b 100644 --- a/lib/isc/tests/netaddr_test.c +++ b/tests/isc/netaddr_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include /* test isc_netaddr_isnetzero() */ ISC_RUN_TEST_IMPL(netaddr_isnetzero) { diff --git a/lib/isc/tests/netmgr_test.c b/tests/isc/netmgr_test.c similarity index 99% rename from lib/isc/tests/netmgr_test.c rename to tests/isc/netmgr_test.c index e71131f26f..1bd5d68819 100644 --- a/lib/isc/tests/netmgr_test.c +++ b/tests/isc/netmgr_test.c @@ -35,13 +35,13 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" -#include "../netmgr/netmgr.c" -#include "../netmgr/socket.c" -#include "../netmgr/udp.c" -#include "../uv.c" +//#include "netmgr/netmgr.c" +#include "netmgr/socket.c" +#include "netmgr/udp.c" +#include "uv.c" #pragma GCC diagnostic pop -#include +#include typedef void (*stream_connect_function)(isc_nm_t *nm); diff --git a/lib/isc/tests/parse_test.c b/tests/isc/parse_test.c similarity index 98% rename from lib/isc/tests/parse_test.c rename to tests/isc/parse_test.c index e250a37eec..a5b516a027 100644 --- a/lib/isc/tests/parse_test.c +++ b/tests/isc/parse_test.c @@ -29,7 +29,7 @@ #include #include -#include +#include /* Test for 32 bit overflow on 64 bit machines in isc_parse_uint32 */ ISC_RUN_TEST_IMPL(parse_overflow) { diff --git a/lib/isc/tests/quota_test.c b/tests/isc/quota_test.c similarity index 99% rename from lib/isc/tests/quota_test.c rename to tests/isc/quota_test.c index 611f36f5c0..d4ae843a4a 100644 --- a/lib/isc/tests/quota_test.c +++ b/tests/isc/quota_test.c @@ -19,7 +19,6 @@ #include #include #include -#include #define UNIT_TESTING #include @@ -28,8 +27,9 @@ #include #include #include +#include -#include +#include ISC_RUN_TEST_IMPL(isc_quota_get_set) { UNUSED(state); @@ -255,7 +255,7 @@ isc_thread_t g_threads[10 * 100]; static void * quota_detach(void *quotap) { isc_quota_t *quota = (isc_quota_t *)quotap; - uv_sleep(10000); + uv_sleep(10); isc_quota_detach("a); return ((isc_threadresult_t)0); } diff --git a/lib/isc/tests/radix_test.c b/tests/isc/radix_test.c similarity index 98% rename from lib/isc/tests/radix_test.c rename to tests/isc/radix_test.c index 642eafb542..2fe9294d69 100644 --- a/lib/isc/tests/radix_test.c +++ b/tests/isc/radix_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include /* test radix searching */ ISC_RUN_TEST_IMPL(isc_radix_search) { diff --git a/lib/isc/tests/random_test.c b/tests/isc/random_test.c similarity index 99% rename from lib/isc/tests/random_test.c rename to tests/isc/random_test.c index af200085ce..8c41e97138 100644 --- a/lib/isc/tests/random_test.c +++ b/tests/isc/random_test.c @@ -38,7 +38,7 @@ #include #include -#include +#include #define REPS 25000 diff --git a/lib/isc/tests/regex_test.c b/tests/isc/regex_test.c similarity index 99% rename from lib/isc/tests/regex_test.c rename to tests/isc/regex_test.c index 6336d76ab0..dd44d3bc89 100644 --- a/lib/isc/tests/regex_test.c +++ b/tests/isc/regex_test.c @@ -32,7 +32,7 @@ #include #include -#include +#include /* test isc_regex_validate() */ ISC_RUN_TEST_IMPL(regex_validate) { diff --git a/lib/isc/tests/result_test.c b/tests/isc/result_test.c similarity index 98% rename from lib/isc/tests/result_test.c rename to tests/isc/result_test.c index 319172a4af..cca66b85d6 100644 --- a/lib/isc/tests/result_test.c +++ b/tests/isc/result_test.c @@ -25,7 +25,7 @@ #include #include -#include +#include /* convert result to identifier string */ ISC_RUN_TEST_IMPL(isc_result_toid) { diff --git a/lib/isc/tests/safe_test.c b/tests/isc/safe_test.c similarity index 98% rename from lib/isc/tests/safe_test.c rename to tests/isc/safe_test.c index 7428f824a2..39221649c2 100644 --- a/lib/isc/tests/safe_test.c +++ b/tests/isc/safe_test.c @@ -26,7 +26,7 @@ #include #include -#include +#include /* test isc_safe_memequal() */ ISC_RUN_TEST_IMPL(isc_safe_memequal) { diff --git a/lib/isc/tests/siphash_test.c b/tests/isc/siphash_test.c similarity index 99% rename from lib/isc/tests/siphash_test.c rename to tests/isc/siphash_test.c index f7d14a470e..5480afd791 100644 --- a/lib/isc/tests/siphash_test.c +++ b/tests/isc/siphash_test.c @@ -23,9 +23,9 @@ #include -#include "../siphash.c" +#include "siphash.c" -#include +#include const uint8_t vectors_sip64[64][8] = { { 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72 }, diff --git a/lib/isc/tests/sockaddr_test.c b/tests/isc/sockaddr_test.c similarity index 99% rename from lib/isc/tests/sockaddr_test.c rename to tests/isc/sockaddr_test.c index b5f1568a1a..126bfa9fe4 100644 --- a/lib/isc/tests/sockaddr_test.c +++ b/tests/isc/sockaddr_test.c @@ -28,7 +28,7 @@ #include #include -#include +#include /* test sockaddr hash */ ISC_RUN_TEST_IMPL(sockaddr_hash) { diff --git a/lib/isc/tests/stats_test.c b/tests/isc/stats_test.c similarity index 99% rename from lib/isc/tests/stats_test.c rename to tests/isc/stats_test.c index dd35ba1e60..79d784e2df 100644 --- a/lib/isc/tests/stats_test.c +++ b/tests/isc/stats_test.c @@ -26,7 +26,7 @@ #include #include -#include +#include /* test stats */ ISC_RUN_TEST_IMPL(isc_stats_basic) { diff --git a/lib/isc/tests/symtab_test.c b/tests/isc/symtab_test.c similarity index 99% rename from lib/isc/tests/symtab_test.c rename to tests/isc/symtab_test.c index 193b08d5b7..bcbc0c43bb 100644 --- a/lib/isc/tests/symtab_test.c +++ b/tests/isc/symtab_test.c @@ -26,7 +26,7 @@ #include #include -#include +#include static void undefine(char *key, unsigned int type, isc_symvalue_t value, void *arg) { diff --git a/lib/isc/tests/task_test.c b/tests/isc/task_test.c similarity index 99% rename from lib/isc/tests/task_test.c rename to tests/isc/task_test.c index 9b60ec16cb..f7a20786d7 100644 --- a/lib/isc/tests/task_test.c +++ b/tests/isc/task_test.c @@ -20,7 +20,6 @@ #include #include #include -#include #define UNIT_TESTING @@ -37,8 +36,9 @@ #include #include #include +#include -#include +#include /* Set to true (or use -v option) for verbose output */ static bool verbose = false; @@ -154,7 +154,7 @@ ISC_RUN_TEST_IMPL(all_events) { isc_task_send(task, &event); while ((atomic_load(&a) == 0 || atomic_load(&b) == 0) && i++ < 5000) { - uv_sleep(1000); + uv_sleep(1); } assert_int_not_equal(atomic_load(&a), 0); @@ -372,7 +372,7 @@ ISC_RUN_TEST_IMPL(task_exclusive) { } while (atomic_load(&counter) > 0) { - uv_sleep(1000); + uv_sleep(1); } } diff --git a/lib/isc/tests/testdata/file/keep b/tests/isc/testdata/file/keep similarity index 100% rename from lib/isc/tests/testdata/file/keep rename to tests/isc/testdata/file/keep diff --git a/lib/isc/tests/time_test.c b/tests/isc/time_test.c similarity index 99% rename from lib/isc/tests/time_test.c rename to tests/isc/time_test.c index 9649b83171..4b355a7003 100644 --- a/lib/isc/tests/time_test.c +++ b/tests/isc/time_test.c @@ -26,9 +26,9 @@ #include #include -#include "../time.c" +#include "time.c" -#include +#include #define NS_PER_S 1000000000 /*%< Nanoseconds per second. */ #define MAX_NS (NS_PER_S - 1) diff --git a/lib/isc/tests/timer_test.c b/tests/isc/timer_test.c similarity index 99% rename from lib/isc/tests/timer_test.c rename to tests/isc/timer_test.c index f61438b36e..eeea651371 100644 --- a/lib/isc/tests/timer_test.c +++ b/tests/isc/timer_test.c @@ -19,7 +19,6 @@ #include #include #include -#include #define UNIT_TESTING #include @@ -33,10 +32,11 @@ #include #include #include +#include -#include "../timer.c" +#include "timer.c" -#include +#include /* Set to true (or use -v option) for verbose output */ static bool verbose = false; @@ -509,7 +509,7 @@ ISC_RUN_TEST_IMPL(purge) { * Wait for shutdown processing to complete. */ while (!atomic_load(&shutdownflag)) { - uv_sleep(1000); + uv_sleep(1); } assert_int_equal(atomic_load(&errcnt), ISC_R_SUCCESS); diff --git a/lib/isc/tests/uv_wrap.h b/tests/isc/uv_wrap.h similarity index 100% rename from lib/isc/tests/uv_wrap.h rename to tests/isc/uv_wrap.h diff --git a/lib/isccfg/tests/Makefile.am b/tests/isccfg/Makefile.am similarity index 61% rename from lib/isccfg/tests/Makefile.am rename to tests/isccfg/Makefile.am index 9ccddfab5b..73655a5401 100644 --- a/lib/isccfg/tests/Makefile.am +++ b/tests/isccfg/Makefile.am @@ -3,19 +3,14 @@ include $(top_srcdir)/Makefile.top AM_CPPFLAGS += \ $(LIBISC_CFLAGS) \ $(LIBDNS_CFLAGS) \ - $(LIBISCCFG_CFLAGS) + $(LIBISCCFG_CFLAGS) \ + -I$(top_srcdir)/lib/isc LDADD += \ - libisccfgtest.la \ $(LIBISC_LIBS) \ $(LIBDNS_LIBS) \ $(LIBISCCFG_LIBS) -check_LTLIBRARIES = libisccfgtest.la -libisccfgtest_la_SOURCES = \ - ../../isc/test.c \ - ../../isc/include/isc/test.h - check_PROGRAMS = \ duration_test \ parser_test diff --git a/lib/isccfg/tests/duration_test.c b/tests/isccfg/duration_test.c similarity index 99% rename from lib/isccfg/tests/duration_test.c rename to tests/isccfg/duration_test.c index b190ce3e3f..1fa15e32d9 100644 --- a/lib/isccfg/tests/duration_test.c +++ b/tests/isccfg/duration_test.c @@ -34,7 +34,7 @@ #include #include -#include +#include isc_log_t *lctx = NULL; static isc_logcategory_t categories[] = { { "", 0 }, diff --git a/lib/isccfg/tests/parser_test.c b/tests/isccfg/parser_test.c similarity index 99% rename from lib/isccfg/tests/parser_test.c rename to tests/isccfg/parser_test.c index d5d5d00a75..9a524ea2ad 100644 --- a/lib/isccfg/tests/parser_test.c +++ b/tests/isccfg/parser_test.c @@ -36,7 +36,7 @@ #include #include -#include +#include isc_log_t *lctx = NULL; static isc_logcategory_t categories[] = { { "", 0 }, diff --git a/lib/ns/test.c b/tests/ns.c similarity index 99% rename from lib/ns/test.c rename to tests/ns.c index e83e00379d..6de395b6ab 100644 --- a/lib/ns/test.c +++ b/tests/ns.c @@ -50,7 +50,7 @@ #include #include -#include +#include dns_dispatchmgr_t *dispatchmgr = NULL; ns_clientmgr_t *clientmgr = NULL; diff --git a/lib/ns/tests/Makefile.am b/tests/ns/Makefile.am similarity index 55% rename from lib/ns/tests/Makefile.am rename to tests/ns/Makefile.am index 6a00e6d1b6..50f87ca40a 100644 --- a/lib/ns/tests/Makefile.am +++ b/tests/ns/Makefile.am @@ -3,23 +3,15 @@ include $(top_srcdir)/Makefile.top AM_CPPFLAGS += \ $(LIBISC_CFLAGS) \ $(LIBDNS_CFLAGS) \ - $(LIBNS_CFLAGS) + $(LIBNS_CFLAGS) \ + -I$(top_srcdir)/lib/isc \ + -I$(top_srcdir)/lib/dns LDADD += \ - libnstest.la \ $(LIBISC_LIBS) \ $(LIBDNS_LIBS) \ $(LIBNS_LIBS) -check_LTLIBRARIES = libnstest.la -libnstest_la_SOURCES = \ - ../../isc/test.c \ - ../../isc/include/isc/test.h \ - ../../dns/test.c \ - ../../dns/include/dns/test.h \ - ../../ns/test.c \ - ../../ns/include/ns/test.h - check_PROGRAMS = \ listenlist_test \ notify_test \ diff --git a/lib/ns/tests/listenlist_test.c b/tests/ns/listenlist_test.c similarity index 99% rename from lib/ns/tests/listenlist_test.c rename to tests/ns/listenlist_test.c index 353fac22e7..565b943f7d 100644 --- a/lib/ns/tests/listenlist_test.c +++ b/tests/ns/listenlist_test.c @@ -33,7 +33,7 @@ #include -#include +#include static int _setup(void **state) { diff --git a/lib/ns/tests/notify_test.c b/tests/ns/notify_test.c similarity index 98% rename from lib/ns/tests/notify_test.c rename to tests/ns/notify_test.c index 57953c6a6c..c5e3009640 100644 --- a/lib/ns/tests/notify_test.c +++ b/tests/ns/notify_test.c @@ -37,9 +37,8 @@ #include #include -#include - -#include +#include +#include static int setup_test(void **state) { diff --git a/lib/ns/tests/plugin_test.c b/tests/ns/plugin_test.c similarity index 99% rename from lib/ns/tests/plugin_test.c rename to tests/ns/plugin_test.c index 5c2f371c2f..6434fae3a4 100644 --- a/lib/ns/tests/plugin_test.c +++ b/tests/ns/plugin_test.c @@ -35,7 +35,7 @@ _fail(const char *const file, const int line); #include -#include +#include /*% * Structure containing parameters for run_full_path_test(). diff --git a/lib/ns/tests/query_test.c b/tests/ns/query_test.c similarity index 99% rename from lib/ns/tests/query_test.c rename to tests/ns/query_test.c index de2fb849f0..c86d98d9ac 100644 --- a/lib/ns/tests/query_test.c +++ b/tests/ns/query_test.c @@ -38,7 +38,7 @@ #include #include -#include +#include static int setup_test(void **state) { diff --git a/lib/ns/tests/testdata/notify/notify1.msg b/tests/ns/testdata/notify/notify1.msg similarity index 100% rename from lib/ns/tests/testdata/notify/notify1.msg rename to tests/ns/testdata/notify/notify1.msg diff --git a/lib/ns/tests/testdata/notify/zone1.db b/tests/ns/testdata/notify/zone1.db similarity index 100% rename from lib/ns/tests/testdata/notify/zone1.db rename to tests/ns/testdata/notify/zone1.db diff --git a/lib/ns/tests/testdata/query/foo.db b/tests/ns/testdata/query/foo.db similarity index 100% rename from lib/ns/tests/testdata/query/foo.db rename to tests/ns/testdata/query/foo.db diff --git a/lib/unit-test-driver.sh.in b/tests/unit-test-driver.sh.in similarity index 100% rename from lib/unit-test-driver.sh.in rename to tests/unit-test-driver.sh.in