]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
migrate t_rbt to lib/dns/tests/rbt_test
authorEvan Hunt <each@isc.org>
Wed, 28 Feb 2018 22:12:02 +0000 (14:12 -0800)
committerEvan Hunt <each@isc.org>
Sat, 10 Mar 2018 07:17:36 +0000 (23:17 -0800)
(cherry picked from commit 109546cbda58c719e59c699e6ce14908279de776)
(cherry picked from commit c505afd1835747997593a9ccb07786f20112238f)
(cherry picked from commit 42fa3932abb4a902bbf25f994d12ad6678097ac5)
(cherry picked from commit 4c6818ff8e27dd071c7c5d55dff27ee534cee8a1)

41 files changed:
bin/tests/.gitignore
bin/tests/Makefile.in
bin/tests/rbt/Makefile.in [deleted file]
bin/tests/rbt/dns_rbt.data [deleted file]
bin/tests/rbt/dns_rbt_addname_1_data [deleted file]
bin/tests/rbt/dns_rbt_addname_2_data [deleted file]
bin/tests/rbt/dns_rbt_bitstring.data [deleted file]
bin/tests/rbt/dns_rbt_create_1_data [deleted file]
bin/tests/rbt/dns_rbt_deletename_1_data [deleted file]
bin/tests/rbt/dns_rbt_deletename_2_data [deleted file]
bin/tests/rbt/dns_rbt_findname_1_data [deleted file]
bin/tests/rbt/dns_rbt_findname_2_data [deleted file]
bin/tests/rbt/dns_rbt_findname_3_data [deleted file]
bin/tests/rbt/dns_rbtnodechain_first_1.data [deleted file]
bin/tests/rbt/dns_rbtnodechain_first_2.data [deleted file]
bin/tests/rbt/dns_rbtnodechain_first_data [deleted file]
bin/tests/rbt/dns_rbtnodechain_init.data [deleted file]
bin/tests/rbt/dns_rbtnodechain_init_data [deleted file]
bin/tests/rbt/dns_rbtnodechain_last_1.data [deleted file]
bin/tests/rbt/dns_rbtnodechain_last_2.data [deleted file]
bin/tests/rbt/dns_rbtnodechain_last_data [deleted file]
bin/tests/rbt/dns_rbtnodechain_next.data [deleted file]
bin/tests/rbt/dns_rbtnodechain_next_data [deleted file]
bin/tests/rbt/dns_rbtnodechain_prev.data [deleted file]
bin/tests/rbt/dns_rbtnodechain_prev_data [deleted file]
bin/tests/rbt/t_rbt.c [deleted file]
bin/tests/rbt/win32/t_rbt.dsp.in [deleted file]
bin/tests/rbt/win32/t_rbt.dsw [deleted file]
bin/tests/rbt/win32/t_rbt.mak.in [deleted file]
bin/tests/rbt/win32/t_rbt.vcxproj.filters.in [deleted file]
bin/tests/rbt/win32/t_rbt.vcxproj.in [deleted file]
bin/tests/rbt/win32/t_rbt.vcxproj.user [deleted file]
configure
configure.in
lib/dns/tests/Makefile.in
lib/dns/tests/dnstest.c
lib/dns/tests/dnstest.h
lib/dns/tests/rbt_test.c [new file with mode: 0644]
util/copyrights
win32utils/Configure
win32utils/bind9.sln.in

index e820d6d6f63443468d81b8e536349ab4e74b1043..994ae2c29a8df147d63cd21b12af869f628cfee1 100644 (file)
@@ -8,7 +8,6 @@ t_db
 gsstest
 t_dst
 t_names
-t_rbt
 conf.sh
 dlopen
 lwtest
index c9694059872034551a0b1409d817920bede725da..c5d8a8ec237cd68b7c060b8a6084229a7634be6c 100644 (file)
@@ -40,7 +40,7 @@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
 
 LIBS =         @LIBS@
 
