diff --git a/bin/tests/.gitignore b/bin/tests/.gitignore index 88317fd020..9b2e581b06 100644 --- a/bin/tests/.gitignore +++ b/bin/tests/.gitignore @@ -8,7 +8,6 @@ t_db gsstest t_dst t_names -t_rbt conf.sh dlopen keycreate diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index 55353af70e..b327d272ee 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -32,8 +32,7 @@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ LIBS = @LIBS@ -SUBDIR = db dst names rbt system \ - @PKCS11_TOOLS@ optional +SUBDIR = db dst names system @PKCS11_TOOLS@ optional TESTDIRS = system diff --git a/bin/tests/rbt/Makefile.in b/bin/tests/rbt/Makefile.in deleted file mode 100644 index 3322da3a17..0000000000 --- a/bin/tests/rbt/Makefile.in +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} - -CDEFINES = -CWARNINGS = - -# Note that we do not want to use libtool for libt_api -DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ - -DNSDEPLIBS = ../../../lib/dns/libdns.@A@ -ISCDEPLIBS = ../../../lib/isc/libisc.@A@ - -DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS} - -LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@ - -TLIB = ../../../lib/tests/libt_api.@A@ - -TARGETS = t_rbt@EXEEXT@ - -SRCS = t_rbt.c - -@BIND9_MAKE_RULES@ - -t_rbt@EXEEXT@: t_rbt.@O@ ${DEPLIBS} ${TLIB} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ t_rbt.@O@ ${TLIB} ${LIBS} - -test: t_rbt@EXEEXT@ - -@./t_rbt@EXEEXT@ -c @top_srcdir@/t_config -b @srcdir@ -a - -testhelp: - @./t_rbt@EXEEXT@ -h - -clean distclean:: - rm -f ${TARGETS} diff --git a/bin/tests/rbt/dns_rbt.data b/bin/tests/rbt/dns_rbt.data deleted file mode 100644 index e58eb45911..0000000000 --- a/bin/tests/rbt/dns_rbt.data +++ /dev/null @@ -1,14 +0,0 @@ -a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. -a.b.c.d.e.f.vix.com -a.d.e.f.vix.com -a.vix.com -b.b.c.d.e.f.vix.com -b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. -b.vix.com -c.b.c.d.e.f.vix.com -c.vix.com -d.e.f.vix.com -g.h.vix.com -q.d.e.f.vix.com -x.a.vix.com -y.x.a.vix.com diff --git a/bin/tests/rbt/dns_rbt_addname_1_data b/bin/tests/rbt/dns_rbt_addname_1_data deleted file mode 100644 index 89dca408eb..0000000000 --- a/bin/tests/rbt/dns_rbt_addname_1_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbt_addname assertion 1 -# -# format is: -# -dns_rbt.data add new.name ISC_R_SUCCESS diff --git a/bin/tests/rbt/dns_rbt_addname_2_data b/bin/tests/rbt/dns_rbt_addname_2_data deleted file mode 100644 index 762bd8bc53..0000000000 --- a/bin/tests/rbt/dns_rbt_addname_2_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbt_addname assertion 2 -# -# format is: -# -dns_rbt.data add a.vix.com ISC_R_EXISTS diff --git a/bin/tests/rbt/dns_rbt_bitstring.data b/bin/tests/rbt/dns_rbt_bitstring.data deleted file mode 100644 index 2b34cc6328..0000000000 --- a/bin/tests/rbt/dns_rbt_bitstring.data +++ /dev/null @@ -1,10 +0,0 @@ -a.vix.com -b.vix.com -c.vix.com -a.a.vix.com -a.a.a.vix.com -a.a.a.a.vix.com -a.a.a.a.a.vix.com -a.a.a.a.a.a.vix.com -a.a.a.a.a.a.a.vix.com -a.a.a.a.a.a.a.a.vix.com diff --git a/bin/tests/rbt/dns_rbt_create_1_data b/bin/tests/rbt/dns_rbt_create_1_data deleted file mode 100644 index 72f8dc4b5c..0000000000 --- a/bin/tests/rbt/dns_rbt_create_1_data +++ /dev/null @@ -1,7 +0,0 @@ -# -# test data for dns_rbt_create assertion 1 -# -# format is: -# -dns_rbt.data create not.used ISC_R_SUCCESS -dns_rbt_bitstring.data create not.used ISC_R_SUCCESS diff --git a/bin/tests/rbt/dns_rbt_deletename_1_data b/bin/tests/rbt/dns_rbt_deletename_1_data deleted file mode 100644 index 2e00e502ab..0000000000 --- a/bin/tests/rbt/dns_rbt_deletename_1_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbt_delete assertion 1 -# -# format is: -# -dns_rbt.data delete a.vix.com ISC_R_SUCCESS diff --git a/bin/tests/rbt/dns_rbt_deletename_2_data b/bin/tests/rbt/dns_rbt_deletename_2_data deleted file mode 100644 index 0b1fdb7b6c..0000000000 --- a/bin/tests/rbt/dns_rbt_deletename_2_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbt_delete assertion 2 -# -# format is: -# -dns_rbt.data delete new.name ISC_R_NOTFOUND diff --git a/bin/tests/rbt/dns_rbt_findname_1_data b/bin/tests/rbt/dns_rbt_findname_1_data deleted file mode 100644 index 2a3728dd08..0000000000 --- a/bin/tests/rbt/dns_rbt_findname_1_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbt_findname assertion 1 -# -# format is: -# -dns_rbt.data search a.vix.com ISC_R_SUCCESS diff --git a/bin/tests/rbt/dns_rbt_findname_2_data b/bin/tests/rbt/dns_rbt_findname_2_data deleted file mode 100644 index eb3d467b30..0000000000 --- a/bin/tests/rbt/dns_rbt_findname_2_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbt_findname assertion 2 -# -# format is: -# -dns_rbt.data search not.used.here ISC_R_NOTFOUND diff --git a/bin/tests/rbt/dns_rbt_findname_3_data b/bin/tests/rbt/dns_rbt_findname_3_data deleted file mode 100644 index 4ea2db301a..0000000000 --- a/bin/tests/rbt/dns_rbt_findname_3_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbt_findname assertion 3 -# -# format is: -# -dns_rbt.data search a.b.vix.com DNS_R_PARTIALMATCH diff --git a/bin/tests/rbt/dns_rbtnodechain_first_1.data b/bin/tests/rbt/dns_rbtnodechain_first_1.data deleted file mode 100644 index 85bd8c2e18..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_first_1.data +++ /dev/null @@ -1,13 +0,0 @@ -b.com -a.vix.com -b.vix.com -c.vix.com -a.a.vix.com -b.a.vix.com -a.b.vix.com -b.b.vix.com -a.c.vix.com -b.c.vix.com -iengines.net -isc.org - diff --git a/bin/tests/rbt/dns_rbtnodechain_first_2.data b/bin/tests/rbt/dns_rbtnodechain_first_2.data deleted file mode 100644 index 268376b93c..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_first_2.data +++ /dev/null @@ -1,9 +0,0 @@ -a.a.vix.com -b.a.vix.com -a.b.vix.com -b.b.vix.com -a.c.vix.com -b.c.vix.com -iengines.net -isc.org - diff --git a/bin/tests/rbt/dns_rbtnodechain_first_data b/bin/tests/rbt/dns_rbtnodechain_first_data deleted file mode 100644 index 057a1d66b5..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_first_data +++ /dev/null @@ -1,7 +0,0 @@ -# -# test data for dns_rbtnodechain_first -# -# format is: -# -dns_rbtnodechain_first_1.data @ . com . -dns_rbtnodechain_first_2.data @ . vix.com . diff --git a/bin/tests/rbt/dns_rbtnodechain_init.data b/bin/tests/rbt/dns_rbtnodechain_init.data deleted file mode 100644 index 1e0bfc9c0a..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_init.data +++ /dev/null @@ -1,13 +0,0 @@ -vix.com -a.vix.com -b.vix.com -c.vix.com -a.a.vix.com -b.a.vix.com -a.b.vix.com -b.b.vix.com -a.c.vix.com -b.c.vix.com -iengines.net -isc.org - diff --git a/bin/tests/rbt/dns_rbtnodechain_init_data b/bin/tests/rbt/dns_rbtnodechain_init_data deleted file mode 100644 index f1a6aa4032..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_init_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbtnodechain_init -# -# format is: -# -dns_rbtnodechain_init.data b.vix.com. a b.vix.com. b a.vix.com. @ . isc.org . diff --git a/bin/tests/rbt/dns_rbtnodechain_last_1.data b/bin/tests/rbt/dns_rbtnodechain_last_1.data deleted file mode 100644 index 1e0bfc9c0a..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_last_1.data +++ /dev/null @@ -1,13 +0,0 @@ -vix.com -a.vix.com -b.vix.com -c.vix.com -a.a.vix.com -b.a.vix.com -a.b.vix.com -b.b.vix.com -a.c.vix.com -b.c.vix.com -iengines.net -isc.org - diff --git a/bin/tests/rbt/dns_rbtnodechain_last_2.data b/bin/tests/rbt/dns_rbtnodechain_last_2.data deleted file mode 100644 index 4d0c76d0fe..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_last_2.data +++ /dev/null @@ -1,7 +0,0 @@ -a.b.vix.com -b.b.vix.com -a.c.vix.com -b.c.vix.com -vayu.com -isc.org - diff --git a/bin/tests/rbt/dns_rbtnodechain_last_data b/bin/tests/rbt/dns_rbtnodechain_last_data deleted file mode 100644 index bf06a216ba..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_last_data +++ /dev/null @@ -1,7 +0,0 @@ -# -# test data for dns_rbtnodechain_last -# -# format is: -# -dns_rbtnodechain_last_1.data isc.org . iengines.net . -dns_rbtnodechain_last_2.data isc.org . b c.vix.com. diff --git a/bin/tests/rbt/dns_rbtnodechain_next.data b/bin/tests/rbt/dns_rbtnodechain_next.data deleted file mode 100644 index 1e0bfc9c0a..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_next.data +++ /dev/null @@ -1,13 +0,0 @@ -vix.com -a.vix.com -b.vix.com -c.vix.com -a.a.vix.com -b.a.vix.com -a.b.vix.com -b.b.vix.com -a.c.vix.com -b.c.vix.com -iengines.net -isc.org - diff --git a/bin/tests/rbt/dns_rbtnodechain_next_data b/bin/tests/rbt/dns_rbtnodechain_next_data deleted file mode 100644 index a69ab37a5f..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_next_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbtnodechain_next -# -# format is: -# -dns_rbtnodechain_next.data c.vix.com. a c.vix.com. diff --git a/bin/tests/rbt/dns_rbtnodechain_prev.data b/bin/tests/rbt/dns_rbtnodechain_prev.data deleted file mode 100644 index 1e0bfc9c0a..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_prev.data +++ /dev/null @@ -1,13 +0,0 @@ -vix.com -a.vix.com -b.vix.com -c.vix.com -a.a.vix.com -b.a.vix.com -a.b.vix.com -b.b.vix.com -a.c.vix.com -b.c.vix.com -iengines.net -isc.org - diff --git a/bin/tests/rbt/dns_rbtnodechain_prev_data b/bin/tests/rbt/dns_rbtnodechain_prev_data deleted file mode 100644 index 4c8450dc67..0000000000 --- a/bin/tests/rbt/dns_rbtnodechain_prev_data +++ /dev/null @@ -1,6 +0,0 @@ -# -# test data for dns_rbtnodechain_prev -# -# format is: -# -dns_rbtnodechain_prev.data a.b.vix.com. b vix.com. diff --git a/bin/tests/rbt/t_rbt.c b/bin/tests/rbt/t_rbt.c deleted file mode 100644 index 7398914b42..0000000000 --- a/bin/tests/rbt/t_rbt.c +++ /dev/null @@ -1,1868 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/* $Id: t_rbt.c,v 1.35 2011/03/12 04:59:46 tbox Exp $ */ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#define BUFLEN 1024 -#define DNSNAMELEN 255 - -char *progname; -char *Tokens[T_MAXTOKS]; - -static int -t_dns_rbtnodechain_init(char *dbfile, char *findname, - char *nextname, char *nextorigin, - char *prevname, char *prevorigin, - char *firstname, char *firstorigin, - char *lastname, char *lastorigin); -static char * -fixedname_totext(dns_fixedname_t *name); - -static int -fixedname_cmp(dns_fixedname_t *dns_name, char *txtname); - -static char * -dnsname_totext(dns_name_t *name); - -static int -t_namechk(isc_result_t dns_result, dns_fixedname_t *dns_name, char *exp_name, - dns_fixedname_t *dns_origin, char *exp_origin, - isc_result_t exp_result); - -/* - * Parts adapted from the original rbt_test.c. - */ -static int -fixedname_cmp(dns_fixedname_t *dns_name, char *txtname) { - char *name; - - name = dnsname_totext(dns_fixedname_name(dns_name)); - if (strcmp(txtname, "NULL") == 0) { - if ((name == NULL) || (*name == '\0')) - return(0); - return(1); - } else { - return(strcmp(name, txtname)); - } -} - -static char * -dnsname_totext(dns_name_t *name) { - static char buf[BUFLEN]; - isc_buffer_t target; - - isc_buffer_init(&target, buf, BUFLEN); - dns_name_totext(name, ISC_FALSE, &target); - *((char *)(target.base) + target.used) = '\0'; - return(target.base); -} - -static char * -fixedname_totext(dns_fixedname_t *name) { - static char buf[BUFLEN]; - isc_buffer_t target; - - memset(buf, 0, BUFLEN); - isc_buffer_init(&target, buf, BUFLEN); - dns_name_totext(dns_fixedname_name(name), ISC_FALSE, &target); - *((char *)(target.base) + target.used) = '\0'; - return(target.base); -} - -#ifdef NEED_PRINT_DATA - -static isc_result_t -print_data(void *data) { - isc_result_t dns_result; - isc_buffer_t target; - char *buffer[DNSNAMELEN]; - - isc_buffer_init(&target, buffer, sizeof(buffer)); - - dns_result = dns_name_totext(data, ISC_FALSE, &target); - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_totext failed %s\n", - dns_result_totext(dns_result)); - } - return(dns_result); -} - -#endif /* NEED_PRINT_DATA */ - -static int -create_name(char *s, isc_mem_t *mctx, dns_name_t **dns_name) { - int nfails; - int length; - isc_result_t result; - isc_buffer_t source; - isc_buffer_t target; - dns_name_t *name; - - nfails = 0; - - if (s && *s) { - - length = strlen(s); - - isc_buffer_init(&source, s, length); - isc_buffer_add(&source, length); - - /* - * The buffer for the actual name will immediately follow the - * name structure. - */ - name = isc_mem_get(mctx, sizeof(*name) + DNSNAMELEN); - if (name == NULL) { - t_info("isc_mem_get failed\n"); - ++nfails; - } else { - - dns_name_init(name, NULL); - isc_buffer_init(&target, name + 1, DNSNAMELEN); - - result = dns_name_fromtext(name, &source, dns_rootname, - 0, &target); - - if (result != ISC_R_SUCCESS) { - ++nfails; - t_info("dns_name_fromtext(%s) failed %s\n", - s, dns_result_totext(result)); - isc_mem_put(mctx, name, - sizeof(*name) + DNSNAMELEN); - } else - *dns_name = name; - } - } else { - ++nfails; - t_info("create_name: empty name\n"); - } - - return(nfails); -} - -static void -delete_name(void *data, void *arg) { - isc_mem_put((isc_mem_t *)arg, data, sizeof(dns_name_t) + DNSNAMELEN); -} - - -/* - * Adapted from the original rbt_test.c. - */ -static int -t1_add(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) { - int nprobs; - dns_name_t *dns_name; - - nprobs = 0; - if (name && dns_result) { - if (create_name(name, mctx, &dns_name) == 0) { - if (T_debug) - t_info("dns_rbt_addname succeeded\n"); - *dns_result = dns_rbt_addname(rbt, dns_name, dns_name); - if (*dns_result != ISC_R_SUCCESS) { - delete_name(dns_name, mctx); - t_info("dns_rbt_addname failed %s\n", - dns_result_totext(*dns_result)); - ++nprobs; - } - } else { - ++nprobs; - } - } else { - ++nprobs; - } - return(nprobs); -} - -static int -t1_delete(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, - isc_result_t *dns_result) -{ - int nprobs; - dns_name_t *dns_name; - - nprobs = 0; - if (name && dns_result) { - if (create_name(name, mctx, &dns_name) == 0) { - *dns_result = dns_rbt_deletename(rbt, dns_name, - ISC_FALSE); - delete_name(dns_name, mctx); - } else { - ++nprobs; - } - } else { - ++nprobs; - } - return(nprobs); -} - -static int -t1_search(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, - isc_result_t *dns_result) -{ - int nprobs; - dns_name_t *dns_searchname; - dns_name_t *dns_foundname; - dns_fixedname_t dns_fixedname; - void *data; - - nprobs = 0; - if (name && dns_result) { - if (create_name(name, mctx, &dns_searchname) == 0) { - dns_fixedname_init(&dns_fixedname); - dns_foundname = dns_fixedname_name(&dns_fixedname); - data = NULL; - *dns_result = dns_rbt_findname(rbt, dns_searchname, 0, - dns_foundname, &data); - delete_name(dns_searchname, mctx); - } else { - ++nprobs; - } - } else { - ++nprobs; - } - return(nprobs); -} - -/* - * Initialize a database from filename. - */ -static int -rbt_init(char *filename, dns_rbt_t **rbt, isc_mem_t *mctx) { - int rval; - isc_result_t dns_result; - char *p; - FILE *fp; - - fp = fopen(filename, "r"); - if (fp == NULL) { - t_info("No such file %s\n", filename); - return(1); - } - - dns_result = dns_rbt_create(mctx, delete_name, mctx, rbt); - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_rbt_create failed %s\n", - dns_result_totext(dns_result)); - fclose(fp); - return(1); - } - - while ((p = t_fgetbs(fp)) != NULL) { - - /* - * Skip any comment lines. - */ - if ((*p == '#') || (*p == '\0') || (*p == ' ')) { - (void)free(p); - continue; - } - - if (T_debug) - t_info("adding name %s to the rbt\n", p); - - rval = t1_add(p, *rbt, mctx, &dns_result); - if ((rval != 0) || (dns_result != ISC_R_SUCCESS)) { - t_info("add of %s failed\n", p); - dns_rbt_destroy(rbt); - (void) free(p); - fclose(fp); - return(1); - } - (void) free(p); - } - fclose(fp); - return(0); -} - -static int -test_rbt_gen(char *filename, char *command, char *testname, - isc_result_t exp_result) -{ - int rval; - int result; - dns_rbt_t *rbt; - isc_result_t isc_result; - isc_result_t dns_result; - isc_mem_t *mctx; - isc_entropy_t *ectx; - dns_name_t *dns_name; - - result = T_UNRESOLVED; - - if (strcmp(command, "create") != 0) - t_info("testing using name %s\n", testname); - - mctx = NULL; - ectx = NULL; - - isc_result = isc_mem_create(0, 0, &mctx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create: %s: exiting\n", - dns_result_totext(isc_result)); - return(T_UNRESOLVED); - } - - isc_result = isc_entropy_create(mctx, &ectx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_entropy_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - isc_result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_hash_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - rbt = NULL; - if (rbt_init(filename, &rbt, mctx) != 0) { - if (strcmp(command, "create") == 0) - result = T_FAIL; - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); - } - - /* - * Now try the database command. - */ - if (strcmp(command, "create") == 0) { - result = T_PASS; - } else if (strcmp(command, "add") == 0) { - if (create_name(testname, mctx, &dns_name) == 0) { - dns_result = dns_rbt_addname(rbt, dns_name, dns_name); - - if (dns_result != ISC_R_SUCCESS) - delete_name(dns_name, mctx); - - if (dns_result == exp_result) { - if (dns_result == ISC_R_SUCCESS) { - rval = t1_search(testname, rbt, mctx, - &dns_result); - if (rval == 0) { - if (dns_result == ISC_R_SUCCESS) { - result = T_PASS; - } else { - result = T_FAIL; - } - } else { - t_info("t1_search failed\n"); - result = T_UNRESOLVED; - } - } else { - result = T_PASS; - } - } else { - t_info("dns_rbt_addname returned %s, " - "expected %s\n", - dns_result_totext(dns_result), - dns_result_totext(exp_result)); - result = T_FAIL; - } - } else { - t_info("create_name failed\n"); - result = T_UNRESOLVED; - } - } else if ((strcmp(command, "delete") == 0) || - (strcmp(command, "nuke") == 0)) { - rval = t1_delete(testname, rbt, mctx, &dns_result); - if (rval == 0) { - if (dns_result == exp_result) { - rval = t1_search(testname, rbt, mctx, - &dns_result); - if (rval == 0) { - if (dns_result == ISC_R_SUCCESS) { - t_info("dns_rbt_deletename " - "didn't delete " - "the name"); - result = T_FAIL; - } else { - result = T_PASS; - } - } - } else { - t_info("delete returned %s, expected %s\n", - dns_result_totext(dns_result), - dns_result_totext(exp_result)); - result = T_FAIL; - } - } - } else if (strcmp(command, "search") == 0) { - rval = t1_search(testname, rbt, mctx, &dns_result); - if (rval == 0) { - if (dns_result == exp_result) { - result = T_PASS; - } else { - t_info("find returned %s, expected %s\n", - dns_result_totext(dns_result), - dns_result_totext(exp_result)); - result = T_FAIL; - } - } - } - - dns_rbt_destroy(&rbt); - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); -} - -static int -test_dns_rbt_x(const char *filename) { - FILE *fp; - char *p; - int line; - int cnt; - int result; - int nfails; - int nprobs; - - nfails = 0; - nprobs = 0; - - fp = fopen(filename, "r"); - if (fp != NULL) { - line = 0; - while ((p = t_fgetbs(fp)) != NULL) { - - ++line; - - /* - * Skip comment lines. - */ - if ((isspace((unsigned char)*p)) || (*p == '#')) { - (void)free(p); - continue; - } - - /* - * Name of db file, command, testname, - * expected result. - */ - cnt = t_bustline(p, Tokens); - if (cnt == 4) { - result = test_rbt_gen(Tokens[0], Tokens[1], - Tokens[2], - t_dns_result_fromtext(Tokens[3])); - if (result != T_PASS) - ++nfails; - } else { - t_info("bad format in %s at line %d\n", - filename, line); - ++nprobs; - } - - (void)free(p); - } - (void)fclose(fp); - } else { - t_info("Missing datafile %s\n", filename); - ++nprobs; - } - - result = T_UNRESOLVED; - if ((nfails == 0) && (nprobs == 0)) - result = T_PASS; - else if (nfails) - result = T_FAIL; - - return(result); -} - - -static const char *a1 = "dns_rbt_create creates a rbt and returns " - "ISC_R_SUCCESS on success"; - -static void -t1() { - int result; - - t_assert("dns_rbt_create", 1, T_REQUIRED, "%s", a1); - result = test_dns_rbt_x("dns_rbt_create_1_data"); - t_result(result); -} - -static const char *a2 = "dns_rbt_addname adds a name to a database and " - "returns ISC_R_SUCCESS on success"; - -static void -t2() { - int result; - - t_assert("dns_rbt_addname", 2, T_REQUIRED, "%s", a2); - result = test_dns_rbt_x("dns_rbt_addname_1_data"); - t_result(result); -} - -static const char *a3 = "when name already exists, dns_rbt_addname() " - "returns ISC_R_EXISTS"; - -static void -t3() { - int result; - - t_assert("dns_rbt_addname", 3, T_REQUIRED, "%s", a3); - result = test_dns_rbt_x("dns_rbt_addname_2_data"); - t_result(result); -} - -static const char *a4 = "when name exists, dns_rbt_deletename() returns " - "ISC_R_SUCCESS"; - -static void -t4() { - int result; - - t_assert("dns_rbt_deletename", 4, T_REQUIRED, "%s", a4); - result = test_dns_rbt_x("dns_rbt_deletename_1_data"); - t_result(result); -} - -static const char *a5 = "when name does not exist, dns_rbt_deletename() " - "returns ISC_R_NOTFOUND"; -static void -t5() { - int result; - - t_assert("dns_rbt_deletename", 5, T_REQUIRED, "%s", a5); - result = test_dns_rbt_x("dns_rbt_deletename_2_data"); - t_result(result); -} - -static const char *a6 = "when name exists and exactly matches the " - "search name dns_rbt_findname() returns ISC_R_SUCCESS"; - -static void -t6() { - int result; - - t_assert("dns_rbt_findname", 6, T_REQUIRED, "%s", a6); - result = test_dns_rbt_x("dns_rbt_findname_1_data"); - t_result(result); -} - -static const char *a7 = "when a name does not exist, " - "dns_rbt_findname returns ISC_R_NOTFOUND"; - -static void -t7() { - int result; - - t_assert("dns_rbt_findname", 7, T_REQUIRED, "%s", a7); - result = test_dns_rbt_x("dns_rbt_findname_2_data"); - t_result(result); -} - -static const char *a8 = "when a superdomain is found with data matching name, " - "dns_rbt_findname returns DNS_R_PARTIALMATCH"; - -static void -t8() { - int result; - - t_assert("dns_rbt_findname", 8, T_REQUIRED, "%s", a8); - result = test_dns_rbt_x("dns_rbt_findname_3_data"); - t_result(result); -} - - -static const char *a9 = "a call to dns_rbtnodechain_init(chain, mctx) " - "initializes chain"; - -static int -t9_walkchain(dns_rbtnodechain_t *chain, dns_rbt_t *rbt) { - int cnt; - int order; - unsigned int nlabels; - int nprobs; - isc_result_t dns_result; - - dns_fixedname_t name; - dns_fixedname_t origin; - dns_fixedname_t fullname1; - dns_fixedname_t fullname2; - - cnt = 0; - nprobs = 0; - - do { - - if (cnt == 0) { - dns_fixedname_init(&name); - dns_fixedname_init(&origin); - dns_result = dns_rbtnodechain_first(chain, rbt, - dns_fixedname_name(&name), - dns_fixedname_name(&origin)); - if (dns_result != DNS_R_NEWORIGIN) { - t_info("dns_rbtnodechain_first returned %s, " - "expecting DNS_R_NEWORIGIN\n", - dns_result_totext(dns_result)); - ++nprobs; - break; - } - t_info("first name:\t<%s>\n", fixedname_totext(&name)); - t_info("first origin:\t<%s>\n", - fixedname_totext(&origin)); - } else { - dns_fixedname_init(&fullname1); - dns_result = dns_name_concatenate( - dns_fixedname_name(&name), - dns_name_isabsolute(dns_fixedname_name(&name)) ? - NULL : dns_fixedname_name(&origin), - dns_fixedname_name(&fullname1), NULL); - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_concatenate failed %s\n", - dns_result_totext(dns_result)); - ++nprobs; - break; - } - - /* - * Expecting origin not to get touched if next - * doesn't return NEWORIGIN. - */ - dns_fixedname_init(&name); - dns_result = dns_rbtnodechain_next(chain, - dns_fixedname_name(&name), - dns_fixedname_name(&origin)); - if ((dns_result != ISC_R_SUCCESS) && - (dns_result != DNS_R_NEWORIGIN)) { - if (dns_result != ISC_R_NOMORE) { - t_info("dns_rbtnodechain_next " - "failed %s\n", - dns_result_totext(dns_result)); - ++nprobs; - } - break; - } - - t_info("next name:\t<%s>\n", fixedname_totext(&name)); - t_info("next origin:\t<%s>\n", - fixedname_totext(&origin)); - - dns_fixedname_init(&fullname2); - dns_result = dns_name_concatenate( - dns_fixedname_name(&name), - dns_name_isabsolute(dns_fixedname_name(&name)) ? - NULL : dns_fixedname_name(&origin), - dns_fixedname_name(&fullname2), NULL); - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_concatenate failed %s\n", - dns_result_totext(dns_result)); - ++nprobs; - break; - } - - t_info("comparing\t<%s>\n", - fixedname_totext(&fullname1)); - t_info("\twith\t<%s>\n", fixedname_totext(&fullname2)); - - (void)dns_name_fullcompare( - dns_fixedname_name(&fullname1), - dns_fixedname_name(&fullname2), - &order, &nlabels); - - if (order >= 0) { - t_info("unexpected order %s %s %s\n", - dnsname_totext(dns_fixedname_name(&fullname1)), - order == 0 ? "==" : ">", - dnsname_totext(dns_fixedname_name(&fullname2))); - ++nprobs; - } - } - - ++cnt; - } while (1); - - return (nprobs); -} - -/* - * Test by exercising the first|last|next|prev funcs in useful ways. - */ - -static int -t_namechk(isc_result_t dns_result, dns_fixedname_t *dns_name, char *exp_name, - dns_fixedname_t *dns_origin, char *exp_origin, - isc_result_t exp_result) -{ - int nfails; - - nfails = 0; - - if (fixedname_cmp(dns_name, exp_name)) { - t_info("\texpected name of %s, got %s\n", - exp_name, fixedname_totext(dns_name)); - ++nfails; - } - if (exp_origin != NULL) { - t_info("checking for DNS_R_NEWORIGIN\n"); - if (dns_result == exp_result) { - if (fixedname_cmp(dns_origin, exp_origin)) { - t_info("\torigin %s, expected %s\n", - fixedname_totext(dns_origin), - exp_origin); - ++nfails; - } - } else { - t_info("\tgot %s\n", dns_result_totext(dns_result)); - ++nfails; - } - } - return(nfails); -} - -static int -t_dns_rbtnodechain_init(char *dbfile, char *findname, - char *nextname, char *nextorigin, - char *prevname, char *prevorigin, - char *firstname, char *firstorigin, - char *lastname, char *lastorigin) -{ - int result; - int len; - int nfails; - dns_rbt_t *rbt; - dns_rbtnode_t *node; - dns_rbtnodechain_t chain; - isc_mem_t *mctx; - isc_entropy_t *ectx; - isc_result_t isc_result; - isc_result_t dns_result; - dns_fixedname_t dns_findname; - dns_fixedname_t dns_foundname; - dns_fixedname_t dns_firstname; - dns_fixedname_t dns_lastname; - dns_fixedname_t dns_prevname; - dns_fixedname_t dns_nextname; - dns_fixedname_t dns_origin; - isc_buffer_t isc_buffer; - - result = T_UNRESOLVED; - - nfails = 0; - mctx = NULL; - ectx = NULL; - - isc_result = isc_mem_create(0, 0, &mctx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); - return(result); - } - - isc_result = isc_entropy_create(mctx, &ectx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_entropy_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - isc_result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_hash_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - dns_rbtnodechain_init(&chain, mctx); - - rbt = NULL; - if (rbt_init(dbfile, &rbt, mctx)) { - t_info("rbt_init %s failed\n", dbfile); - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); - } - - len = strlen(findname); - isc_buffer_init(&isc_buffer, findname, len); - isc_buffer_add(&isc_buffer, len); - - dns_fixedname_init(&dns_foundname); - dns_fixedname_init(&dns_findname); - dns_fixedname_init(&dns_firstname); - dns_fixedname_init(&dns_origin); - dns_fixedname_init(&dns_lastname); - dns_fixedname_init(&dns_prevname); - dns_fixedname_init(&dns_nextname); - - dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname), - &isc_buffer, NULL, 0, NULL); - - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_fromtext failed %s\n", - dns_result_totext(dns_result)); - return(result); - } - - /* - * Set the starting node. - */ - node = NULL; - dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), - dns_fixedname_name(&dns_foundname), - &node, &chain, DNS_RBTFIND_EMPTYDATA, - NULL, NULL); - - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_rbt_findnode failed %s\n", - dns_result_totext(dns_result)); - return(result); - } - - /* - * Check next. - */ - t_info("checking for next name of %s and new origin of %s\n", - nextname, nextorigin); - dns_result = dns_rbtnodechain_next(&chain, - dns_fixedname_name(&dns_nextname), - dns_fixedname_name(&dns_origin)); - - if ((dns_result != ISC_R_SUCCESS) && - (dns_result != DNS_R_NEWORIGIN)) { - t_info("dns_rbtnodechain_next unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - - nfails += t_namechk(dns_result, &dns_nextname, nextname, &dns_origin, - nextorigin, DNS_R_NEWORIGIN); - - /* - * Set the starting node again. - */ - node = NULL; - dns_fixedname_init(&dns_foundname); - dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), - dns_fixedname_name(&dns_foundname), - &node, &chain, DNS_RBTFIND_EMPTYDATA, - NULL, NULL); - - if (dns_result != ISC_R_SUCCESS) { - t_info("\tdns_rbt_findnode failed %s\n", - dns_result_totext(dns_result)); - return(result); - } - - /* - * Check previous. - */ - t_info("checking for previous name of %s and new origin of %s\n", - prevname, prevorigin); - dns_fixedname_init(&dns_origin); - dns_result = dns_rbtnodechain_prev(&chain, - dns_fixedname_name(&dns_prevname), - dns_fixedname_name(&dns_origin)); - - if ((dns_result != ISC_R_SUCCESS) && - (dns_result != DNS_R_NEWORIGIN)) { - t_info("dns_rbtnodechain_prev unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - nfails += t_namechk(dns_result, &dns_prevname, prevname, &dns_origin, - prevorigin, DNS_R_NEWORIGIN); - - /* - * Check first. - */ - t_info("checking for first name of %s and new origin of %s\n", - firstname, firstorigin); - dns_result = dns_rbtnodechain_first(&chain, rbt, - dns_fixedname_name(&dns_firstname), - dns_fixedname_name(&dns_origin)); - - if (dns_result != DNS_R_NEWORIGIN) { - t_info("dns_rbtnodechain_first unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - nfails += t_namechk(dns_result, &dns_firstname, firstname, - &dns_origin, firstorigin, DNS_R_NEWORIGIN); - - /* - * Check last. - */ - t_info("checking for last name of %s\n", lastname); - dns_result = dns_rbtnodechain_last(&chain, rbt, - dns_fixedname_name(&dns_lastname), - dns_fixedname_name(&dns_origin)); - - if (dns_result != DNS_R_NEWORIGIN) { - t_info("dns_rbtnodechain_last unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - nfails += t_namechk(dns_result, &dns_lastname, lastname, &dns_origin, - lastorigin, DNS_R_NEWORIGIN); - - /* - * Check node ordering. - */ - t_info("checking node ordering\n"); - nfails += t9_walkchain(&chain, rbt); - - if (nfails) - result = T_FAIL; - else - result = T_PASS; - - dns_rbtnodechain_invalidate(&chain); - dns_rbt_destroy(&rbt); - - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - - return(result); -} - -static int -test_dns_rbtnodechain_init(const char *filename) { - FILE *fp; - char *p; - int line; - int cnt; - int result; - int nfails; - int nprobs; - - nfails = 0; - nprobs = 0; - - fp = fopen(filename, "r"); - if (fp != NULL) { - line = 0; - while ((p = t_fgetbs(fp)) != NULL) { - - ++line; - - /* - * Skip comment lines. - */ - if ((isspace((unsigned char)*p)) || (*p == '#')) { - (void)free(p); - continue; - } - - cnt = t_bustline(p, Tokens); - if (cnt == 10) { - result = t_dns_rbtnodechain_init( - Tokens[0], /* dbfile */ - Tokens[1], /* startname */ - Tokens[2], /* nextname */ - Tokens[3], /* nextorigin */ - Tokens[4], /* prevname */ - Tokens[5], /* prevorigin */ - Tokens[6], /* firstname */ - Tokens[7], /* firstorigin */ - Tokens[8], /* lastname */ - Tokens[9]); /* lastorigin */ - if (result != T_PASS) { - if (result == T_FAIL) - ++nfails; - else - ++nprobs; - } - } else { - t_info("bad format in %s at line %d\n", - filename, line); - ++nprobs; - } - - (void)free(p); - } - (void)fclose(fp); - } else { - t_info("Missing datafile %s\n", filename); - ++nprobs; - } - - result = T_UNRESOLVED; - - if ((nfails == 0) && (nprobs == 0)) - result = T_PASS; - else if (nfails) - result = T_FAIL; - - return(result); -} - -static void -t9() { - int result; - - t_assert("dns_rbtnodechain_init", 9, T_REQUIRED, "%s", a9); - result = test_dns_rbtnodechain_init("dns_rbtnodechain_init_data"); - t_result(result); -} - -static int -t_dns_rbtnodechain_first(char *dbfile, char *expected_firstname, - char *expected_firstorigin, - char *expected_nextname, - char *expected_nextorigin) -{ - int result; - int nfails; - dns_rbt_t *rbt; - dns_rbtnodechain_t chain; - isc_mem_t *mctx; - isc_entropy_t *ectx; - isc_result_t isc_result; - isc_result_t dns_result; - dns_fixedname_t dns_name; - dns_fixedname_t dns_origin; - isc_result_t expected_result; - - REQUIRE(dbfile != NULL); - REQUIRE(expected_firstname != NULL); - REQUIRE(expected_firstorigin != NULL); - REQUIRE(expected_nextname != NULL); - REQUIRE(expected_nextorigin != NULL); - - result = T_UNRESOLVED; - - nfails = 0; - mctx = NULL; - ectx = NULL; - - dns_fixedname_init(&dns_name); - dns_fixedname_init(&dns_origin); - - isc_result = isc_mem_create(0, 0, &mctx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); - return(result); - } - - isc_result = isc_entropy_create(mctx, &ectx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_entropy_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - isc_result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_hash_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - dns_rbtnodechain_init(&chain, mctx); - - rbt = NULL; - if (rbt_init(dbfile, &rbt, mctx)) { - t_info("rbt_init %s failed\n", dbfile); - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); - } - - t_info("testing for first name of %s, origin of %s\n", - expected_firstname, expected_firstorigin); - - dns_result = dns_rbtnodechain_first(&chain, rbt, - dns_fixedname_name(&dns_name), - dns_fixedname_name(&dns_origin)); - - if (dns_result != DNS_R_NEWORIGIN) - t_info("dns_rbtnodechain_first unexpectedly returned %s\n", - dns_result_totext(dns_result)); - - nfails += t_namechk(dns_result, &dns_name, expected_firstname, - &dns_origin, expected_firstorigin, DNS_R_NEWORIGIN); - - dns_fixedname_init(&dns_name); - dns_result = dns_rbtnodechain_next(&chain, - dns_fixedname_name(&dns_name), - dns_fixedname_name(&dns_origin)); - - t_info("testing for next name of %s, origin of %s\n", - expected_nextname, expected_nextorigin); - - if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) - t_info("dns_rbtnodechain_next unexpectedly returned %s\n", - dns_result_totext(dns_result)); - - if (strcasecmp(expected_firstorigin, expected_nextorigin) == 0) - expected_result = ISC_R_SUCCESS; - else - expected_result = DNS_R_NEWORIGIN; - nfails += t_namechk(dns_result, &dns_name, expected_nextname, - &dns_origin, expected_nextorigin, expected_result); - - if (nfails) - result = T_FAIL; - else - result = T_PASS; - - dns_rbtnodechain_invalidate(&chain); - - dns_rbt_destroy(&rbt); - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); -} - -static int -test_dns_rbtnodechain_first(const char *filename) { - FILE *fp; - char *p; - int line; - int cnt; - int result; - int nfails; - int nprobs; - - nfails = 0; - nprobs = 0; - - fp = fopen(filename, "r"); - if (fp != NULL) { - line = 0; - while ((p = t_fgetbs(fp)) != NULL) { - - ++line; - - /* - * Skip comment lines. - */ - if ((isspace((unsigned char)*p)) || (*p == '#')) { - (void)free(p); - continue; - } - - cnt = t_bustline(p, Tokens); - if (cnt == 5) { - result = t_dns_rbtnodechain_first( - Tokens[0], /* dbfile */ - Tokens[1], /* firstname */ - Tokens[2], /* firstorigin */ - Tokens[3], /* nextname */ - Tokens[4]); /* nextorigin */ - if (result != T_PASS) { - if (result == T_FAIL) - ++nfails; - else - ++nprobs; - } - } else { - t_info("bad format in %s at line %d\n", - filename, line); - ++nprobs; - } - - (void)free(p); - } - (void)fclose(fp); - } else { - t_info("Missing datafile %s\n", filename); - ++nprobs; - } - - result = T_UNRESOLVED; - - if ((nfails == 0) && (nprobs == 0)) - result = T_PASS; - else if (nfails) - result = T_FAIL; - - return(result); -} - -static const char *a10 = "a call to " - "dns_rbtnodechain_first(chain, rbt, name, origin) " - "sets name to point to the root of the tree, " - "origin to point to the origin, " - "and returns DNS_R_NEWORIGIN"; - -static void -t10() { - int result; - - t_assert("dns_rbtnodechain_first", 10, T_REQUIRED, "%s", a10); - result = test_dns_rbtnodechain_first("dns_rbtnodechain_first_data"); - t_result(result); -} - -static int -t_dns_rbtnodechain_last(char *dbfile, char *expected_lastname, - char *expected_lastorigin, - char *expected_prevname, - char *expected_prevorigin) -{ - - int result; - int nfails; - dns_rbt_t *rbt; - dns_rbtnodechain_t chain; - isc_mem_t *mctx; - isc_entropy_t *ectx; - isc_result_t isc_result; - isc_result_t dns_result; - dns_fixedname_t dns_name; - dns_fixedname_t dns_origin; - isc_result_t expected_result; - - REQUIRE(dbfile != NULL); - REQUIRE(expected_lastname != NULL); - REQUIRE(expected_lastorigin != NULL); - REQUIRE(expected_prevname != NULL); - REQUIRE(expected_prevorigin != NULL); - - result = T_UNRESOLVED; - - nfails = 0; - mctx = NULL; - ectx = NULL; - - dns_fixedname_init(&dns_name); - dns_fixedname_init(&dns_origin); - - isc_result = isc_mem_create(0, 0, &mctx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); - return(result); - } - - isc_result = isc_entropy_create(mctx, &ectx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_entropy_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - isc_result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_hash_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - dns_rbtnodechain_init(&chain, mctx); - - rbt = NULL; - if (rbt_init(dbfile, &rbt, mctx)) { - t_info("rbt_init %s failed\n", dbfile); - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); - } - - t_info("testing for last name of %s, origin of %s\n", - expected_lastname, expected_lastorigin); - - dns_result = dns_rbtnodechain_last(&chain, rbt, - dns_fixedname_name(&dns_name), - dns_fixedname_name(&dns_origin)); - - if (dns_result != DNS_R_NEWORIGIN) { - t_info("dns_rbtnodechain_last unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - nfails += t_namechk(dns_result, &dns_name, expected_lastname, - &dns_origin, expected_lastorigin, DNS_R_NEWORIGIN); - - t_info("testing for previous name of %s, origin of %s\n", - expected_prevname, expected_prevorigin); - - dns_fixedname_init(&dns_name); - dns_result = dns_rbtnodechain_prev(&chain, - dns_fixedname_name(&dns_name), - dns_fixedname_name(&dns_origin)); - - if ((dns_result != ISC_R_SUCCESS) && - (dns_result != DNS_R_NEWORIGIN)) { - t_info("dns_rbtnodechain_prev unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - if (strcasecmp(expected_lastorigin, expected_prevorigin) == 0) - expected_result = ISC_R_SUCCESS; - else - expected_result = DNS_R_NEWORIGIN; - nfails += t_namechk(dns_result, &dns_name, expected_prevname, - &dns_origin, expected_prevorigin, expected_result); - - if (nfails) - result = T_FAIL; - else - result = T_PASS; - - dns_rbtnodechain_invalidate(&chain); - dns_rbt_destroy(&rbt); - - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - - return(result); -} - -static int -test_dns_rbtnodechain_last(const char *filename) { - FILE *fp; - char *p; - int line; - int cnt; - int result; - int nfails; - int nprobs; - - nfails = 0; - nprobs = 0; - - fp = fopen(filename, "r"); - if (fp != NULL) { - line = 0; - while ((p = t_fgetbs(fp)) != NULL) { - - ++line; - - /* - * Skip comment lines. - */ - if ((isspace((unsigned char)*p)) || (*p == '#')) { - (void)free(p); - continue; - } - - cnt = t_bustline(p, Tokens); - if (cnt == 5) { - result = t_dns_rbtnodechain_last( - Tokens[0], /* dbfile */ - Tokens[1], /* lastname */ - Tokens[2], /* lastorigin */ - Tokens[3], /* prevname */ - Tokens[4]); /* prevorigin */ - if (result != T_PASS) { - if (result == T_FAIL) - ++nfails; - else - ++nprobs; - } - } else { - t_info("bad format in %s at line %d\n", - filename, line); - ++nprobs; - } - - (void)free(p); - } - (void)fclose(fp); - } else { - t_info("Missing datafile %s\n", filename); - ++nprobs; - } - - result = T_UNRESOLVED; - - if ((nfails == 0) && (nprobs == 0)) - result = T_PASS; - else if (nfails) - result = T_FAIL; - - return(result); -} - -static const char *a11 = "a call to " - "dns_rbtnodechain_last(chain, rbt, name, origin) " - "sets name to point to the last node of the megatree, " - "origin to the name of the level above it, " - "and returns DNS_R_NEWORIGIN"; - -static void -t11() { - int result; - - t_assert("dns_rbtnodechain_last", 11, T_REQUIRED, "%s", a11); - result = test_dns_rbtnodechain_last("dns_rbtnodechain_last_data"); - t_result(result); -} - -static int -t_dns_rbtnodechain_next(char *dbfile, char *findname, - char *nextname, char *nextorigin) -{ - - int result; - int len; - int nfails; - dns_rbt_t *rbt; - dns_rbtnode_t *node; - dns_rbtnodechain_t chain; - isc_mem_t *mctx; - isc_entropy_t *ectx; - isc_result_t isc_result; - isc_result_t dns_result; - dns_fixedname_t dns_findname; - dns_fixedname_t dns_foundname; - dns_fixedname_t dns_nextname; - dns_fixedname_t dns_origin; - isc_buffer_t isc_buffer; - - result = T_UNRESOLVED; - - nfails = 0; - mctx = NULL; - ectx = NULL; - - isc_result = isc_mem_create(0, 0, &mctx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); - return(result); - } - - isc_result = isc_entropy_create(mctx, &ectx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_entropy_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - isc_result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_hash_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - dns_rbtnodechain_init(&chain, mctx); - - rbt = NULL; - if (rbt_init(dbfile, &rbt, mctx)) { - t_info("rbt_init %s failed\n", dbfile); - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); - } - - len = strlen(findname); - isc_buffer_init(&isc_buffer, findname, len); - isc_buffer_add(&isc_buffer, len); - - dns_fixedname_init(&dns_foundname); - dns_fixedname_init(&dns_findname); - dns_fixedname_init(&dns_nextname); - dns_fixedname_init(&dns_origin); - - dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname), - &isc_buffer, NULL, 0, NULL); - - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_fromtext failed %s\n", - dns_result_totext(dns_result)); - return(result); - } - - /* - * Set the starting node. - */ - node = NULL; - dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), - dns_fixedname_name(&dns_foundname), - &node, &chain, DNS_RBTFIND_EMPTYDATA, - NULL, NULL); - - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_rbt_findnode failed %s\n", - dns_result_totext(dns_result)); - return(result); - } - - /* - * Check next. - */ - t_info("checking for next name of %s and new origin of %s\n", - nextname, nextorigin); - dns_result = dns_rbtnodechain_next(&chain, - dns_fixedname_name(&dns_nextname), - dns_fixedname_name(&dns_origin)); - - if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { - t_info("dns_rbtnodechain_next unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - - nfails += t_namechk(dns_result, &dns_nextname, nextname, &dns_origin, - nextorigin, DNS_R_NEWORIGIN); - - if (nfails) - result = T_FAIL; - else - result = T_PASS; - - dns_rbtnodechain_invalidate(&chain); - dns_rbt_destroy(&rbt); - - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - - return(result); -} - -static int -test_dns_rbtnodechain_next(const char *filename) { - FILE *fp; - char *p; - int line; - int cnt; - int result; - int nfails; - int nprobs; - - nfails = 0; - nprobs = 0; - - fp = fopen(filename, "r"); - if (fp != NULL) { - line = 0; - while ((p = t_fgetbs(fp)) != NULL) { - - ++line; - - /* - * Skip comment lines. - */ - if ((isspace((unsigned char)*p)) || (*p == '#')) { - (void)free(p); - continue; - } - - cnt = t_bustline(p, Tokens); - if (cnt == 4) { - result = t_dns_rbtnodechain_next( - Tokens[0], /* dbfile */ - Tokens[1], /* findname */ - Tokens[2], /* nextname */ - Tokens[3]); /* nextorigin */ - if (result != T_PASS) { - if (result == T_FAIL) - ++nfails; - else - ++nprobs; - } - } else { - t_info("bad format in %s at line %d\n", - filename, line); - ++nprobs; - } - - (void)free(p); - } - (void)fclose(fp); - } else { - t_info("Missing datafile %s\n", filename); - ++nprobs; - } - - result = T_UNRESOLVED; - - if ((nfails == 0) && (nprobs == 0)) - result = T_PASS; - else if (nfails) - result = T_FAIL; - - return(result); -} - -static const char *a12 = "a call to " - "dns_rbtnodechain_next(chain, name, origin) " - "sets name to point to the next node of the tree " - "and returns ISC_R_SUCCESS or " - "DNS_R_NEWORIGIN on success"; - - -static void -t12() { - int result; - - t_assert("dns_rbtnodechain_next", 12, T_REQUIRED, "%s", a12); - result = test_dns_rbtnodechain_next("dns_rbtnodechain_next_data"); - t_result(result); -} - -static int -t_dns_rbtnodechain_prev(char *dbfile, char *findname, char *prevname, - char *prevorigin) -{ - int result; - int len; - int nfails; - dns_rbt_t *rbt; - dns_rbtnode_t *node; - dns_rbtnodechain_t chain; - isc_mem_t *mctx; - isc_entropy_t *ectx = NULL; - isc_result_t isc_result; - isc_result_t dns_result; - dns_fixedname_t dns_findname; - dns_fixedname_t dns_foundname; - dns_fixedname_t dns_prevname; - dns_fixedname_t dns_origin; - isc_buffer_t isc_buffer; - - result = T_UNRESOLVED; - - nfails = 0; - mctx = NULL; - ectx = NULL; - - isc_result = isc_mem_create(0, 0, &mctx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); - return(result); - } - - isc_result = isc_entropy_create(mctx, &ectx); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_entropy_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - isc_result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); - if (isc_result != ISC_R_SUCCESS) { - t_info("isc_hash_create: %s: exiting\n", - dns_result_totext(isc_result)); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(T_UNRESOLVED); - } - - dns_rbtnodechain_init(&chain, mctx); - - rbt = NULL; - if (rbt_init(dbfile, &rbt, mctx)) { - t_info("rbt_init %s failed\n", dbfile); - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - return(result); - } - - len = strlen(findname); - isc_buffer_init(&isc_buffer, findname, len); - isc_buffer_add(&isc_buffer, len); - - dns_fixedname_init(&dns_foundname); - dns_fixedname_init(&dns_findname); - dns_fixedname_init(&dns_prevname); - dns_fixedname_init(&dns_origin); - - dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname), - &isc_buffer, NULL, 0, NULL); - - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_fromtext failed %s\n", - dns_result_totext(dns_result)); - return(result); - } - - /* - * Set the starting node. - */ - node = NULL; - dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), - dns_fixedname_name(&dns_foundname), - &node, &chain, DNS_RBTFIND_EMPTYDATA, - NULL, NULL); - - if (dns_result != ISC_R_SUCCESS) { - t_info("dns_rbt_findnode failed %s\n", - dns_result_totext(dns_result)); - return(result); - } - - /* - * Check next. - */ - t_info("checking for next name of %s and new origin of %s\n", - prevname, prevorigin); - dns_result = dns_rbtnodechain_prev(&chain, - dns_fixedname_name(&dns_prevname), - dns_fixedname_name(&dns_origin)); - - if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { - t_info("dns_rbtnodechain_prev unexpectedly returned %s\n", - dns_result_totext(dns_result)); - } - - nfails += t_namechk(dns_result, &dns_prevname, prevname, &dns_origin, - prevorigin, DNS_R_NEWORIGIN); - - if (nfails) - result = T_FAIL; - else - result = T_PASS; - - dns_rbtnodechain_invalidate(&chain); - dns_rbt_destroy(&rbt); - - isc_hash_destroy(); - isc_entropy_detach(&ectx); - isc_mem_destroy(&mctx); - - return(result); -} - -static int -test_dns_rbtnodechain_prev(const char *filename) { - FILE *fp; - char *p; - int line; - int cnt; - int result; - int nfails; - int nprobs; - - nfails = 0; - nprobs = 0; - - fp = fopen(filename, "r"); - if (fp != NULL) { - line = 0; - while ((p = t_fgetbs(fp)) != NULL) { - - ++line; - - /* - * Skip comment lines. - */ - if ((isspace((unsigned char)*p)) || (*p == '#')) { - (void)free(p); - continue; - } - - cnt = t_bustline(p, Tokens); - if (cnt == 4) { - result = t_dns_rbtnodechain_prev( - Tokens[0], /* dbfile */ - Tokens[1], /* findname */ - Tokens[2], /* prevname */ - Tokens[3]); /* prevorigin */ - if (result != T_PASS) { - if (result == T_FAIL) - ++nfails; - else - ++nprobs; - } - } else { - t_info("bad format in %s at line %d\n", - filename, line); - ++nprobs; - } - - (void)free(p); - } - (void)fclose(fp); - } else { - t_info("Missing datafile %s\n", filename); - ++nprobs; - } - - result = T_UNRESOLVED; - - if ((nfails == 0) && (nprobs == 0)) - result = T_PASS; - else if (nfails) - result = T_FAIL; - - return(result); -} - -static const char *a13 = "a call to " - "dns_rbtnodechain_prev(chain, name, origin) " - "sets name to point to the previous node of the tree " - "and returns ISC_R_SUCCESS or " - "DNS_R_NEWORIGIN on success"; - -static void -t13() { - int result; - - t_assert("dns_rbtnodechain_prev", 13, T_REQUIRED, "%s", a13); - result = test_dns_rbtnodechain_prev("dns_rbtnodechain_prev_data"); - t_result(result); -} - -testspec_t T_testlist[] = { - { (PFV) t1, "dns_rbt_create" }, - { (PFV) t2, "dns_rbt_addname 1" }, - { (PFV) t3, "dns_rbt_addname 2" }, - { (PFV) t4, "dns_rbt_deletename 1" }, - { (PFV) t5, "dns_rbt_deletename 2" }, - { (PFV) t6, "dns_rbt_findname 1" }, - { (PFV) t7, "dns_rbt_findname 2" }, - { (PFV) t8, "dns_rbt_findname 3" }, - { (PFV) t9, "dns_rbtnodechain_init" }, - { (PFV) t10, "dns_rbtnodechain_first" }, - { (PFV) t11, "dns_rbtnodechain_last" }, - { (PFV) t12, "dns_rbtnodechain_next" }, - { (PFV) t13, "dns_rbtnodechain_prev" }, - { (PFV) 0, NULL } -}; - -#ifdef WIN32 -int -main(int argc, char **argv) { - t_settests(T_testlist); - return (t_main(argc, argv)); -} -#endif diff --git a/bin/tests/rbt/win32/t_rbt.vcxproj.filters.in b/bin/tests/rbt/win32/t_rbt.vcxproj.filters.in deleted file mode 100644 index d85dd49f07..0000000000 --- a/bin/tests/rbt/win32/t_rbt.vcxproj.filters.in +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/bin/tests/rbt/win32/t_rbt.vcxproj.in b/bin/tests/rbt/win32/t_rbt.vcxproj.in deleted file mode 100644 index cd4034d6a7..0000000000 --- a/bin/tests/rbt/win32/t_rbt.vcxproj.in +++ /dev/null @@ -1,110 +0,0 @@ - - - - - Debug - @PLATFORM@ - - - Release - @PLATFORM@ - - - - {39F714D4-FEFB-4E23-91DB-1F6FC80A98B5} - Win32Proj - t_rbt - - - - Application - true - MultiByte - - - Application - false - true - MultiByte - - - - - - - - - - - - - true - ..\..\..\..\Build\$(Configuration)\ - .\$(Configuration)\ - - - false - ..\..\..\..\Build\$(Configuration)\ - .\$(Configuration)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - .\$(Configuration)\$(TargetName).pch - .\$(Configuration)\ - .\$(Configuration)\ - $(OutDir)$(TargetName).pdb - true - .\;..\..\..\..\;@LIBXML2_INC@..\..\..\..\lib\isc\win32;..\..\..\..\lib\isc\win32\include;..\..\..\..\lib\isc\include;..\..\..\..\lib\dns\include;..\..\..\..\lib\tests\include;%(AdditionalIncludeDirectories) - CompileAsC - - - Console - true - ..\..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt) - ..\..\..\..\lib\isc\win32\$(Configuration);..\..\..\..\lib\dns\win32\$(Configuration);..\..\..\..\lib\tests\win32\$(Configuration);%(AdditionalLibraryDirectories) - @LIBXML2_LIB@libisc.lib;libdns.lib;libtests.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - @INTRINSIC@ - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - OnlyExplicitInline - false - true - .\$(Configuration)\$(TargetName).pch - .\$(Configuration)\ - .\$(Configuration)\ - $(OutDir)$(TargetName).pdb - .\;..\..\..\..\;@LIBXML2_INC@..\..\..\..\lib\isc\win32;..\..\..\..\lib\isc\win32\include;..\..\..\..\lib\isc\include;..\..\..\..\lib\dns\include;..\..\..\..\lib\tests\include;%(AdditionalIncludeDirectories) - CompileAsC - - - Console - false - true - true - ..\..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt) - Default - ..\..\..\..\lib\isc\win32\$(Configuration);..\..\..\..\lib\dns\win32\$(Configuration);..\..\..\..\lib\tests\win32\$(Configuration);%(AdditionalLibraryDirectories) - @LIBXML2_LIB@libisc.lib;libdns.lib;libtests.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - - - - - diff --git a/bin/tests/rbt/win32/t_rbt.vcxproj.user b/bin/tests/rbt/win32/t_rbt.vcxproj.user deleted file mode 100644 index 695b5c78b9..0000000000 --- a/bin/tests/rbt/win32/t_rbt.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/configure b/configure index 22f9de5dd7..a94f7efb31 100755 --- a/configure +++ b/configure @@ -24157,7 +24157,7 @@ ac_config_commands="$ac_config_commands chmod" # elsewhere if there's a good reason for doing so. # -ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/db/Makefile bin/tests/dst/Makefile bin/tests/dst/Kdh.+002+18602.key bin/tests/dst/Kdh.+002+18602.private bin/tests/dst/Kdh.+002+48957.key bin/tests/dst/Kdh.+002+48957.private bin/tests/dst/Ktest.+001+00002.key bin/tests/dst/Ktest.+001+54622.key bin/tests/dst/Ktest.+001+54622.private bin/tests/dst/Ktest.+003+23616.key bin/tests/dst/Ktest.+003+23616.private bin/tests/dst/Ktest.+003+49667.key bin/tests/dst/dst_2_data bin/tests/dst/t2_data_1 bin/tests/dst/t2_data_2 bin/tests/dst/t2_dsasig bin/tests/dst/t2_rsasig bin/tests/headerdep_test.sh bin/tests/names/Makefile bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/rbt/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/inline/checkdsa.sh bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh" +ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/db/Makefile bin/tests/dst/Makefile bin/tests/dst/Kdh.+002+18602.key bin/tests/dst/Kdh.+002+18602.private bin/tests/dst/Kdh.+002+48957.key bin/tests/dst/Kdh.+002+48957.private bin/tests/dst/Ktest.+001+00002.key bin/tests/dst/Ktest.+001+54622.key bin/tests/dst/Ktest.+001+54622.private bin/tests/dst/Ktest.+003+23616.key bin/tests/dst/Ktest.+003+23616.private bin/tests/dst/Ktest.+003+49667.key bin/tests/dst/dst_2_data bin/tests/dst/t2_data_1 bin/tests/dst/t2_data_2 bin/tests/dst/t2_dsasig bin/tests/dst/t2_rsasig bin/tests/headerdep_test.sh bin/tests/names/Makefile bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/inline/checkdsa.sh bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh" # @@ -25218,7 +25218,6 @@ do "bin/tests/optional/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/optional/Makefile" ;; "bin/tests/pkcs11/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/pkcs11/Makefile" ;; "bin/tests/pkcs11/benchmarks/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/pkcs11/benchmarks/Makefile" ;; - "bin/tests/rbt/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/rbt/Makefile" ;; "bin/tests/system/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/system/Makefile" ;; "bin/tests/system/conf.sh") CONFIG_FILES="$CONFIG_FILES bin/tests/system/conf.sh" ;; "bin/tests/system/dlz/prereq.sh") CONFIG_FILES="$CONFIG_FILES bin/tests/system/dlz/prereq.sh" ;; diff --git a/configure.in b/configure.in index 4feda596c6..1147dfb0e1 100644 --- a/configure.in +++ b/configure.in @@ -5335,7 +5335,6 @@ AC_CONFIG_FILES([ bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile - bin/tests/rbt/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh diff --git a/lib/dns/tests/dnstest.c b/lib/dns/tests/dnstest.c index 861cebb02b..e9ccf8dfa8 100644 --- a/lib/dns/tests/dnstest.c +++ b/lib/dns/tests/dnstest.c @@ -493,3 +493,25 @@ dns_test_rdata_fromstring(dns_rdata_t *rdata, dns_rdataclass_t rdclass, return (result); } + +void +dns_test_namefromstring(const char *namestr, dns_fixedname_t *fname) { + size_t length; + isc_buffer_t *b = NULL; + isc_result_t result; + dns_name_t *name; + + length = strlen(namestr); + + result = isc_buffer_allocate(mctx, &b, length); + ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); + isc_buffer_putmem(b, (const unsigned char *) namestr, length); + + dns_fixedname_init(fname); + name = dns_fixedname_name(fname); + ATF_REQUIRE(name != NULL); + result = dns_name_fromtext(name, b, dns_rootname, 0, NULL); + ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); + + isc_buffer_free(&b); +} diff --git a/lib/dns/tests/dnstest.h b/lib/dns/tests/dnstest.h index 3329ff5cb0..e9f48097b8 100644 --- a/lib/dns/tests/dnstest.h +++ b/lib/dns/tests/dnstest.h @@ -93,3 +93,6 @@ isc_result_t dns_test_rdata_fromstring(dns_rdata_t *rdata, dns_rdataclass_t rdclass, dns_rdatatype_t rdtype, unsigned char *dst, size_t dstlen, const char *src); + +void +dns_test_namefromstring(const char *namestr, dns_fixedname_t *fname); diff --git a/lib/dns/tests/rbt_test.c b/lib/dns/tests/rbt_test.c index 32718f029c..271952aa42 100644 --- a/lib/dns/tests/rbt_test.c +++ b/lib/dns/tests/rbt_test.c @@ -9,8 +9,6 @@ * information regarding copyright ownership. */ -/* $Id: rbt_test.c,v 1.1.14.8 2012/02/10 16:24:37 ckb Exp $ */ - /* ! \file */ #include @@ -27,6 +25,7 @@ #include #include +#include #include #include #include "dnstest.h" @@ -136,28 +135,6 @@ delete_data(void *data, void *arg) { isc_mem_put(mctx, data, sizeof(size_t)); } -static void -build_name_from_str(const char *namestr, dns_fixedname_t *fname) { - size_t length; - isc_buffer_t *b = NULL; - isc_result_t result; - dns_name_t *name; - - length = strlen(namestr); - - result = isc_buffer_allocate(mctx, &b, length); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - isc_buffer_putmem(b, (const unsigned char *) namestr, length); - - dns_fixedname_init(fname); - name = dns_fixedname_name(fname); - ATF_REQUIRE(name != NULL); - result = dns_name_fromtext(name, b, dns_rootname, 0, NULL); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - isc_buffer_free(&b); -} - static test_context_t * test_context_setup(void) { test_context_t *ctx; @@ -180,7 +157,7 @@ test_context_setup(void) { dns_fixedname_t fname; dns_name_t *name; - build_name_from_str(domain_names[i], &fname); + dns_test_namefromstring(domain_names[i], &fname); name = dns_fixedname_name(&fname); @@ -224,7 +201,7 @@ check_test_data(dns_rbt_t *rbt) { dns_name_t *name; size_t *n; - build_name_from_str(domain_names[i], &fname); + dns_test_namefromstring(domain_names[i], &fname); name = dns_fixedname_name(&fname); n = NULL; @@ -310,7 +287,7 @@ ATF_TC_BODY(rbtnode_get_distance, tc) { ctx = test_context_setup(); - build_name_from_str(name_str, &fname); + dns_test_namefromstring(name_str, &fname); name = dns_fixedname_name(&fname); dns_rbtnodechain_init(&chain, mctx); @@ -397,7 +374,7 @@ ATF_TC_BODY(rbt_check_distance_random, tc) { namebuf[32] = '.'; namebuf[33] = 0; - build_name_from_str(namebuf, &fname); + dns_test_namefromstring(namebuf, &fname); name = dns_fixedname_name(&fname); result = dns_rbt_addname(mytree, name, n); @@ -471,7 +448,7 @@ ATF_TC_BODY(rbt_check_distance_ordered, tc) { *n = i + 1; snprintf(namebuf, sizeof(namebuf), "name%08x.", i); - build_name_from_str(namebuf, &fname); + dns_test_namefromstring(namebuf, &fname); name = dns_fixedname_name(&fname); result = dns_rbt_addname(mytree, name, n); @@ -500,7 +477,7 @@ insert_helper(dns_rbt_t *rbt, const char *namestr, dns_rbtnode_t **node) { dns_fixedname_t fname; dns_name_t *name; - build_name_from_str(namestr, &fname); + dns_test_namefromstring(namestr, &fname); name = dns_fixedname_name(&fname); return (dns_rbt_addnode(rbt, name, node)); @@ -739,7 +716,7 @@ ATF_TC_BODY(rbt_remove, tc) { dns_fixedname_t fname; dns_name_t *name; - build_name_from_str(ordered_names[i], &fname); + dns_test_namefromstring(ordered_names[i], &fname); name = dns_fixedname_name(&fname); node = NULL; @@ -764,7 +741,7 @@ ATF_TC_BODY(rbt_remove, tc) { dns_fixedname_t fname; dns_name_t *name; - build_name_from_str(ordered_names[j], &fname); + dns_test_namefromstring(ordered_names[j], &fname); name = dns_fixedname_name(&fname); @@ -787,7 +764,7 @@ ATF_TC_BODY(rbt_remove, tc) { dns_fixedname_t fname; dns_name_t *name; - build_name_from_str(ordered_names[0], &fname); + dns_test_namefromstring(ordered_names[0], &fname); name = dns_fixedname_name(&fname); node = NULL; result = dns_rbt_findnode(mytree, name, NULL, @@ -796,7 +773,7 @@ ATF_TC_BODY(rbt_remove, tc) { NULL, NULL); ATF_CHECK_EQ(result, ISC_R_NOTFOUND); - build_name_from_str(ordered_names[1], &fname); + dns_test_namefromstring(ordered_names[1], &fname); name = dns_fixedname_name(&fname); node = NULL; result = dns_rbt_findnode(mytree, name, NULL, @@ -810,7 +787,7 @@ ATF_TC_BODY(rbt_remove, tc) { dns_fixedname_t fname; dns_name_t *name; - build_name_from_str(ordered_names[0], &fname); + dns_test_namefromstring(ordered_names[0], &fname); name = dns_fixedname_name(&fname); node = NULL; result = dns_rbt_findnode(mytree, name, NULL, @@ -829,9 +806,9 @@ ATF_TC_BODY(rbt_remove, tc) { dns_fixedname_t fname_j, fname_i; dns_name_t *name_j, *name_i; - build_name_from_str(ordered_names[j], &fname_j); + dns_test_namefromstring(ordered_names[j], &fname_j); name_j = dns_fixedname_name(&fname_j); - build_name_from_str(ordered_names[i], &fname_i); + dns_test_namefromstring(ordered_names[i], &fname_i); name_i = dns_fixedname_name(&fname_i); if (dns_name_equal(name_i, name_j)) { @@ -922,7 +899,7 @@ insert_nodes(dns_rbt_t *mytree, char **names, namebuf[32] = '.'; namebuf[33] = 0; - build_name_from_str(namebuf, &fname); + dns_test_namefromstring(namebuf, &fname); name = dns_fixedname_name(&fname); node = NULL; @@ -956,7 +933,7 @@ remove_nodes(dns_rbt_t *mytree, char **names, node %= *names_count; - build_name_from_str(names[node], &fname); + dns_test_namefromstring(names[node], &fname); name = dns_fixedname_name(&fname); result = dns_rbt_deletename(mytree, name, ISC_FALSE); @@ -1081,6 +1058,213 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) { dns_test_end(); } +ATF_TC(rbt_findname); +ATF_TC_HEAD(rbt_findname, tc) { + atf_tc_set_md_var(tc, "descr", "findname return values"); +} +ATF_TC_BODY(rbt_findname, tc) { + isc_result_t result; + test_context_t *ctx = NULL; + dns_fixedname_t fname, found; + dns_name_t *name = NULL, *foundname = NULL; + size_t *n = NULL; + + UNUSED(tc); + + isc_mem_debugging = ISC_MEM_DEBUGRECORD; + + result = dns_test_begin(NULL, ISC_TRUE); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + ctx = test_context_setup(); + + /* Try to find a name that exists. */ + dns_test_namefromstring("d.e.f", &fname); + name = dns_fixedname_name(&fname); + + dns_fixedname_init(&found); + foundname = dns_fixedname_name(&found); + + result = dns_rbt_findname(ctx->rbt, name, + DNS_RBTFIND_EMPTYDATA, + foundname, (void *) &n); + ATF_CHECK(dns_name_equal(foundname, name)); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + /* Now without EMPTYDATA */ + result = dns_rbt_findname(ctx->rbt, name, 0, + foundname, (void *) &n); + ATF_CHECK_EQ(result, ISC_R_NOTFOUND); + + /* Now one that partially matches */ + dns_test_namefromstring("d.e.f.g.h.i.j", &fname); + name = dns_fixedname_name(&fname); + result = dns_rbt_findname(ctx->rbt, name, + DNS_RBTFIND_EMPTYDATA, + foundname, (void *) &n); + ATF_CHECK_EQ(result, DNS_R_PARTIALMATCH); + + /* Now one that doesn't match */ + dns_test_namefromstring("1.2", &fname); + name = dns_fixedname_name(&fname); + result = dns_rbt_findname(ctx->rbt, name, + DNS_RBTFIND_EMPTYDATA, + foundname, (void *) &n); + ATF_CHECK_EQ(result, DNS_R_PARTIALMATCH); + ATF_CHECK(dns_name_equal(foundname, dns_rootname)); + + test_context_teardown(ctx); + + dns_test_end(); +} + +ATF_TC(rbt_addname); +ATF_TC_HEAD(rbt_addname, tc) { + atf_tc_set_md_var(tc, "descr", "addname return values"); +} +ATF_TC_BODY(rbt_addname, tc) { + isc_result_t result; + test_context_t *ctx = NULL; + dns_fixedname_t fname; + dns_name_t *name = NULL; + size_t *n; + + UNUSED(tc); + + isc_mem_debugging = ISC_MEM_DEBUGRECORD; + + result = dns_test_begin(NULL, ISC_TRUE); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + ctx = test_context_setup(); + + n = isc_mem_get(mctx, sizeof(size_t)); + *n = 1; + + dns_test_namefromstring("d.e.f.g.h.i.j.k", &fname); + name = dns_fixedname_name(&fname); + + /* Add a name that doesn't exist */ + result = dns_rbt_addname(ctx->rbt, name, n); + ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); + + /* Now add again, should get ISC_R_EXISTS */ + n = isc_mem_get(mctx, sizeof(size_t)); + *n = 2; + result = dns_rbt_addname(ctx->rbt, name, n); + ATF_REQUIRE_EQ(result, ISC_R_EXISTS); + isc_mem_put(mctx, n, sizeof(size_t)); + + test_context_teardown(ctx); + + dns_test_end(); +} + +ATF_TC(rbt_deletename); +ATF_TC_HEAD(rbt_deletename, tc) { + atf_tc_set_md_var(tc, "descr", "deletename return values"); +} +ATF_TC_BODY(rbt_deletename, tc) { + isc_result_t result; + test_context_t *ctx = NULL; + dns_fixedname_t fname; + dns_name_t *name = NULL; + + UNUSED(tc); + + isc_mem_debugging = ISC_MEM_DEBUGRECORD; + + result = dns_test_begin(NULL, ISC_TRUE); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + ctx = test_context_setup(); + + /* Delete a name that doesn't exist */ + dns_test_namefromstring("z.x.y.w", &fname); + name = dns_fixedname_name(&fname); + result = dns_rbt_deletename(ctx->rbt, name, ISC_FALSE); + ATF_REQUIRE_EQ(result, ISC_R_NOTFOUND); + + /* Now one that does */ + dns_test_namefromstring("d.e.f", &fname); + name = dns_fixedname_name(&fname); + result = dns_rbt_deletename(ctx->rbt, name, ISC_FALSE); + ATF_REQUIRE_EQ(result, ISC_R_NOTFOUND); + + test_context_teardown(ctx); + + dns_test_end(); +} + +ATF_TC(rbt_nodechain); +ATF_TC_HEAD(rbt_nodechain, tc) { + atf_tc_set_md_var(tc, "descr", "nodechain"); +} +ATF_TC_BODY(rbt_nodechain, tc) { + isc_result_t result; + test_context_t *ctx; + dns_fixedname_t fname, found, expect; + dns_name_t *name, *foundname, *expected; + dns_rbtnode_t *node = NULL; + dns_rbtnodechain_t chain; + + UNUSED(tc); + + isc_mem_debugging = ISC_MEM_DEBUGRECORD; + + result = dns_test_begin(NULL, ISC_TRUE); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + ctx = test_context_setup(); + + dns_rbtnodechain_init(&chain, mctx); + + dns_test_namefromstring("a", &fname); + name = dns_fixedname_name(&fname); + + result = dns_rbt_findnode(ctx->rbt, name, NULL, + &node, &chain, 0, NULL, NULL); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + dns_fixedname_init(&found); + foundname = dns_fixedname_name(&found); + + dns_test_namefromstring("a", &expect); + expected = dns_fixedname_name(&expect); + UNUSED(expected); + + result = dns_rbtnodechain_first(&chain, ctx->rbt, foundname, NULL); + ATF_CHECK_EQ(result, DNS_R_NEWORIGIN); + ATF_CHECK_EQ(dns_name_countlabels(foundname), 0); + + result = dns_rbtnodechain_prev(&chain, NULL, NULL); + ATF_CHECK_EQ(result, ISC_R_NOMORE); + + result = dns_rbtnodechain_next(&chain, NULL, NULL); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + result = dns_rbtnodechain_next(&chain, NULL, NULL); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + result = dns_rbtnodechain_last(&chain, ctx->rbt, NULL, NULL); + ATF_CHECK_EQ(result, DNS_R_NEWORIGIN); + + result = dns_rbtnodechain_next(&chain, NULL, NULL); + ATF_CHECK_EQ(result, ISC_R_NOMORE); + + result = dns_rbtnodechain_last(&chain, ctx->rbt, NULL, NULL); + ATF_CHECK_EQ(result, DNS_R_NEWORIGIN); + + result = dns_rbtnodechain_prev(&chain, NULL, NULL); + ATF_CHECK_EQ(result, ISC_R_SUCCESS); + + dns_rbtnodechain_invalidate(&chain); + + test_context_teardown(ctx); + + dns_test_end(); +} + #ifdef ISC_PLATFORM_USETHREADS #ifdef DNS_BENCHMARK_TESTS @@ -1156,7 +1340,7 @@ ATF_TC_BODY(benchmark, tc) { for (i = 0; i < 4000000; i++) { r = ((unsigned long) random()) % maxvalue; snprintf(namestr, sizeof(namestr), "name%u.example.org.", r); - build_name_from_str(namestr, &fnames[i]); + dns_test_namefromstring(namestr, &fnames[i]); names[i] = dns_fixedname_name(&fnames[i]); values[i] = r; } @@ -1223,6 +1407,10 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, rbt_insert); ATF_TP_ADD_TC(tp, rbt_remove); ATF_TP_ADD_TC(tp, rbt_insert_and_remove); + ATF_TP_ADD_TC(tp, rbt_findname); + ATF_TP_ADD_TC(tp, rbt_addname); + ATF_TP_ADD_TC(tp, rbt_deletename); + ATF_TP_ADD_TC(tp, rbt_nodechain); #ifdef ISC_PLATFORM_USETHREADS #ifdef DNS_BENCHMARK_TESTS ATF_TP_ADD_TC(tp, benchmark); diff --git a/util/copyrights b/util/copyrights index 13e622894a..ddb50aebf8 100644 --- a/util/copyrights +++ b/util/copyrights @@ -498,33 +498,6 @@ ./bin/tests/pkcs11/pkcs11-hmacmd5.c C 2014,2015,2016,2018 ./bin/tests/pkcs11/pkcs11-md5sum.c C 2014,2015,2016,2018 ./bin/tests/ratelimiter_test.c C 1999,2000,2001,2004,2007,2015,2016,2018 -./bin/tests/rbt/Makefile.in MAKE 1999,2000,2001,2002,2004,2007,2009,2012,2014,2016,2017,2018 -./bin/tests/rbt/dns_rbt.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbt_addname_1_data X 1999,2000,2001,2003,2018 -./bin/tests/rbt/dns_rbt_addname_2_data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbt_bitstring.data X 1999,2000,2001,2003,2018 -./bin/tests/rbt/dns_rbt_create_1_data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbt_deletename_1_data X 1999,2000,2001,2003,2018 -./bin/tests/rbt/dns_rbt_deletename_2_data X 1999,2000,2001,2003,2018 -./bin/tests/rbt/dns_rbt_findname_1_data X 1999,2000,2001,2003,2018 -./bin/tests/rbt/dns_rbt_findname_2_data X 1999,2000,2001,2003,2018 -./bin/tests/rbt/dns_rbt_findname_3_data X 1999,2000,2001,2003,2018 -./bin/tests/rbt/dns_rbtnodechain_first_1.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_first_2.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_first_data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_init.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_init_data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_last_1.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_last_2.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_last_data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_next.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_next_data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_prev.data X 1999,2000,2001,2018 -./bin/tests/rbt/dns_rbtnodechain_prev_data X 1999,2000,2001,2018 -./bin/tests/rbt/t_rbt.c C 1998,1999,2000,2001,2003,2004,2005,2007,2009,2011,2012,2013,2015,2016,2018 -./bin/tests/rbt/win32/t_rbt.vcxproj.filters.in X 2013,2015,2018 -./bin/tests/rbt/win32/t_rbt.vcxproj.in X 2013,2015,2016,2017,2018 -./bin/tests/rbt/win32/t_rbt.vcxproj.user X 2013,2018 ./bin/tests/rbt_test.c C 1999,2000,2001,2004,2005,2007,2009,2011,2012,2014,2015,2016,2018 ./bin/tests/rbt_test.out X 1999,2000,2001,2018 ./bin/tests/rbt_test.txt SH 1999,2000,2001,2004,2007,2012,2016,2018 diff --git a/win32utils/Configure b/win32utils/Configure index 4d2ed9d28a..37b7694137 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -122,8 +122,6 @@ my @projectlist = ("..\\bin\\check\\win32\\checkconf.vcxproj", "..\\bin\\tests\\dst\\win32\\t_dst.vcxproj.filters", "..\\bin\\tests\\names\\win32\\t_names.vcxproj", "..\\bin\\tests\\names\\win32\\t_names.vcxproj.filters", - "..\\bin\\tests\\rbt\\win32\\t_rbt.vcxproj", - "..\\bin\\tests\\rbt\\win32\\t_rbt.vcxproj.filters", "..\\bin\\tests\\system\\win32\\bigkey.vcxproj", "..\\bin\\tests\\system\\win32\\bigkey.vcxproj.filters", "..\\bin\\tests\\system\\win32\\feature-test.vcxproj", diff --git a/win32utils/bind9.sln.in b/win32utils/bind9.sln.in index 3dafcb57d1..acfac85395 100644 --- a/win32utils/bind9.sln.in +++ b/win32utils/bind9.sln.in @@ -524,14 +524,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t_names", "..\bin\tests\nam {F6F08940-7597-4FEE-9CE0-E09A009C45A3} = {F6F08940-7597-4FEE-9CE0-E09A009C45A3} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t_rbt", "..\bin\tests\rbt\win32\t_rbt.vcxproj", "{39F714D4-FEFB-4E23-91DB-1F6FC80A98B5}" - ProjectSection(ProjectDependencies) = postProject - {A3F71D12-F38A-4C77-8D87-8E8854CA74A1} = {A3F71D12-F38A-4C77-8D87-8E8854CA74A1} - {3840E563-D180-4761-AA9C-E6155F02EAFF} = {3840E563-D180-4761-AA9C-E6155F02EAFF} - {5FEBFD4E-CCB0-48B9-B733-E15EEB85C16A} = {5FEBFD4E-CCB0-48B9-B733-E15EEB85C16A} - {F6F08940-7597-4FEE-9CE0-E09A009C45A3} = {F6F08940-7597-4FEE-9CE0-E09A009C45A3} - EndProjectSection -EndProject @END TESTS @IF XTESTS Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "backtrace_test", "..\bin\tests\win32\backtrace_test.vcxproj", "{14751171-C40E-40EE-A2F0-37FFC3CCD4A2}"