From: Evan Hunt Date: Wed, 28 Feb 2018 22:12:02 +0000 (-0800) Subject: migrate t_rbt to lib/dns/tests/rbt_test X-Git-Tag: v9.10.8rc1~53^2~6 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=4c6818ff8e27dd071c7c5d55dff27ee534cee8a1;p=thirdparty%2Fbind9.git migrate t_rbt to lib/dns/tests/rbt_test (cherry picked from commit 109546cbda58c719e59c699e6ce14908279de776) (cherry picked from commit c505afd1835747997593a9ccb07786f20112238f) (cherry picked from commit 42fa3932abb4a902bbf25f994d12ad6678097ac5) --- diff --git a/bin/tests/.gitignore b/bin/tests/.gitignore index 38195bc6309..41f988c648a 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 lwtest diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index da3027deaea..32760aaf73c 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -40,8 +40,7 @@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ LIBS = @LIBS@ -SUBDIRS = db dst names rbt system \ - @PKCS11_TOOLS@ optional +SUBDIRS = db dst names system @PKCS11_TOOLS@ optional # Test programs that are built by default: # cfg_test is needed for regenerating doc/misc/options diff --git a/bin/tests/rbt/Makefile.in b/bin/tests/rbt/Makefile.in deleted file mode 100644 index eee16120ae1..00000000000 --- a/bin/tests/rbt/Makefile.in +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2004, 2007, 2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") -# Copyright (C) 1999-2002 Internet Software Consortium. -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.31 2009/12/05 23:31:40 each Exp $ - -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@ - -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 e58eb459115..00000000000 --- 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 89dca408eb8..00000000000 --- 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 762bd8bc53a..00000000000 --- 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 2b34cc63288..00000000000 --- 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 72f8dc4b5c6..00000000000 --- 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 2e00e502ab4..00000000000 --- 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 0b1fdb7b6cc..00000000000 --- 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 2a3728dd080..00000000000 --- 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 eb3d467b300..00000000000 --- 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 4ea2db301af..00000000000 --- 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 85bd8c2e18a..00000000000 --- 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 268376b93c6..00000000000 --- 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 057a1d66b5f..00000000000 --- 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 1e0bfc9c0af..00000000000 --- 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 f1a6aa40320..00000000000 --- 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 1e0bfc9c0af..00000000000 --- 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 4d0c76d0fe3..00000000000 --- 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 bf06a216bac..00000000000 --- 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 1e0bfc9c0af..00000000000 --- 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 a69ab37a5ff..00000000000 --- 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 1e0bfc9c0af..00000000000 --- 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 4c8450dc677..00000000000 --- 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 420d933f0c3..00000000000 --- a/bin/tests/rbt/t_rbt.c +++ /dev/null @@ -1,1874 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2007, 2009, 2011-2013, 2015, 2018 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1998-2001, 2003 Internet Software Consortium. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $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.dsp.in b/bin/tests/rbt/win32/t_rbt.dsp.in deleted file mode 100644 index 4d25a4260ca..00000000000 --- a/bin/tests/rbt/win32/t_rbt.dsp.in +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="t_rbt" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "@PLATFORM@ (x86) Console Application" 0x0103 - -CFG=t_rbt - @PLATFORM@ Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "t_rbt.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "t_rbt.mak" CFG="t_rbt - @PLATFORM@ Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "t_rbt - @PLATFORM@ Release" (based on "@PLATFORM@ (x86) Console Application") -!MESSAGE "t_rbt - @PLATFORM@ Debug" (based on "@PLATFORM@ (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 @COPTX@ @COPTI@ /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" @COPTY@ /FD /c -# ADD CPP /nologo /MD /W3 @COPTX@ @COPTI@ /O2 /I "./" /I "../../../../" @LIBXML2_INC@ /I "../../../../lib/isc/win32" /I "../../../../lib/isc/win32/include" /I "../../../../lib/isc/include" /I "../../../../lib/dns/win32/include" /I "../../../../lib/dns/include" /I "../../../../lib/tests/include" /D "WIN32" /D "NDEBUG" /D "__STDC__" /D "_CONSOLE" /D "_MBCS" @COPTY@ /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console @MACHINE@ -# ADD LINK32 @LIBXML2_LIB@ user32.lib advapi32.lib kernel32.lib ws2_32.lib ../../../../lib/isc/win32/Release/libisc.lib ../../../../lib/dns/win32/Release/libdns.lib ../../../../lib/tests/win32/Release/libtests.lib /nologo /subsystem:console @MACHINE@ /out:"../../../../Build/Release/t_rbt.exe" - -!ELSEIF "$(CFG)" == "t_rbt - @PLATFORM@ Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm @COPTX@ @COPTI@ /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" @COPTY@ /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm @COPTX@ @COPTI@ /ZI /Od /I "./" /I "../../../../" @LIBXML2_INC@ /I "../../../../lib/isc/win32" /I "../../../../lib/isc/win32/include" /I "../../../../lib/isc/include" /I "../../../../lib/dns/win32/include" /I "../../../../lib/dns/include" /I "../../../../lib/tests/include" /I "../../../../lib/bind9/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "i386" /FR /FD /GZ /c -# SUBTRACT CPP /X @COPTY@ -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug @MACHINE@ /pdbtype:sept -# ADD LINK32 @LIBXML2_LIB@ user32.lib advapi32.lib kernel32.lib ws2_32.lib ../../../../lib/isc/win32/Debug/libisc.lib ../../../../lib/dns/win32/Debug/libdns.lib ../../../../lib/tests/win32/Debug/libtests.lib /nologo /subsystem:console /map /debug @MACHINE@ /out:"../../../../Build/Debug/t_rbt.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "t_rbt - @PLATFORM@ Release" -# Name "t_rbt - @PLATFORM@ Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\t_rbt.c -# End Source File -# End Group -# End Target -# End Project diff --git a/bin/tests/rbt/win32/t_rbt.dsw b/bin/tests/rbt/win32/t_rbt.dsw deleted file mode 100644 index 9d658b29301..00000000000 --- a/bin/tests/rbt/win32/t_rbt.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "t_rbt"=".\t_rbt.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/bin/tests/rbt/win32/t_rbt.mak.in b/bin/tests/rbt/win32/t_rbt.mak.in deleted file mode 100644 index 5f61e019306..00000000000 --- a/bin/tests/rbt/win32/t_rbt.mak.in +++ /dev/null @@ -1,375 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on t_rbt.dsp -!IF "$(CFG)" == "" -CFG=t_rbt - @PLATFORM@ Debug -!MESSAGE No configuration specified. Defaulting to t_rbt - @PLATFORM@ Debug. -!ENDIF - -!IF "$(CFG)" != "t_rbt - @PLATFORM@ Release" && "$(CFG)" != "t_rbt - @PLATFORM@ Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "t_rbt.mak" CFG="t_rbt - @PLATFORM@ Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "t_rbt - @PLATFORM@ Release" (based on "@PLATFORM@ (x86) Console Application") -!MESSAGE "t_rbt - @PLATFORM@ Debug" (based on "@PLATFORM@ (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -CPP=cl.exe -RSC=rc.exe -LIBXML=@LIBXML2_LIB@ - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" -_VC_MANIFEST_INC=0 -_VC_MANIFEST_BASENAME=__VC80 -!ELSE -_VC_MANIFEST_INC=1 -_VC_MANIFEST_BASENAME=__VC80.Debug -!ENDIF - -#################################################### -# Specifying name of temporary resource file used only in incremental builds: - -!if "$(_VC_MANIFEST_INC)" == "1" -_VC_MANIFEST_AUTO_RES=$(_VC_MANIFEST_BASENAME).auto.res -!else -_VC_MANIFEST_AUTO_RES= -!endif - -#################################################### -# _VC_MANIFEST_EMBED_EXE - command to embed manifest in EXE: - -!if "$(_VC_MANIFEST_INC)" == "1" - -#MT_SPECIAL_RETURN=1090650113 -#MT_SPECIAL_SWITCH=-notify_resource_update -MT_SPECIAL_RETURN=0 -MT_SPECIAL_SWITCH= -_VC_MANIFEST_EMBED_EXE= \ -if exist $@.manifest mt.exe -manifest $@.manifest -out:$(_VC_MANIFEST_BASENAME).auto.manifest $(MT_SPECIAL_SWITCH) & \ -if "%ERRORLEVEL%" == "$(MT_SPECIAL_RETURN)" \ -rc /r $(_VC_MANIFEST_BASENAME).auto.rc & \ -link $** /out:$@ $(LFLAGS) - -!else - -_VC_MANIFEST_EMBED_EXE= \ -if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$@;1 - -!endif - -#################################################### -# _VC_MANIFEST_EMBED_DLL - command to embed manifest in DLL: - -!if "$(_VC_MANIFEST_INC)" == "1" - -#MT_SPECIAL_RETURN=1090650113 -#MT_SPECIAL_SWITCH=-notify_resource_update -MT_SPECIAL_RETURN=0 -MT_SPECIAL_SWITCH= -_VC_MANIFEST_EMBED_EXE= \ -if exist $@.manifest mt.exe -manifest $@.manifest -out:$(_VC_MANIFEST_BASENAME).auto.manifest $(MT_SPECIAL_SWITCH) & \ -if "%ERRORLEVEL%" == "$(MT_SPECIAL_RETURN)" \ -rc /r $(_VC_MANIFEST_BASENAME).auto.rc & \ -link $** /out:$@ $(LFLAGS) - -!else - -_VC_MANIFEST_EMBED_EXE= \ -if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$@;2 - -!endif -#################################################### -# _VC_MANIFEST_CLEAN - command to clean resources files generated temporarily: - -!if "$(_VC_MANIFEST_INC)" == "1" - -_VC_MANIFEST_CLEAN=-del $(_VC_MANIFEST_BASENAME).auto.res \ - $(_VC_MANIFEST_BASENAME).auto.rc \ - $(_VC_MANIFEST_BASENAME).auto.manifest - -!else - -_VC_MANIFEST_CLEAN= - -!endif - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" - -OUTDIR=.\Release -INTDIR=.\Release - -!IF "$(RECURSE)" == "0" - -ALL : "..\..\..\..\Build\Release\t_rbt.exe" - -!ELSE - -ALL : "libtests - @PLATFORM@ Release" "libisc - @PLATFORM@ Release" "libdns - @PLATFORM@ Release" "..\..\..\..\Build\Release\t_rbt.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libdns - @PLATFORM@ ReleaseCLEAN" "libisc - @PLATFORM@ ReleaseCLEAN" "libtests - @PLATFORM@ ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\t_rbt.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "..\..\..\..\Build\Release\t_rbt.exe" - -@$(_VC_MANIFEST_CLEAN) - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MD /W3 @COPTX@ @COPTI@ /O2 /I "./" /I "../../../../" @LIBXML2_INC@ /I "../../../../lib/isc/win32" /I "../../../../lib/isc/win32/include" /I "../../../../lib/isc/include" /I "../../../../lib/dns/win32/include" /I "../../../../lib/dns/include" /I "../../../../lib/tests/include" /D "WIN32" /D "NDEBUG" /D "__STDC__" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\t_rbt.pch" @COPTY@ /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\t_rbt.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=user32.lib advapi32.lib kernel32.lib ws2_32.lib ../../../../lib/isc/win32/Release/libisc.lib ../../../../lib/dns/win32/Release/libdns.lib ../../../../lib/tests/win32/Release/libtests.lib $(LIBXML) /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\t_rbt.pdb" @MACHINE@ /out:"../../../../Build/Release/t_rbt.exe" -LINK32_OBJS= \ - "$(INTDIR)\t_rbt.obj" \ - "..\..\..\..\lib\dns\win32\Release\libdns.lib" \ - "..\..\..\..\lib\isc\win32\Release\libisc.lib" \ - "..\..\..\..\lib\tests\win32\Release\libtests.lib" - -"..\..\..\..\Build\Release\t_rbt.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - $(_VC_MANIFEST_EMBED_EXE) - -!ELSEIF "$(CFG)" == "t_rbt - @PLATFORM@ Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\..\..\..\Build\Debug\t_rbt.exe" "$(OUTDIR)\t_rbt.bsc" - -!ELSE - -ALL : "libtests - @PLATFORM@ Debug" "libisc - @PLATFORM@ Debug" "libdns - @PLATFORM@ Debug" "..\..\..\..\Build\Debug\t_rbt.exe" "$(OUTDIR)\t_rbt.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libdns - @PLATFORM@ DebugCLEAN" "libisc - @PLATFORM@ DebugCLEAN" "libtests - @PLATFORM@ DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\t_rbt.obj" - -@erase "$(INTDIR)\t_rbt.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\t_rbt.bsc" - -@erase "$(OUTDIR)\t_rbt.map" - -@erase "$(OUTDIR)\t_rbt.pdb" - -@erase "..\..\..\..\Build\Debug\t_rbt.exe" - -@erase "..\..\..\..\Build\Debug\t_rbt.ilk" - -@$(_VC_MANIFEST_CLEAN) - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MDd /W3 /Gm @COPTX@ @COPTI@ /ZI /Od /I "./" /I "../../../../" @LIBXML2_INC@ /I "../../../../lib/isc/win32" /I "../../../../lib/isc/win32/include" /I "../../../../lib/isc/include" /I "../../../../lib/dns/win32/include" /I "../../../../lib/dns/include" /I "../../../../lib/tests/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "i386" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\t_rbt.bsc" -BSC32_SBRS= \ - "$(INTDIR)\t_rbt.sbr" - -"$(OUTDIR)\t_rbt.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=user32.lib advapi32.lib kernel32.lib ws2_32.lib ../../../../lib/isc/win32/Debug/libisc.lib ../../../../lib/dns/win32/Debug/libdns.lib ../../../../lib/tests/win32/Debug/libtests.lib $(LIBXML) /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\t_rbt.pdb" /map:"$(INTDIR)\t_rbt.map" /debug @MACHINE@ /out:"../../../../Build/Debug/t_rbt.exe" /pdbtype:sept -LINK32_OBJS= \ - "$(INTDIR)\t_rbt.obj" \ - "..\..\..\..\lib\dns\win32\Debug\libdns.lib" \ - "..\..\..\..\lib\isc\win32\Debug\libisc.lib" \ - "..\..\..\..\lib\tests\win32\Debug\libtests.lib" - -"..\..\..\..\Build\Debug\t_rbt.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - $(_VC_MANIFEST_EMBED_EXE) - -!ENDIF - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("t_rbt.dep") -!INCLUDE "t_rbt.dep" -!ELSE -!MESSAGE Warning: cannot find "t_rbt.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" || "$(CFG)" == "t_rbt - @PLATFORM@ Debug" -SOURCE=..\t_rbt.c - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" - - -"$(INTDIR)\t_rbt.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "t_rbt - @PLATFORM@ Debug" - - -"$(INTDIR)\t_rbt.obj" "$(INTDIR)\t_rbt.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" - -"libdns - @PLATFORM@ Release" : - cd "..\..\..\..\lib\dns\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libdns.mak" CFG="libdns - @PLATFORM@ Release" - cd "..\..\..\bin\tests\rbt\win32" - -"libdns - @PLATFORM@ ReleaseCLEAN" : - cd "..\..\..\..\lib\dns\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libdns.mak" CFG="libdns - @PLATFORM@ Release" RECURSE=1 CLEAN - cd "..\..\..\bin\tests\rbt\win32" - -!ELSEIF "$(CFG)" == "t_rbt - @PLATFORM@ Debug" - -"libdns - @PLATFORM@ Debug" : - cd "..\..\..\..\lib\dns\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libdns.mak" CFG="libdns - @PLATFORM@ Debug" - cd "..\..\..\bin\tests\rbt\win32" - -"libdns - @PLATFORM@ DebugCLEAN" : - cd "..\..\..\..\lib\dns\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libdns.mak" CFG="libdns - @PLATFORM@ Debug" RECURSE=1 CLEAN - cd "..\..\..\bin\tests\rbt\win32" - -!ENDIF - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" - -"libisc - @PLATFORM@ Release" : - cd "..\..\..\..\lib\isc\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libisc.mak" CFG="libisc - @PLATFORM@ Release" - cd "..\..\..\bin\tests\rbt\win32" - -"libisc - @PLATFORM@ ReleaseCLEAN" : - cd "..\..\..\..\lib\isc\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libisc.mak" CFG="libisc - @PLATFORM@ Release" RECURSE=1 CLEAN - cd "..\..\..\bin\tests\rbt\win32" - -!ELSEIF "$(CFG)" == "t_rbt - @PLATFORM@ Debug" - -"libisc - @PLATFORM@ Debug" : - cd "..\..\..\..\lib\isc\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libisc.mak" CFG="libisc - @PLATFORM@ Debug" - cd "..\..\..\bin\tests\rbt\win32" - -"libisc - @PLATFORM@ DebugCLEAN" : - cd "..\..\..\..\lib\isc\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libisc.mak" CFG="libisc - @PLATFORM@ Debug" RECURSE=1 CLEAN - cd "..\..\..\bin\tests\rbt\win32" - -!ENDIF - -!IF "$(CFG)" == "t_rbt - @PLATFORM@ Release" - -"libtests - @PLATFORM@ Release" : - cd "..\..\..\..\lib\tests\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libtests.mak" CFG="libtests - @PLATFORM@ Release" - cd "..\..\..\bin\tests\rbt\win32" - -"libtests - @PLATFORM@ ReleaseCLEAN" : - cd "..\..\..\..\lib\tests\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libtests.mak" CFG="libtests - @PLATFORM@ Release" RECURSE=1 CLEAN - cd "..\..\..\bin\tests\rbt\win32" - -!ELSEIF "$(CFG)" == "t_rbt - @PLATFORM@ Debug" - -"libtests - @PLATFORM@ Debug" : - cd "..\..\..\..\lib\tests\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libtests.mak" CFG="libtests - @PLATFORM@ Debug" - cd "..\..\..\bin\tests\rbt\win32" - -"libtests - @PLATFORM@ DebugCLEAN" : - cd "..\..\..\..\lib\tests\win32" - $(MAKE) /$(MAKEFLAGS) /F ".\libtests.mak" CFG="libtests - @PLATFORM@ Debug" RECURSE=1 CLEAN - cd "..\..\..\bin\tests\rbt\win32" - -!ENDIF - - -!ENDIF - -#################################################### -# Commands to generate initial empty manifest file and the RC file -# that references it, and for generating the .res file: - -$(_VC_MANIFEST_BASENAME).auto.res : $(_VC_MANIFEST_BASENAME).auto.rc - -$(_VC_MANIFEST_BASENAME).auto.rc : $(_VC_MANIFEST_BASENAME).auto.manifest - type <<$@ -#include -1RT_MANIFEST"$(_VC_MANIFEST_BASENAME).auto.manifest" -<< KEEP - -$(_VC_MANIFEST_BASENAME).auto.manifest : - type <<$@ - - - -<< KEEP 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 d85dd49f074..00000000000 --- 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 cd4034d6a7c..00000000000 --- 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 695b5c78b91..00000000000 --- 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 18b82c2e8b2..da007edc0d4 100755 --- a/configure +++ b/configure @@ -23000,7 +23000,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/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/keyzone.py bin/python/isc/tests/dnskey_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/dlzredir/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/inline/checkdsa.sh bin/tests/system/lwresd/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/cookie/prereq.sh 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/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/tests/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/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/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/keyzone.py bin/python/isc/tests/dnskey_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/dlzredir/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/inline/checkdsa.sh bin/tests/system/lwresd/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/cookie/prereq.sh 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/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/tests/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/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" # @@ -24047,7 +24047,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 c2b6a91ebc2..37535db7239 100644 --- a/configure.in +++ b/configure.in @@ -5173,7 +5173,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 9aab2d1246d..ebd30f4354b 100644 --- a/lib/dns/tests/dnstest.c +++ b/lib/dns/tests/dnstest.c @@ -14,8 +14,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ #include @@ -408,3 +406,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 42d572a75de..95717c91792 100644 --- a/lib/dns/tests/dnstest.h +++ b/lib/dns/tests/dnstest.h @@ -91,3 +91,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 90e59a99629..9f6987fece6 100644 --- a/lib/dns/tests/rbt_test.c +++ b/lib/dns/tests/rbt_test.c @@ -14,8 +14,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbt_test.c,v 1.1.14.8 2012/02/10 16:24:37 ckb Exp $ */ - /* ! \file */ #include @@ -32,6 +30,7 @@ #include #include +#include #include #include #include "dnstest.h" @@ -141,28 +140,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; @@ -185,7 +162,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); @@ -229,7 +206,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; @@ -315,7 +292,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); @@ -402,7 +379,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); @@ -476,7 +453,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); @@ -505,7 +482,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)); @@ -744,7 +721,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; @@ -769,7 +746,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); @@ -792,7 +769,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, @@ -801,7 +778,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, @@ -815,7 +792,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, @@ -834,9 +811,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)) { @@ -927,7 +904,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; @@ -961,7 +938,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); @@ -1086,6 +1063,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 @@ -1161,7 +1345,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; } @@ -1228,6 +1412,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 3e0fd3facd0..b0fbf0181a8 100644 --- a/util/copyrights +++ b/util/copyrights @@ -600,36 +600,6 @@ ./bin/tests/pkcs11/pkcs11-hmacmd5.c C 2014,2015 ./bin/tests/pkcs11/pkcs11-md5sum.c C 2014,2015 ./bin/tests/ratelimiter_test.c C 1999,2000,2001,2004,2007,2015 -./bin/tests/rbt/Makefile.in MAKE 1999,2000,2001,2002,2004,2007,2009,2012,2014 -./bin/tests/rbt/dns_rbt.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbt_addname_1_data X 1999,2000,2001,2003 -./bin/tests/rbt/dns_rbt_addname_2_data X 1999,2000,2001 -./bin/tests/rbt/dns_rbt_bitstring.data X 1999,2000,2001,2003 -./bin/tests/rbt/dns_rbt_create_1_data X 1999,2000,2001 -./bin/tests/rbt/dns_rbt_deletename_1_data X 1999,2000,2001,2003 -./bin/tests/rbt/dns_rbt_deletename_2_data X 1999,2000,2001,2003 -./bin/tests/rbt/dns_rbt_findname_1_data X 1999,2000,2001,2003 -./bin/tests/rbt/dns_rbt_findname_2_data X 1999,2000,2001,2003 -./bin/tests/rbt/dns_rbt_findname_3_data X 1999,2000,2001,2003 -./bin/tests/rbt/dns_rbtnodechain_first_1.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_first_2.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_first_data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_init.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_init_data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_last_1.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_last_2.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_last_data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_next.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_next_data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_prev.data X 1999,2000,2001 -./bin/tests/rbt/dns_rbtnodechain_prev_data X 1999,2000,2001 -./bin/tests/rbt/t_rbt.c C 1998,1999,2000,2001,2003,2004,2005,2007,2009,2011,2012,2013,2015,2018 -./bin/tests/rbt/win32/t_rbt.dsp.in X 2013 -./bin/tests/rbt/win32/t_rbt.dsw X 2013 -./bin/tests/rbt/win32/t_rbt.mak.in X 2013 -./bin/tests/rbt/win32/t_rbt.vcxproj.filters.in X 2013,2015 -./bin/tests/rbt/win32/t_rbt.vcxproj.in X 2013,2015,2016,2017 -./bin/tests/rbt/win32/t_rbt.vcxproj.user X 2013 ./bin/tests/rbt_test.c C 1999,2000,2001,2004,2005,2007,2009,2011,2012,2014,2015,2018 ./bin/tests/rbt_test.out X 1999,2000,2001 ./bin/tests/rbt_test.txt SH 1999,2000,2001,2004,2007,2012 diff --git a/win32utils/Configure b/win32utils/Configure index 8cfd7dca24e..a1f7acde0cd 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -284,8 +284,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 26166fa00e8..a7e5287542f 100644 --- a/win32utils/bind9.sln.in +++ b/win32utils/bind9.sln.in @@ -522,14 +522,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}"