-SUBDIRS =      db dst names rbt system optional
+SUBDIRS =      db dst names system 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 (file)
index f421c8d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (C) 2004, 2007, 2009, 2012  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 (file)
index e58eb45..0000000
+++ /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 (file)
index 89dca40..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbt_addname assertion 1
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index 762bd8b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbt_addname assertion 2
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index 2b34cc6..0000000
+++ /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 (file)
index 72f8dc4..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# test data for dns_rbt_create assertion 1
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index 2e00e50..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbt_delete assertion 1
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index 0b1fdb7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbt_delete assertion 2
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index 2a3728d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbt_findname assertion 1
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index eb3d467..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbt_findname assertion 2
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index 4ea2db3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbt_findname assertion 3
-#
-# format is: <dbfile> <command> <testname> <exp_result>
-#
-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 (file)
index 85bd8c2..0000000
+++ /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 (file)
index 268376b..0000000
+++ /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 (file)
index 057a1d6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# test data for dns_rbtnodechain_first
-#
-# format is: <dbfile> <firstname> <firstorigin> <nextname> <nextorigin>
-#
-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 (file)
index 1e0bfc9..0000000
+++ /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 (file)
index f1a6aa4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbtnodechain_init
-#
-# format is: <dbfile> <findnode> <next> <nextorigin> <prev> <prevorigin>  <first> <firstorigin> <last> <lastorigin>
-#
-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 (file)
index 1e0bfc9..0000000
+++ /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 (file)
index 4d0c76d..0000000
+++ /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 (file)
index bf06a21..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# test data for dns_rbtnodechain_last
-#
-# format is: <dbfile> <last> <lastorigin> <prev> <prevorigin>
-#
-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 (file)
index 1e0bfc9..0000000
+++ /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 (file)
index a69ab37..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbtnodechain_next
-#
-# format is: <dbfile> <startname> <expected_name> <expected_origin>
-#
-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 (file)
index 1e0bfc9..0000000
+++ /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 (file)
index 4c8450d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# test data for dns_rbtnodechain_prev
-#
-# format is: <dbfile> <startname> <expected_name> <expected_origin>
-#
-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 (file)
index 420d933..0000000
+++ /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 <config.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-
-#include <isc/entropy.h>
-#include <isc/mem.h>
-#include <isc/util.h>
-#include <isc/hash.h>
-#include <isc/string.h>
-
-#include <dns/fixedname.h>
-#include <dns/rbt.h>
-#include <dns/result.h>
-
-#include <tests/t_api.h>
-
-#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 (file)
index 4d25a42..0000000
+++ /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 (file)
index 9d658b2..0000000
+++ /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 (file)
index 5f61e01..0000000
+++ /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 <winuser.h>
-1RT_MANIFEST"$(_VC_MANIFEST_BASENAME).auto.manifest"
-<< KEEP
-
-$(_VC_MANIFEST_BASENAME).auto.manifest :
-    type <<$@
-<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
-<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
-</assembly>
-<< 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 (file)
index d85dd49..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="..\t_rbt.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
\ 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 (file)
index cd4034d..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|@PLATFORM@">
-      <Configuration>Debug</Configuration>
-      <Platform>@PLATFORM@</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|@PLATFORM@">
-      <Configuration>Release</Configuration>
-      <Platform>@PLATFORM@</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{39F714D4-FEFB-4E23-91DB-1F6FC80A98B5}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
-    <RootNamespace>t_rbt</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
-    <LinkIncremental>true</LinkIncremental>
-    <OutDir>..\..\..\..\Build\$(Configuration)\</OutDir>
-    <IntDir>.\$(Configuration)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
-    <LinkIncremental>false</LinkIncremental>
-    <OutDir>..\..\..\..\Build\$(Configuration)\</OutDir>
-    <IntDir>.\$(Configuration)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
-    <ClCompile>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation>
-      <ObjectFileName>.\$(Configuration)\</ObjectFileName>
-      <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <AdditionalIncludeDirectories>.\;..\..\..\..\;@LIBXML2_INC@..\..\..\..\lib\isc\win32;..\..\..\..\lib\isc\win32\include;..\..\..\..\lib\isc\include;..\..\..\..\lib\dns\include;..\..\..\..\lib\tests\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <CompileAs>CompileAsC</CompileAs>
-    </ClCompile>
-    <Link>
-      <SubSystem>Console</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <OutputFile>..\..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
-      <AdditionalLibraryDirectories>..\..\..\..\lib\isc\win32\$(Configuration);..\..\..\..\lib\dns\win32\$(Configuration);..\..\..\..\lib\tests\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>@LIBXML2_LIB@libisc.lib;libdns.lib;libtests.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>@INTRINSIC@</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <WholeProgramOptimization>false</WholeProgramOptimization>
-      <StringPooling>true</StringPooling>
-      <PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation>
-      <ObjectFileName>.\$(Configuration)\</ObjectFileName>
-      <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
-      <AdditionalIncludeDirectories>.\;..\..\..\..\;@LIBXML2_INC@..\..\..\..\lib\isc\win32;..\..\..\..\lib\isc\win32\include;..\..\..\..\lib\isc\include;..\..\..\..\lib\dns\include;..\..\..\..\lib\tests\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <CompileAs>CompileAsC</CompileAs>
-    </ClCompile>
-    <Link>
-      <SubSystem>Console</SubSystem>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <OutputFile>..\..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
-      <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
-      <AdditionalLibraryDirectories>..\..\..\..\lib\isc\win32\$(Configuration);..\..\..\..\lib\dns\win32\$(Configuration);..\..\..\..\lib\tests\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>@LIBXML2_LIB@libisc.lib;libdns.lib;libtests.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="..\t_rbt.c" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
diff --git a/bin/tests/rbt/win32/t_rbt.vcxproj.user b/bin/tests/rbt/win32/t_rbt.vcxproj.user
deleted file mode 100644 (file)
index 695b5c7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-</Project>
\ No newline at end of file
index fd764a79d7a2bce9d0e7bb04c32e0451a834024d..3ddf1c229ef7d9d4c3ab5d6c7c6cd2c1176bcbcc 100755 (executable)
--- a/configure
+++ b/configure
@@ -21623,7 +21623,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/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/rbt/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/inline/checkdsa.sh bin/tests/system/lwresd/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/check-secure-delegation.pl contrib/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/export/Makefile lib/export/dns/Makefile lib/export/dns/include/Makefile lib/export/dns/include/dns/Makefile lib/export/dns/include/dst/Makefile lib/export/irs/Makefile lib/export/irs/include/Makefile lib/export/irs/include/irs/Makefile lib/export/isc/$thread_dir/Makefile lib/export/isc/$thread_dir/include/Makefile lib/export/isc/$thread_dir/include/isc/Makefile lib/export/isc/Makefile lib/export/isc/include/Makefile lib/export/isc/include/isc/Makefile lib/export/isc/nls/Makefile lib/export/isc/unix/Makefile lib/export/isc/unix/include/Makefile lib/export/isc/unix/include/isc/Makefile lib/export/isccfg/Makefile lib/export/isccfg/include/Makefile lib/export/isccfg/include/isccfg/Makefile lib/export/samples/Makefile lib/export/samples/Makefile-postinstall 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/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/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 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/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/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/inline/checkdsa.sh bin/tests/system/lwresd/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/check-secure-delegation.pl contrib/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/export/Makefile lib/export/dns/Makefile lib/export/dns/include/Makefile lib/export/dns/include/dns/Makefile lib/export/dns/include/dst/Makefile lib/export/irs/Makefile lib/export/irs/include/Makefile lib/export/irs/include/irs/Makefile lib/export/isc/$thread_dir/Makefile lib/export/isc/$thread_dir/include/Makefile lib/export/isc/$thread_dir/include/isc/Makefile lib/export/isc/Makefile lib/export/isc/include/Makefile lib/export/isc/include/isc/Makefile lib/export/isc/nls/Makefile lib/export/isc/unix/Makefile lib/export/isc/unix/include/Makefile lib/export/isc/unix/include/isc/Makefile lib/export/isccfg/Makefile lib/export/isccfg/include/Makefile lib/export/isccfg/include/isccfg/Makefile lib/export/samples/Makefile lib/export/samples/Makefile-postinstall 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/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/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 unit/Makefile unit/unittest.sh"
 
 
 #
@@ -22667,7 +22667,6 @@ do
     "bin/tests/headerdep_test.sh") CONFIG_FILES="$CONFIG_FILES bin/tests/headerdep_test.sh" ;;
     "bin/tests/names/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/names/Makefile" ;;
     "bin/tests/optional/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/optional/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" ;;
index 07fb3a47493eaac734ddbdc357f51ea61adf9830..94c8c202934240d1199adb6d409894aa7cf56173 100644 (file)
@@ -4350,7 +4350,6 @@ AC_CONFIG_FILES([
        bin/tests/headerdep_test.sh
        bin/tests/names/Makefile
        bin/tests/optional/Makefile
-       bin/tests/rbt/Makefile
        bin/tests/system/Makefile
        bin/tests/system/conf.sh
        bin/tests/system/dlz/prereq.sh
index 67d87b8c302827de3b3245289c2420b1b50a183f..63ba8220e95f8d5c7619a46c443043c5d2558053 100644 (file)
@@ -46,6 +46,7 @@ SRCS =                acl_test.c \
                name_test.c \
                nsec3_test.c \
                private_test.c \
+               rbt_test.c \
                rdata_test.c \
                rdataset_test.c \
                resolver_test.c \
@@ -67,6 +68,7 @@ TARGETS =     acl_test@EXEEXT@ \
                name_test@EXEEXT@ \
                nsec3_test@EXEEXT@ \
                private_test@EXEEXT@ \
+               rbt_test@EXEEXT@ \
                rdata_test@EXEEXT@ \
                rdataset_test@EXEEXT@ \
                resolver_test@EXEEXT@ \
@@ -146,6 +148,11 @@ nsec3_test@EXEEXT@: nsec3_test.@O@ dnstest.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
                        nsec3_test.@O@ dnstest.@O@ ${DNSLIBS} \
                                ${ISCLIBS} ${LIBS}
 
+rbt_test@EXEEXT@: rbt_test.@O@ dnstest.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
+       ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+                       rbt_test.@O@ dnstest.@O@ ${DNSLIBS} \
+                               ${ISCLIBS} ${LIBS}
+
 rdataset_test@EXEEXT@: rdataset_test.@O@ dnstest.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
        ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
                        rdataset_test.@O@ dnstest.@O@ ${DNSLIBS} \
index 9aab2d1246d87491ae494124cd1e262d2b6ab61e..ebd30f4354b941dead7f304e9b346a02f7f3a869 100644 (file)
@@ -14,8 +14,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id$ */
-
 /*! \file */
 
 #include <config.h>
@@ -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);
+}
index 42d572a75decd924ad91acb0c7c396140abba74c..95717c917921756d452b14faa214b95401cf512e 100644 (file)
@@ -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
new file mode 100644 (file)
index 0000000..9f6987f
--- /dev/null
@@ -0,0 +1,1426 @@
+/*
+ * Copyright (C) 2012-2017  Internet Systems Consortium, Inc. ("ISC")
+ *
+ * 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.
+ */
+
+/* ! \file */
+
+#include <config.h>
+#include <atf-c.h>
+#include <isc/mem.h>
+#include <isc/random.h>
+#include <isc/string.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h> /* uintptr_t */
+#endif
+
+#include <dns/rbt.h>
+#include <dns/fixedname.h>
+#include <dns/name.h>
+#include <dns/result.h>
+#include <dns/compress.h>
+#include "dnstest.h"
+
+#include <isc/app.h>
+#include <isc/buffer.h>
+#include <isc/entropy.h>
+#include <isc/file.h>
+#include <isc/hash.h>
+#include <isc/mem.h>
+#include <isc/os.h>
+#include <isc/string.h>
+#include <isc/socket.h>
+#include <isc/stdio.h>
+#include <isc/task.h>
+#include <isc/thread.h>
+#include <isc/timer.h>
+#include <isc/util.h>
+#include <isc/print.h>
+#include <isc/time.h>
+
+#include <dns/log.h>
+#include <dns/name.h>
+#include <dns/result.h>
+
+#include <dst/dst.h>
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <time.h>
+
+typedef struct {
+       dns_rbt_t *rbt;
+       dns_rbt_t *rbt_distances;
+} test_context_t;
+
+/* The initial structure of domain tree will be as follows:
+ *
+ *            .
+ *            |
+ *            b
+ *          /   \
+ *         a    d.e.f
+ *             /  |   \
+ *            c   |    g.h
+ *                |     |
+ *               w.y    i
+ *             /  |  \   \
+ *            x   |   z   k
+ *                |   |
+ *                p   j
+ *              /   \
+ *             o     q
+ */
+
+/* The full absolute names of the nodes in the tree (the tree also
+ * contains "." which is not included in this list).
+ */
+static const char * const domain_names[] = {
+    "c", "b", "a", "x.d.e.f", "z.d.e.f", "g.h", "i.g.h", "o.w.y.d.e.f",
+    "j.z.d.e.f", "p.w.y.d.e.f", "q.w.y.d.e.f", "k.g.h"
+};
+
+static const size_t domain_names_count = (sizeof(domain_names) /
+                                         sizeof(domain_names[0]));
+
+/* These are set as the node data for the tree used in distances check
+ * (for the names in domain_names[] above).
+ */
+static const int node_distances[] = {
+    3, 1, 2, 2, 2, 3, 1, 2, 1, 1, 2, 2
+};
+
+/*
+ * The domain order should be:
+ * ., a, b, c, d.e.f, x.d.e.f, w.y.d.e.f, o.w.y.d.e.f, p.w.y.d.e.f,
+ * q.w.y.d.e.f, z.d.e.f, j.z.d.e.f, g.h, i.g.h, k.g.h
+ *            . (no data, can't be found)
+ *            |
+ *            b
+ *          /   \
+ *         a    d.e.f
+ *             /  |   \
+ *            c   |    g.h
+ *                |     |
+ *               w.y    i
+ *             /  |  \   \
+ *            x   |   z   k
+ *                |   |
+ *                p   j
+ *              /   \
+ *             o     q
+ */
+
+static const char * const ordered_names[] = {
+    "a", "b", "c", "d.e.f", "x.d.e.f", "w.y.d.e.f", "o.w.y.d.e.f",
+    "p.w.y.d.e.f", "q.w.y.d.e.f", "z.d.e.f", "j.z.d.e.f",
+    "g.h", "i.g.h", "k.g.h"};
+
+static const size_t ordered_names_count = (sizeof(ordered_names) /
+                                          sizeof(*ordered_names));
+
+static void
+delete_data(void *data, void *arg) {
+       UNUSED(arg);
+
+       isc_mem_put(mctx, data, sizeof(size_t));
+}
+
+static test_context_t *
+test_context_setup(void) {
+       test_context_t *ctx;
+       isc_result_t result;
+       size_t i;
+
+       ctx = isc_mem_get(mctx, sizeof(*ctx));
+       ATF_REQUIRE(ctx != NULL);
+
+       ctx->rbt = NULL;
+       result = dns_rbt_create(mctx, delete_data, NULL, &ctx->rbt);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       ctx->rbt_distances = NULL;
+       result = dns_rbt_create(mctx, delete_data, NULL, &ctx->rbt_distances);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       for (i = 0; i < domain_names_count; i++) {
+               size_t *n;
+               dns_fixedname_t fname;
+               dns_name_t *name;
+
+               dns_test_namefromstring(domain_names[i], &fname);
+
+               name = dns_fixedname_name(&fname);
+
+               n = isc_mem_get(mctx, sizeof(size_t));
+               *n = i + 1;
+               result = dns_rbt_addname(ctx->rbt, name, n);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+               n = isc_mem_get(mctx, sizeof(size_t));
+               *n = node_distances[i];
+               result = dns_rbt_addname(ctx->rbt_distances, name, n);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+       }
+
+       return (ctx);
+}
+
+static void
+test_context_teardown(test_context_t *ctx) {
+       dns_rbt_destroy(&ctx->rbt);
+       dns_rbt_destroy(&ctx->rbt_distances);
+
+       isc_mem_put(mctx, ctx, sizeof(*ctx));
+}
+
+/*
+ * Walk the tree and ensure that all the test nodes are present.
+ */
+static void
+check_test_data(dns_rbt_t *rbt) {
+       dns_fixedname_t fixed;
+       isc_result_t result;
+       dns_name_t *foundname;
+       size_t i;
+
+       dns_fixedname_init(&fixed);
+       foundname = dns_fixedname_name(&fixed);
+
+       for (i = 0; i < domain_names_count; i++) {
+               dns_fixedname_t fname;
+               dns_name_t *name;
+               size_t *n;
+
+               dns_test_namefromstring(domain_names[i], &fname);
+
+               name = dns_fixedname_name(&fname);
+               n = NULL;
+               result = dns_rbt_findname(rbt, name, 0, foundname,
+                                         (void *) &n);
+               ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+               ATF_CHECK_EQ(*n, i + 1);
+       }
+}
+
+ATF_TC(rbt_create);
+ATF_TC_HEAD(rbt_create, tc) {
+       atf_tc_set_md_var(tc, "descr", "Test the creation of an rbt");
+}
+ATF_TC_BODY(rbt_create, tc) {
+       isc_result_t result;
+       test_context_t *ctx;
+       isc_boolean_t tree_ok;
+
+       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();
+
+       check_test_data(ctx->rbt);
+
+       tree_ok = dns__rbt_checkproperties(ctx->rbt);
+       ATF_CHECK_EQ(tree_ok, ISC_TRUE);
+
+       test_context_teardown(ctx);
+
+       dns_test_end();
+}
+
+ATF_TC(rbt_nodecount);
+ATF_TC_HEAD(rbt_nodecount, tc) {
+       atf_tc_set_md_var(tc, "descr", "Test dns_rbt_nodecount() on a tree");
+}
+ATF_TC_BODY(rbt_nodecount, tc) {
+       isc_result_t result;
+       test_context_t *ctx;
+
+       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();
+
+       ATF_CHECK_EQ(15, dns_rbt_nodecount(ctx->rbt));
+
+       test_context_teardown(ctx);
+
+       dns_test_end();
+}
+
+ATF_TC(rbtnode_get_distance);
+ATF_TC_HEAD(rbtnode_get_distance, tc) {
+       atf_tc_set_md_var(tc, "descr",
+                         "Test dns_rbtnode_get_distance() on a tree");
+}
+ATF_TC_BODY(rbtnode_get_distance, tc) {
+       isc_result_t result;
+       test_context_t *ctx;
+       const char *name_str = "a";
+       dns_fixedname_t fname;
+       dns_name_t *name;
+       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_test_namefromstring(name_str, &fname);
+       name = dns_fixedname_name(&fname);
+
+       dns_rbtnodechain_init(&chain, mctx);
+
+       result = dns_rbt_findnode(ctx->rbt_distances, name, NULL,
+                                 &node, &chain, 0, NULL, NULL);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       while (node != NULL) {
+               const size_t *distance = (const size_t *) node->data;
+               if (distance != NULL)
+                       ATF_CHECK_EQ(*distance,
+                                    dns__rbtnode_getdistance(node));
+               result = dns_rbtnodechain_next(&chain, NULL, NULL);
+               if (result == ISC_R_NOMORE)
+                     break;
+               dns_rbtnodechain_current(&chain, NULL, NULL, &node);
+       }
+
+       ATF_CHECK_EQ(result, ISC_R_NOMORE);
+
+       dns_rbtnodechain_invalidate(&chain);
+
+       test_context_teardown(ctx);
+
+       dns_test_end();
+}
+
+ATF_TC(rbt_check_distance_random);
+ATF_TC_HEAD(rbt_check_distance_random, tc) {
+       atf_tc_set_md_var(tc, "descr",
+                         "Test tree balance, inserting names in random order");
+}
+ATF_TC_BODY(rbt_check_distance_random, tc) {
+       /* This test checks an important performance-related property of
+        * the red-black tree, which is important for us: the longest
+        * path from a sub-tree's root to a node is no more than
+        * 2log(n). This check verifies that the tree is balanced.
+        */
+       dns_rbt_t *mytree = NULL;
+       const unsigned int log_num_nodes = 16;
+
+       int i;
+       isc_result_t result;
+       isc_boolean_t tree_ok;
+
+       UNUSED(tc);
+
+       isc_mem_debugging = ISC_MEM_DEBUGRECORD;
+
+       result = dns_test_begin(NULL, ISC_TRUE);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       /* Names are inserted in random order. */
+
+       /* Make a large 65536 node top-level domain tree, i.e., the
+        * following code inserts names such as:
+        *
+        * savoucnsrkrqzpkqypbygwoiliawpbmz.
+        * wkadamcbbpjtundbxcmuayuycposvngx.
+        * wzbpznemtooxdpjecdxynsfztvnuyfao.
+        * yueojmhyffslpvfmgyfwioxegfhepnqq.
+        */
+       for (i = 0; i < (1 << log_num_nodes); i++) {
+               size_t *n;
+               char namebuf[34];
+
+               n = isc_mem_get(mctx, sizeof(size_t));
+               *n = i + 1;
+
+               while (1) {
+                       int j;
+                       dns_fixedname_t fname;
+                       dns_name_t *name;
+
+                       for (j = 0; j < 32; j++) {
+                               isc_uint32_t v;
+                               isc_random_get(&v);
+                               namebuf[j] = 'a' + (v % 26);
+                       }
+                       namebuf[32] = '.';
+                       namebuf[33] = 0;
+
+                       dns_test_namefromstring(namebuf, &fname);
+                       name = dns_fixedname_name(&fname);
+
+                       result = dns_rbt_addname(mytree, name, n);
+                       if (result == ISC_R_SUCCESS)
+                               break;
+               }
+       }
+
+       /* 1 (root . node) + (1 << log_num_nodes) */
+       ATF_CHECK_EQ(1U + (1U << log_num_nodes), dns_rbt_nodecount(mytree));
+
+       /* The distance from each node to its sub-tree root must be less
+        * than 2 * log(n).
+        */
+       ATF_CHECK((2U * log_num_nodes) >= dns__rbt_getheight(mytree));
+
+       /* Also check RB tree properties */
+       tree_ok = dns__rbt_checkproperties(mytree);
+       ATF_CHECK_EQ(tree_ok, ISC_TRUE);
+
+       dns_rbt_destroy(&mytree);
+
+       dns_test_end();
+}
+
+ATF_TC(rbt_check_distance_ordered);
+ATF_TC_HEAD(rbt_check_distance_ordered, tc) {
+       atf_tc_set_md_var(tc, "descr",
+                         "Test tree balance, inserting names in sorted order");
+}
+ATF_TC_BODY(rbt_check_distance_ordered, tc) {
+       /* This test checks an important performance-related property of
+        * the red-black tree, which is important for us: the longest
+        * path from a sub-tree's root to a node is no more than
+        * 2log(n). This check verifies that the tree is balanced.
+        */
+       dns_rbt_t *mytree = NULL;
+       const unsigned int log_num_nodes = 16;
+
+       int i;
+       isc_result_t result;
+       isc_boolean_t tree_ok;
+
+       UNUSED(tc);
+
+       isc_mem_debugging = ISC_MEM_DEBUGRECORD;
+
+       result = dns_test_begin(NULL, ISC_TRUE);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       /* Names are inserted in sorted order. */
+
+       /* Make a large 65536 node top-level domain tree, i.e., the
+        * following code inserts names such as:
+        *
+        *   name00000000.
+        *   name00000001.
+        *   name00000002.
+        *   name00000003.
+        */
+       for (i = 0; i < (1 << log_num_nodes); i++) {
+               size_t *n;
+               char namebuf[14];
+               dns_fixedname_t fname;
+               dns_name_t *name;
+
+               n = isc_mem_get(mctx, sizeof(size_t));
+               *n = i + 1;
+
+               snprintf(namebuf, sizeof(namebuf), "name%08x.", i);
+               dns_test_namefromstring(namebuf, &fname);
+               name = dns_fixedname_name(&fname);
+
+               result = dns_rbt_addname(mytree, name, n);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+       }
+
+       /* 1 (root . node) + (1 << log_num_nodes) */
+       ATF_CHECK_EQ(1U + (1U << log_num_nodes), dns_rbt_nodecount(mytree));
+
+       /* The distance from each node to its sub-tree root must be less
+        * than 2 * log(n).
+        */
+       ATF_CHECK((2U * log_num_nodes) >= dns__rbt_getheight(mytree));
+
+       /* Also check RB tree properties */
+       tree_ok = dns__rbt_checkproperties(mytree);
+       ATF_CHECK_EQ(tree_ok, ISC_TRUE);
+
+       dns_rbt_destroy(&mytree);
+
+       dns_test_end();
+}
+
+static isc_result_t
+insert_helper(dns_rbt_t *rbt, const char *namestr, dns_rbtnode_t **node) {
+       dns_fixedname_t fname;
+       dns_name_t *name;
+
+       dns_test_namefromstring(namestr, &fname);
+       name = dns_fixedname_name(&fname);
+
+       return (dns_rbt_addnode(rbt, name, node));
+}
+
+static isc_boolean_t
+compare_labelsequences(dns_rbtnode_t *node, const char *labelstr) {
+       dns_name_t name;
+       isc_result_t result;
+       char *nodestr = NULL;
+       isc_boolean_t is_equal;
+
+       dns_name_init(&name, NULL);
+       dns_rbt_namefromnode(node, &name);
+
+       result = dns_name_tostring(&name, &nodestr, mctx);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       is_equal = strcmp(labelstr, nodestr) == 0 ? ISC_TRUE : ISC_FALSE;
+
+       isc_mem_free(mctx, nodestr);
+
+       return (is_equal);
+}
+
+ATF_TC(rbt_insert);
+ATF_TC_HEAD(rbt_insert, tc) {
+       atf_tc_set_md_var(tc, "descr", "Test insertion into a tree");
+}
+ATF_TC_BODY(rbt_insert, tc) {
+       isc_result_t result;
+       test_context_t *ctx;
+       dns_rbtnode_t *node;
+
+       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();
+
+       /* Check node count before beginning. */
+       ATF_CHECK_EQ(15, dns_rbt_nodecount(ctx->rbt));
+
+       /* Try to insert a node that already exists. */
+       node = NULL;
+       result = insert_helper(ctx->rbt, "d.e.f", &node);
+       ATF_CHECK_EQ(result, ISC_R_EXISTS);
+
+       /* Node count must not have changed. */
+       ATF_CHECK_EQ(15, dns_rbt_nodecount(ctx->rbt));
+
+       /* Try to insert a node that doesn't exist. */
+       node = NULL;
+       result = insert_helper(ctx->rbt, "0", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_CHECK_EQ(compare_labelsequences(node, "0"), ISC_TRUE);
+
+       /* Node count must have increased. */
+       ATF_CHECK_EQ(16, dns_rbt_nodecount(ctx->rbt));
+
+       /* Another. */
+       node = NULL;
+       result = insert_helper(ctx->rbt, "example.com", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_REQUIRE(node != NULL);
+       ATF_CHECK_EQ(node->data, NULL);
+
+       /* Node count must have increased. */
+       ATF_CHECK_EQ(17, dns_rbt_nodecount(ctx->rbt));
+
+       /* Re-adding it should return EXISTS */
+       node = NULL;
+       result = insert_helper(ctx->rbt, "example.com", &node);
+       ATF_CHECK_EQ(result, ISC_R_EXISTS);
+
+       /* Node count must not have changed. */
+       ATF_CHECK_EQ(17, dns_rbt_nodecount(ctx->rbt));
+
+       /* Fission the node d.e.f */
+       node = NULL;
+       result = insert_helper(ctx->rbt, "k.e.f", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_CHECK_EQ(compare_labelsequences(node, "k"), ISC_TRUE);
+
+       /* Node count must have incremented twice ("d.e.f" fissioned to
+        * "d" and "e.f", and the newly added "k").
+        */
+       ATF_CHECK_EQ(19, dns_rbt_nodecount(ctx->rbt));
+
+       /* Fission the node "g.h" */
+       node = NULL;
+       result = insert_helper(ctx->rbt, "h", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_CHECK_EQ(compare_labelsequences(node, "h"), ISC_TRUE);
+
+       /* Node count must have incremented ("g.h" fissioned to "g" and
+        * "h").
+        */
+       ATF_CHECK_EQ(20, dns_rbt_nodecount(ctx->rbt));
+
+       /* Add child domains */
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "m.p.w.y.d.e.f", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_CHECK_EQ(compare_labelsequences(node, "m"), ISC_TRUE);
+       ATF_CHECK_EQ(21, dns_rbt_nodecount(ctx->rbt));
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "n.p.w.y.d.e.f", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_CHECK_EQ(compare_labelsequences(node, "n"), ISC_TRUE);
+       ATF_CHECK_EQ(22, dns_rbt_nodecount(ctx->rbt));
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "l.a", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_CHECK_EQ(compare_labelsequences(node, "l"), ISC_TRUE);
+       ATF_CHECK_EQ(23, dns_rbt_nodecount(ctx->rbt));
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "r.d.e.f", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       node = NULL;
+       result = insert_helper(ctx->rbt, "s.d.e.f", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+       ATF_CHECK_EQ(25, dns_rbt_nodecount(ctx->rbt));
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "h.w.y.d.e.f", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       /* Add more nodes one by one to cover left and right rotation
+        * functions.
+        */
+       node = NULL;
+       result = insert_helper(ctx->rbt, "f", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "m", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "nm", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "om", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "k", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "l", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "fe", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "ge", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "i", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "ae", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       node = NULL;
+       result = insert_helper(ctx->rbt, "n", &node);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       test_context_teardown(ctx);
+
+       dns_test_end();
+}
+
+ATF_TC(rbt_remove);
+ATF_TC_HEAD(rbt_remove, tc) {
+       atf_tc_set_md_var(tc, "descr", "Test removal from a tree");
+}
+ATF_TC_BODY(rbt_remove, tc) {
+       /*
+        * This testcase checks that after node removal, the
+        * binary-search tree is valid and all nodes that are supposed
+        * to exist are present in the correct order. It mainly tests
+        * DomainTree as a BST, and not particularly as a red-black
+        * tree. This test checks node deletion when upper nodes have
+        * data.
+        */
+       isc_result_t result;
+       size_t j;
+
+       UNUSED(tc);
+
+       isc_mem_debugging = ISC_MEM_DEBUGRECORD;
+
+       result = dns_test_begin(NULL, ISC_TRUE);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       /*
+        * Delete single nodes and check if the rest of the nodes exist.
+        */
+       for (j = 0; j < ordered_names_count; j++) {
+               dns_rbt_t *mytree = NULL;
+               dns_rbtnode_t *node;
+               size_t i;
+               size_t *n;
+               isc_boolean_t tree_ok;
+               dns_rbtnodechain_t chain;
+               size_t start_node;
+
+               /* Create a tree. */
+               result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+               /* Insert test data into the tree. */
+               for (i = 0; i < domain_names_count; i++) {
+                       node = NULL;
+                       result = insert_helper(mytree, domain_names[i], &node);
+                       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+               }
+
+               /* Check that all names exist in order. */
+               for (i = 0; i < ordered_names_count; i++) {
+                       dns_fixedname_t fname;
+                       dns_name_t *name;
+
+                       dns_test_namefromstring(ordered_names[i], &fname);
+
+                       name = dns_fixedname_name(&fname);
+                       node = NULL;
+                       result = dns_rbt_findnode(mytree, name, NULL,
+                                                 &node, NULL,
+                                                 DNS_RBTFIND_EMPTYDATA,
+                                                 NULL, NULL);
+                       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+                       /* Add node data */
+                       ATF_REQUIRE(node != NULL);
+                       ATF_REQUIRE_EQ(node->data, NULL);
+
+                       n = isc_mem_get(mctx, sizeof(size_t));
+                       *n = i;
+
+                       node->data = n;
+               }
+
+               /* Now, delete the j'th node from the tree. */
+               {
+                       dns_fixedname_t fname;
+                       dns_name_t *name;
+
+                       dns_test_namefromstring(ordered_names[j], &fname);
+
+                       name = dns_fixedname_name(&fname);
+
+                       result = dns_rbt_deletename(mytree, name, ISC_FALSE);
+                       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+               }
+
+               /* Check RB tree properties. */
+               tree_ok = dns__rbt_checkproperties(mytree);
+               ATF_CHECK_EQ(tree_ok, ISC_TRUE);
+
+               dns_rbtnodechain_init(&chain, mctx);
+
+               /* Now, walk through nodes in order. */
+               if (j == 0) {
+                       /*
+                        * Node for ordered_names[0] was already deleted
+                        * above. We start from node 1.
+                        */
+                       dns_fixedname_t fname;
+                       dns_name_t *name;
+
+                       dns_test_namefromstring(ordered_names[0], &fname);
+                       name = dns_fixedname_name(&fname);
+                       node = NULL;
+                       result = dns_rbt_findnode(mytree, name, NULL,
+                                                 &node, NULL,
+                                                 0,
+                                                 NULL, NULL);
+                       ATF_CHECK_EQ(result, ISC_R_NOTFOUND);
+
+                       dns_test_namefromstring(ordered_names[1], &fname);
+                       name = dns_fixedname_name(&fname);
+                       node = NULL;
+                       result = dns_rbt_findnode(mytree, name, NULL,
+                                                 &node, &chain,
+                                                 0,
+                                                 NULL, NULL);
+                       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+                       start_node = 1;
+               } else {
+                       /* Start from node 0. */
+                       dns_fixedname_t fname;
+                       dns_name_t *name;
+
+                       dns_test_namefromstring(ordered_names[0], &fname);
+                       name = dns_fixedname_name(&fname);
+                       node = NULL;
+                       result = dns_rbt_findnode(mytree, name, NULL,
+                                                 &node, &chain,
+                                                 0,
+                                                 NULL, NULL);
+                       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+                       start_node = 0;
+               }
+
+               /*
+                * node and chain have been set by the code above at
+                * this point.
+                */
+               for (i = start_node; i < ordered_names_count; i++) {
+                       dns_fixedname_t fname_j, fname_i;
+                       dns_name_t *name_j, *name_i;
+
+                       dns_test_namefromstring(ordered_names[j], &fname_j);
+                       name_j = dns_fixedname_name(&fname_j);
+                       dns_test_namefromstring(ordered_names[i], &fname_i);
+                       name_i = dns_fixedname_name(&fname_i);
+
+                       if (dns_name_equal(name_i, name_j)) {
+                               /*
+                                * This may be true for the last node if
+                                * we seek ahead in the loop using
+                                * dns_rbtnodechain_next() below.
+                                */
+                               if (node == NULL) {
+                                       break;
+                               }
+
+                               /* All ordered nodes have data
+                                * initially. If any node is empty, it
+                                * means it was removed, but an empty
+                                * node exists because it is a
+                                * super-domain. Just skip it.
+                                */
+                               if (node->data == NULL) {
+                                       result = dns_rbtnodechain_next(&chain,
+                                                                      NULL,
+                                                                      NULL);
+                                       if (result == ISC_R_NOMORE) {
+                                               node = NULL;
+                                       } else {
+                                               dns_rbtnodechain_current(&chain,
+                                                                        NULL,
+                                                                        NULL,
+                                                                        &node);
+                                       }
+                               }
+                               continue;
+                       }
+
+                       ATF_REQUIRE(node != NULL);
+
+                       n = (size_t *) node->data;
+                       if (n != NULL) {
+                               /* printf("n=%zu, i=%zu\n", *n, i); */
+                               ATF_CHECK_EQ(*n, i);
+                       }
+
+                       result = dns_rbtnodechain_next(&chain, NULL, NULL);
+                       if (result == ISC_R_NOMORE) {
+                               node = NULL;
+                       } else {
+                               dns_rbtnodechain_current(&chain, NULL, NULL,
+                                                        &node);
+                       }
+               }
+
+               /* We should have reached the end of the tree. */
+               ATF_REQUIRE_EQ(node, NULL);
+
+               dns_rbt_destroy(&mytree);
+       }
+
+       dns_test_end();
+}
+
+static void
+insert_nodes(dns_rbt_t *mytree, char **names,
+            size_t *names_count, isc_uint32_t num_names)
+{
+       isc_uint32_t i;
+       dns_rbtnode_t *node;
+
+       for (i = 0; i < num_names; i++) {
+               size_t *n;
+               char namebuf[34];
+
+               n = isc_mem_get(mctx, sizeof(size_t));
+               ATF_REQUIRE(n != NULL);
+
+               *n = i; /* Unused value */
+
+               while (1) {
+                       int j;
+                       dns_fixedname_t fname;
+                       dns_name_t *name;
+                       isc_result_t result;
+
+                       for (j = 0; j < 32; j++) {
+                               isc_uint32_t v;
+                               isc_random_get(&v);
+                               namebuf[j] = 'a' + (v % 26);
+                       }
+                       namebuf[32] = '.';
+                       namebuf[33] = 0;
+
+                       dns_test_namefromstring(namebuf, &fname);
+                       name = dns_fixedname_name(&fname);
+
+                       node = NULL;
+                       result = dns_rbt_addnode(mytree, name, &node);
+                       if (result == ISC_R_SUCCESS) {
+                               node->data = n;
+                               names[*names_count] = isc_mem_strdup(mctx,
+                                                                    namebuf);
+                               *names_count += 1;
+                               break;
+                       }
+               }
+       }
+}
+
+static void
+remove_nodes(dns_rbt_t *mytree, char **names,
+            size_t *names_count, isc_uint32_t num_names)
+{
+       isc_uint32_t i;
+
+       UNUSED(mytree);
+
+       for (i = 0; i < num_names; i++) {
+               isc_uint32_t node;
+               dns_fixedname_t fname;
+               dns_name_t *name;
+               isc_result_t result;
+
+               isc_random_get(&node);
+
+               node %= *names_count;
+
+               dns_test_namefromstring(names[node], &fname);
+               name = dns_fixedname_name(&fname);
+
+               result = dns_rbt_deletename(mytree, name, ISC_FALSE);
+               ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+               isc_mem_free(mctx, names[node]);
+               if (*names_count > 0) {
+                       names[node] = names[*names_count - 1];
+                       names[*names_count - 1] = NULL;
+                       *names_count -= 1;
+               }
+       }
+}
+
+static void
+check_tree(dns_rbt_t *mytree, char **names, size_t names_count,
+          unsigned int line)
+{
+       isc_boolean_t tree_ok;
+
+       UNUSED(names);
+
+       ATF_CHECK_EQ_MSG(names_count + 1, dns_rbt_nodecount(mytree),
+                        "line:%u: %lu != %u", line,
+                        (unsigned long)(names_count + 1),
+                        dns_rbt_nodecount(mytree));
+
+       /*
+        * The distance from each node to its sub-tree root must be less
+        * than 2 * log_2(1024).
+        */
+       ATF_CHECK((2 * 10) >= dns__rbt_getheight(mytree));
+
+       /* Also check RB tree properties */
+       tree_ok = dns__rbt_checkproperties(mytree);
+       ATF_CHECK_EQ(tree_ok, ISC_TRUE);
+}
+
+ATF_TC(rbt_insert_and_remove);
+ATF_TC_HEAD(rbt_insert_and_remove, tc) {
+       atf_tc_set_md_var(tc, "descr",
+                         "Test insert and remove in a loop");
+}
+ATF_TC_BODY(rbt_insert_and_remove, tc) {
+       /*
+        * What is the best way to test our red-black tree code? It is
+        * not a good method to test every case handled in the actual
+        * code itself. This is because our approach itself may be
+        * incorrect.
+        *
+        * We test our code at the interface level here by exercising the
+        * tree randomly multiple times, checking that red-black tree
+        * properties are valid, and all the nodes that are supposed to be
+        * in the tree exist and are in order.
+        *
+        * NOTE: These tests are run within a single tree level in the
+        * forest. The number of nodes in the tree level doesn't grow
+        * over 1024.
+        */
+       isc_result_t result;
+       dns_rbt_t *mytree = NULL;
+       /*
+        * We use an array for storing names instead of a set
+        * structure. It's slow, but works and is good enough for tests.
+        */
+       char *names[1024];
+       size_t names_count;
+       int i;
+
+       UNUSED(tc);
+
+       isc_mem_debugging = ISC_MEM_DEBUGRECORD;
+
+       result = dns_test_begin(NULL, ISC_TRUE);
+       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+
+       result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       memset(names, 0, sizeof(names));
+       names_count = 0;
+
+       /* Repeat the insert/remove test some 4096 times */
+       for (i = 0; i < 4096; i++) {
+               isc_uint32_t num_names;
+               isc_random_get(&num_names);
+
+               if (names_count < 1024) {
+                       num_names %= 1024 - names_count;
+                       num_names++;
+               } else {
+                       num_names = 0;
+               }
+
+               insert_nodes(mytree, names, &names_count, num_names);
+               check_tree(mytree, names, names_count, __LINE__);
+
+               isc_random_get(&num_names);
+               if (names_count > 0) {
+                       num_names %= names_count;
+                       num_names++;
+               } else {
+                       num_names = 0;
+               }
+
+               remove_nodes(mytree, names, &names_count, num_names);
+               check_tree(mytree, names, names_count, __LINE__);
+       }
+
+       /* Remove the rest of the nodes */
+       remove_nodes(mytree, names, &names_count, names_count);
+       check_tree(mytree, names, names_count, __LINE__);
+
+       for (i = 0; i < 1024; i++) {
+               if (names[i] != NULL) {
+                       isc_mem_free(mctx, names[i]);
+               }
+       }
+
+       dns_rbt_destroy(&mytree);
+
+       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
+
+/*
+ * XXXMUKS: Don't delete this code. It is useful in benchmarking the
+ * RBT, but we don't require it as part of the unit test runs.
+ */
+
+ATF_TC(benchmark);
+ATF_TC_HEAD(benchmark, tc) {
+       atf_tc_set_md_var(tc, "descr", "Benchmark RBT implementation");
+}
+
+static dns_fixedname_t *fnames;
+static dns_name_t **names;
+static int *values;
+
+static void *
+find_thread(void *arg) {
+       dns_rbt_t *mytree;
+       isc_result_t result;
+       dns_rbtnode_t *node;
+       unsigned int j, i;
+       unsigned int start = 0;
+
+       mytree = (dns_rbt_t *) arg;
+       while (start == 0)
+               start = random() % 4000000;
+
+       /* Query 32 million random names from it in each thread */
+       for (j = 0; j < 8; j++) {
+               for (i = start; i != start - 1; i = (i + 1) % 4000000) {
+                       node = NULL;
+                       result = dns_rbt_findnode(mytree, names[i], NULL,
+                                                 &node, NULL,
+                                                 DNS_RBTFIND_EMPTYDATA,
+                                                 NULL, NULL);
+                       ATF_CHECK_EQ(result, ISC_R_SUCCESS);
+                       ATF_REQUIRE(node != NULL);
+                       ATF_CHECK_EQ(values[i], (intptr_t) node->data);
+               }
+       }
+
+       return (NULL);
+}
+
+ATF_TC_BODY(benchmark, tc) {
+       isc_result_t result;
+       char namestr[sizeof("name18446744073709551616.example.org.")];
+       unsigned int r;
+       dns_rbt_t *mytree;
+       dns_rbtnode_t *node;
+       unsigned int i;
+       unsigned int maxvalue = 1000000;
+       isc_time_t ts1, ts2;
+       double t;
+       unsigned int nthreads;
+       isc_thread_t threads[32];
+
+       UNUSED(tc);
+
+       srandom(time(NULL));
+
+       debug_mem_record = ISC_FALSE;
+
+       result = dns_test_begin(NULL, ISC_TRUE);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       fnames = (dns_fixedname_t *) malloc(4000000 * sizeof(dns_fixedname_t));
+       names = (dns_name_t **) malloc(4000000 * sizeof(dns_name_t *));
+       values = (int *) malloc(4000000 * sizeof(int));
+
+       for (i = 0; i < 4000000; i++) {
+                 r = ((unsigned long) random()) % maxvalue;
+                 snprintf(namestr, sizeof(namestr), "name%u.example.org.", r);
+                 dns_test_namefromstring(namestr, &fnames[i]);
+                 names[i] = dns_fixedname_name(&fnames[i]);
+                 values[i] = r;
+       }
+
+       /* Create a tree. */
+       mytree = NULL;
+       result = dns_rbt_create(mctx, NULL, NULL, &mytree);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       /* Insert test data into the tree. */
+       for (i = 0; i < maxvalue; i++) {
+               snprintf(namestr, sizeof(namestr), "name%u.example.org.", i);
+               node = NULL;
+               result = insert_helper(mytree, namestr, &node);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+               node->data = (void *) (intptr_t) i;
+       }
+
+       result = isc_time_now(&ts1);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       nthreads = ISC_MIN(isc_os_ncpus(), 32);
+       nthreads = ISC_MAX(nthreads, 1);
+       for (i = 0; i < nthreads; i++) {
+               result = isc_thread_create(find_thread, mytree, &threads[i]);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+       }
+
+       for (i = 0; i < nthreads; i++) {
+               result = isc_thread_join(threads[i], NULL);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+       }
+
+       result = isc_time_now(&ts2);
+       ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+       t = isc_time_microdiff(&ts2, &ts1);
+
+       printf("%u findnode calls, %f seconds, %f calls/second\n",
+              nthreads * 8 * 4000000, t / 1000000.0,
+              (nthreads * 8 * 4000000) / (t / 1000000.0));
+
+       free(values);
+       free(names);
+       free(fnames);
+
+       dns_rbt_destroy(&mytree);
+
+       dns_test_end();
+}
+
+#endif /* DNS_BENCHMARK_TESTS */
+#endif /* ISC_PLATFORM_USETHREADS */
+
+/*
+ * Main
+ */
+ATF_TP_ADD_TCS(tp) {
+       ATF_TP_ADD_TC(tp, rbt_create);
+       ATF_TP_ADD_TC(tp, rbt_nodecount);
+       ATF_TP_ADD_TC(tp, rbtnode_get_distance);
+       ATF_TP_ADD_TC(tp, rbt_check_distance_random);
+       ATF_TP_ADD_TC(tp, rbt_check_distance_ordered);
+       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);
+#endif /* DNS_BENCHMARK_TESTS */
+#endif /* ISC_PLATFORM_USETHREADS */
+
+       return (atf_no_error());
+}
index 9a5d57ae642c573db877c31546194471f53189c3..73a2aef9f7bfc6be9288131e78612ef3d35c4944 100644 (file)
 ./bin/tests/names/wire_test8.data              X       1999,2000,2001
 ./bin/tests/nsecify.c                          C       1999,2000,2001,2003,2004,2007,2008,2009,2011,2015,2017
 ./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
-./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,2015,2018
+./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
 ./bin/tests/rwlock_test.c                      C       1998,1999,2000,2001,2004,2005,2007,2013,2017,2018
index fb33401a0c88c3e51fa9dc6a6cb032a2ef75a6ff..3455eb5452f29353b4ce2b49d46ca7b94f241d0a 100644 (file)
@@ -243,8 +243,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\\win32\\backtrace_test.vcxproj",
                    "..\\bin\\tests\\win32\\backtrace_test.vcxproj.filters",
                    "..\\bin\\tests\\win32\\inter_test.vcxproj",
index ddacc682b92a3b23745939be5ac7ea6cde4ecda5..1e822c1de4b3122f1799248cb44cbb3196476c1a 100644 (file)
@@ -419,14 +419,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}"