summaryrefslogtreecommitdiffstats
path: root/bin/tests/master
diff options
context:
space:
mode:
Diffstat (limited to 'bin/tests/master')
-rw-r--r--bin/tests/master/Makefile.in58
-rw-r--r--bin/tests/master/dns_master_load_10_data12
-rw-r--r--bin/tests/master/dns_master_load_11_data12
-rw-r--r--bin/tests/master/dns_master_load_1_data12
-rw-r--r--bin/tests/master/dns_master_load_2_data12
-rw-r--r--bin/tests/master/dns_master_load_3_data12
-rw-r--r--bin/tests/master/dns_master_load_4_data12
-rw-r--r--bin/tests/master/dns_master_load_5_data12
-rw-r--r--bin/tests/master/dns_master_load_6_data12
-rw-r--r--bin/tests/master/dns_master_load_7_data12
-rw-r--r--bin/tests/master/dns_master_load_8_data12
-rw-r--r--bin/tests/master/dns_master_load_9_data12
-rw-r--r--bin/tests/master/master1.data11
-rw-r--r--bin/tests/master/master10.data7
-rw-r--r--bin/tests/master/master11.data6
-rw-r--r--bin/tests/master/master2.data11
-rw-r--r--bin/tests/master/master3.data11
-rw-r--r--bin/tests/master/master4.data11
-rw-r--r--bin/tests/master/master5.data11
-rw-r--r--bin/tests/master/master6.data33
-rw-r--r--bin/tests/master/master7.data17
-rw-r--r--bin/tests/master/master8.data4
-rw-r--r--bin/tests/master/master9.data4
-rw-r--r--bin/tests/master/t_master.c336
24 files changed, 652 insertions, 0 deletions
diff --git a/bin/tests/master/Makefile.in b/bin/tests/master/Makefile.in
new file mode 100644
index 0000000..03125da
--- /dev/null
+++ b/bin/tests/master/Makefile.in
@@ -0,0 +1,58 @@
+# Copyright (C) 2004, 2007 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.28 2007/06/19 23:47:00 tbox 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_master@EXEEXT@
+
+SRCS = t_master.c
+
+@BIND9_MAKE_RULES@
+
+t_master@EXEEXT@: t_master.@O@ ${DEPLIBS} ${TLIB}
+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ t_master.@O@ ${TLIB} ${LIBS}
+
+test: t_master@EXEEXT@
+ -@ ./t_master@EXEEXT@ -c @top_srcdir@/t_config -b @srcdir@ -a
+
+testhelp:
+ @ ./t_master@EXEEXT@ -h
+
+clean distclean::
+ rm -f ${TARGETS}
diff --git a/bin/tests/master/dns_master_load_10_data b/bin/tests/master/dns_master_load_10_data
new file mode 100644
index 0000000..cfaa3fb
--- /dev/null
+++ b/bin/tests/master/dns_master_load_10_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 9
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master10.data test in ISC_R_SUCCESS
diff --git a/bin/tests/master/dns_master_load_11_data b/bin/tests/master/dns_master_load_11_data
new file mode 100644
index 0000000..7b667b2
--- /dev/null
+++ b/bin/tests/master/dns_master_load_11_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 11
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master11.data test in ISC_R_SUCCESS
diff --git a/bin/tests/master/dns_master_load_1_data b/bin/tests/master/dns_master_load_1_data
new file mode 100644
index 0000000..fc92c74
--- /dev/null
+++ b/bin/tests/master/dns_master_load_1_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 1
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master1.data test in ISC_R_SUCCESS
diff --git a/bin/tests/master/dns_master_load_2_data b/bin/tests/master/dns_master_load_2_data
new file mode 100644
index 0000000..a6e44b3
--- /dev/null
+++ b/bin/tests/master/dns_master_load_2_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 2
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master2.data test in ISC_R_UNEXPECTEDEND
diff --git a/bin/tests/master/dns_master_load_3_data b/bin/tests/master/dns_master_load_3_data
new file mode 100644
index 0000000..9dbdfb2
--- /dev/null
+++ b/bin/tests/master/dns_master_load_3_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 3
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master3.data test in DNS_R_NOOWNER
diff --git a/bin/tests/master/dns_master_load_4_data b/bin/tests/master/dns_master_load_4_data
new file mode 100644
index 0000000..66ad1ff
--- /dev/null
+++ b/bin/tests/master/dns_master_load_4_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 4
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master4.data test in ISC_R_SUCCESS
diff --git a/bin/tests/master/dns_master_load_5_data b/bin/tests/master/dns_master_load_5_data
new file mode 100644
index 0000000..56e33ba
--- /dev/null
+++ b/bin/tests/master/dns_master_load_5_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 5
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master5.data test in DNS_R_BADCLASS
diff --git a/bin/tests/master/dns_master_load_6_data b/bin/tests/master/dns_master_load_6_data
new file mode 100644
index 0000000..d14aa88
--- /dev/null
+++ b/bin/tests/master/dns_master_load_6_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 6
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master6.data test in ISC_R_SUCCESS
diff --git a/bin/tests/master/dns_master_load_7_data b/bin/tests/master/dns_master_load_7_data
new file mode 100644
index 0000000..dbe7ef9
--- /dev/null
+++ b/bin/tests/master/dns_master_load_7_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 7
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master7.data test in ISC_R_SUCCESS
diff --git a/bin/tests/master/dns_master_load_8_data b/bin/tests/master/dns_master_load_8_data
new file mode 100644
index 0000000..b109d43
--- /dev/null
+++ b/bin/tests/master/dns_master_load_8_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 8
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master8.data test in DNS_R_SEENINCLUDE
diff --git a/bin/tests/master/dns_master_load_9_data b/bin/tests/master/dns_master_load_9_data
new file mode 100644
index 0000000..af36072
--- /dev/null
+++ b/bin/tests/master/dns_master_load_9_data
@@ -0,0 +1,12 @@
+#
+# test data for dns_master_load test 9
+#
+# format is:
+# masterfile origin class expected_result
+# where
+# masterfile name is the name of a file containing master data
+# origin is the origin
+# class is the zone's class
+# expected_result is a text representation of a dns_result_t
+#
+master9.data test in DNS_R_BADCLASS
diff --git a/bin/tests/master/master1.data b/bin/tests/master/master1.data
new file mode 100644
index 0000000..9b81474
--- /dev/null
+++ b/bin/tests/master/master1.data
@@ -0,0 +1,11 @@
+$TTL 1000
+@ in soa localhost. postmaster.localhost. (
+ 1993050801 ;serial
+ 3600 ;refresh
+ 1800 ;retry
+ 604800 ;expiration
+ 3600 ) ;minimum
+a in ns ns.vix.com.
+a in ns ns2vix.com.
+a in ns ns3vix.com.
+b in a 1.2.3.4
diff --git a/bin/tests/master/master10.data b/bin/tests/master/master10.data
new file mode 100644
index 0000000..9ee052f
--- /dev/null
+++ b/bin/tests/master/master10.data
@@ -0,0 +1,7 @@
+;
+; the following black line contains spaces
+
+;
+@ 300 IN A 10.0.0.1
+ ;
+;
diff --git a/bin/tests/master/master11.data b/bin/tests/master/master11.data
new file mode 100644
index 0000000..0aaec25
--- /dev/null
+++ b/bin/tests/master/master11.data
@@ -0,0 +1,6 @@
+;
+; The following serial number contains a leading 0 and a 9 so the
+; we can catch cases where it is incorrectly treated as a octal
+; number.
+;
+@ 300 IN SOA ns hostmaster 00090000 1200 3600 604800 300
diff --git a/bin/tests/master/master2.data b/bin/tests/master/master2.data
new file mode 100644
index 0000000..b8ca38d
--- /dev/null
+++ b/bin/tests/master/master2.data
@@ -0,0 +1,11 @@
+$TTL 1000
+@ in soa localhost. postmaster.localhost. (
+ 1993050801 ;serial
+ 3600 ;refresh
+ 1800 ;retry
+ 604800 ;expiration
+ 3600 ) ;minimum
+a in ns
+a in ns ns2vix.com.
+a in ns ns3vix.com.
+b in a 1.2.3.4
diff --git a/bin/tests/master/master3.data b/bin/tests/master/master3.data
new file mode 100644
index 0000000..7283af6
--- /dev/null
+++ b/bin/tests/master/master3.data
@@ -0,0 +1,11 @@
+$TTL 1000
+ in soa localhost. postmaster.localhost. (
+ 1993050801 ;serial
+ 3600 ;refresh
+ 1800 ;retry
+ 604800 ;expiration
+ 3600 ) ;minimum
+ in ns ns.vix.com
+ in ns ns2vix.com.
+a in ns ns3vix.com.
+b in a 1.2.3.4
diff --git a/bin/tests/master/master4.data b/bin/tests/master/master4.data
new file mode 100644
index 0000000..3a694ea
--- /dev/null
+++ b/bin/tests/master/master4.data
@@ -0,0 +1,11 @@
+
+@ in soa localhost. postmaster.localhost. (
+ 1993050801 ;serial
+ 3600 ;refresh
+ 1800 ;retry
+ 604800 ;expiration
+ 3600 ) ;minimum
+a in ns ns.vix.com.
+a in ns ns2vix.com.
+a in ns ns3vix.com.
+b in a 1.2.3.4
diff --git a/bin/tests/master/master5.data b/bin/tests/master/master5.data
new file mode 100644
index 0000000..95234bd
--- /dev/null
+++ b/bin/tests/master/master5.data
@@ -0,0 +1,11 @@
+$TTL 1000
+@ in soa localhost. postmaster.localhost. (
+ 1993050801 ;serial
+ 3600 ;refresh
+ 1800 ;retry
+ 604800 ;expiration
+ 3600 ) ;minimum
+a any ns ns.vix.com.
+a in ns ns2vix.com.
+a in ns ns3vix.com.
+b in a 1.2.3.4
diff --git a/bin/tests/master/master6.data b/bin/tests/master/master6.data
new file mode 100644
index 0000000..a9a37bb
--- /dev/null
+++ b/bin/tests/master/master6.data
@@ -0,0 +1,33 @@
+
+$TTL 1000
+@ in soa localhost. postmaster.localhost. (
+ 1993050801 ;serial
+ 3600 ;refresh
+ 1800 ;retry
+ 604800 ;expiration
+ 3600 ) ;minimum
+
+secure1 3600 IN DNSKEY (
+ FLAG2|FLAG4|FLAG5|NTYP3|FLAG8|FLAG9|FLAG10|FLAG11|SIG15
+ 3 3
+ ArT0a8FtOZWEONG2YQVl9+RA34op30JPz4NPEroCxm2yImT2
+ 2OYggnPIzrgayyepgKU1PfTTypnJDTwrSrtISyEsj7tjM7/n
+ 03DP8VWSn0aLwpUuc7Sx9vtM1Wi+YeiA4Bv2Oz1VB9de4qql
+ sIq+KLn8J4wz95bGnJ0mHUB7oTDJ3Hl1zeaCMdX69Kr46yAY
+ AvGJJdGGDYxYgxzx2zNdzypkYSkxpdsNqUt38tabSfdvCn12
+ pnmSWjlVJsjHhsaYnrPhouN5acOXMNbxNVbGU5LZ8Es6EYbV
+ /7YMt8VUkA8/8UCszBBT7XAJ3OFjiMO8mvxrZZFzvwJlPBQ1
+ oFq/TNZlSe+N )
+
+secure2 3600 in DNSKEY (
+ flag2|flag4|flag5|ntyp3|flag8|flag9|flag10|flag11|sig15
+ 3 3
+ ArT0a8FtOZWEONG2YQVl9+RA34op30JPz4NPEroCxm2yImT2
+ 2OYggnPIzrgayyepgKU1PfTTypnJDTwrSrtISyEsj7tjM7/n
+ 03DP8VWSn0aLwpUuc7Sx9vtM1Wi+YeiA4Bv2Oz1VB9de4qql
+ sIq+KLn8J4wz95bGnJ0mHUB7oTDJ3Hl1zeaCMdX69Kr46yAY
+ AvGJJdGGDYxYgxzx2zNdzypkYSkxpdsNqUt38tabSfdvCn12
+ pnmSWjlVJsjHhsaYnrPhouN5acOXMNbxNVbGU5LZ8Es6EYbV
+ /7YMt8VUkA8/8UCszBBT7XAJ3OFjiMO8mvxrZZFzvwJlPBQ1
+ oFq/TNZlSe+N )
+
diff --git a/bin/tests/master/master7.data b/bin/tests/master/master7.data
new file mode 100644
index 0000000..2638b5d
--- /dev/null
+++ b/bin/tests/master/master7.data
@@ -0,0 +1,17 @@
+
+$TTL 1000
+@ in soa localhost. postmaster.localhost. (
+ 1993050801 ;serial
+ 3600 ;refresh
+ 1800 ;retry
+ 604800 ;expiration
+ 3600 ) ;minimum
+
+secure1 3600 IN DNSKEY (
+ NOKEY|FLAG2|FLAG4|FLAG5|NTYP3|FLAG8|FLAG9|FLAG10|FLAG11|SIG15
+ 3 3 )
+
+secure2 3600 in DNSKEY (
+ nokey|flag2|flag4|flag5|ntyp3|flag8|flag9|flag10|flag11|sig15
+ 3 3 )
+
diff --git a/bin/tests/master/master8.data b/bin/tests/master/master8.data
new file mode 100644
index 0000000..58bded9
--- /dev/null
+++ b/bin/tests/master/master8.data
@@ -0,0 +1,4 @@
+;
+; master7.data contains a good zone file
+;
+$include master7.data
diff --git a/bin/tests/master/master9.data b/bin/tests/master/master9.data
new file mode 100644
index 0000000..e7bcf7e
--- /dev/null
+++ b/bin/tests/master/master9.data
@@ -0,0 +1,4 @@
+;
+; master5.data is bad
+;
+$include master5.data
diff --git a/bin/tests/master/t_master.c b/bin/tests/master/t_master.c
new file mode 100644
index 0000000..4693114
--- /dev/null
+++ b/bin/tests/master/t_master.c
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2004, 2005, 2007 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_master.c,v 1.36 2007/06/19 23:47:00 tbox Exp $ */
+
+#include <config.h>
+
+#include <ctype.h>
+#include <stdlib.h>
+
+#include <isc/buffer.h>
+#include <isc/mem.h>
+#include <isc/string.h> /* Required for HP/UX (and others?) */
+#include <isc/util.h>
+
+#include <dns/callbacks.h>
+#include <dns/master.h>
+#include <dns/name.h>
+#include <dns/rdataclass.h>
+#include <dns/rdataset.h>
+#include <dns/result.h>
+
+#include <tests/t_api.h>
+
+#define BUFLEN 255
+#define BIGBUFLEN (64 * 1024)
+
+static isc_result_t
+t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset);
+
+isc_mem_t *T1_mctx;
+char *Tokens[T_MAXTOKS + 1];
+
+static isc_result_t
+t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset) {
+ char buf[BIGBUFLEN];
+ isc_buffer_t target;
+ isc_result_t result;
+
+ UNUSED(arg);
+
+ isc_buffer_init(&target, buf, BIGBUFLEN);
+ result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE,
+ &target);
+ if (result != ISC_R_SUCCESS)
+ t_info("dns_rdataset_totext: %s\n", dns_result_totext(result));
+
+ return(result);
+}
+
+static int
+test_master(char *testfile, char *origin, char *class, isc_result_t exp_result)
+{
+ int result;
+ int len;
+ isc_result_t isc_result;
+ isc_result_t dns_result;
+ dns_name_t dns_origin;
+ isc_buffer_t source;
+ isc_buffer_t target;
+ unsigned char name_buf[BUFLEN];
+ dns_rdatacallbacks_t callbacks;
+ dns_rdataclass_t rdataclass;
+ isc_textregion_t textregion;
+
+ result = T_UNRESOLVED;
+ if (T1_mctx == NULL)
+ isc_result = isc_mem_create(0, 0, &T1_mctx);
+ else
+ isc_result = ISC_R_SUCCESS;
+ if (isc_result != ISC_R_SUCCESS) {
+ t_info("isc_mem_create failed %d\n", isc_result);
+ return(T_UNRESOLVED);
+ }
+
+ len = strlen(origin);
+ isc_buffer_init(&source, origin, len);
+ isc_buffer_add(&source, len);
+ isc_buffer_setactive(&source, len);
+ isc_buffer_init(&target, name_buf, BUFLEN);
+ dns_name_init(&dns_origin, NULL);
+ dns_result = dns_name_fromtext(&dns_origin, &source, dns_rootname,
+ ISC_FALSE, &target);
+ if (dns_result != ISC_R_SUCCESS) {
+ t_info("dns_name_fromtext failed %s\n",
+ dns_result_totext(dns_result));
+ return(T_UNRESOLVED);
+ }
+
+ dns_rdatacallbacks_init_stdio(&callbacks);
+ callbacks.add = t1_add_callback;
+
+ textregion.base = class;
+ textregion.length = strlen(class);
+
+ dns_result = dns_rdataclass_fromtext(&rdataclass, &textregion);
+ if (dns_result != ISC_R_SUCCESS) {
+ t_info("dns_rdataclass_fromtext failed %s\n",
+ dns_result_totext(dns_result));
+ return(T_UNRESOLVED);
+ }
+
+ dns_result = dns_master_loadfile( testfile,
+ &dns_origin,
+ &dns_origin,
+ rdataclass,
+ ISC_TRUE,
+ &callbacks,
+ T1_mctx);
+
+ if (dns_result == exp_result)
+ result = T_PASS;
+ else {
+ t_info("dns_master_loadfile: got %s, expected %s\n",
+ dns_result_totext(dns_result),
+ dns_result_totext(exp_result));
+ result = T_FAIL;
+ }
+ return(result);
+}
+
+static int
+test_master_x(const char *filename) {
+ FILE *fp;
+ char *p;
+ int line;
+ int cnt;
+ int result;
+
+ result = T_UNRESOLVED;
+
+ fp = fopen(filename, "r");
+ if (fp != NULL) {
+ line = 0;
+ while ((p = t_fgetbs(fp)) != NULL) {
+
+ ++line;
+
+ /*
+ * Skip comment lines.
+ */
+ if ((isspace(*p & 0xff)) || (*p == '#')) {
+ (void)free(p);
+ continue;
+ }
+
+ /*
+ * Name of data file, origin, zclass, expected result.
+ */
+ cnt = t_bustline(p, Tokens);
+ if (cnt == 4) {
+ result = test_master(Tokens[0], Tokens[1],
+ Tokens[2],
+ t_dns_result_fromtext(Tokens[3]));
+ } else {
+ t_info("bad format in %s at line %d\n",
+ filename, line);
+ }
+
+ (void)free(p);
+ }
+ (void)fclose(fp);
+ } else {
+ t_info("Missing datafile %s\n", filename);
+ }
+ return(result);
+}
+
+static const char *a1 = "dns_master_loadfile loads a valid master file and "
+ "returns ISC_R_SUCCESS";
+static void
+t1(void) {
+ int result;
+ t_assert("dns_master_loadfile", 1, T_REQUIRED, a1);
+ result = test_master_x("dns_master_load_1_data");
+ t_result(result);
+}
+
+static const char *a2 =
+ "dns_master_loadfile returns ISC_R_UNEXPECTEDEND when the "
+ "masterfile input ends unexpectedly";
+
+static void
+t2(void) {
+ int result;
+ t_assert("dns_master_loadfile", 2, T_REQUIRED, a2);
+ result = test_master_x("dns_master_load_2_data");
+ t_result(result);
+}
+
+static const char *a3 = "dns_master_loadfile returns DNS_R_NOOWNER when the "
+ "an ownername is not specified";
+
+static void
+t3() {
+ int result;
+ t_assert("dns_master_loadfile", 3, T_REQUIRED, a3);
+ result = test_master_x("dns_master_load_3_data");
+ t_result(result);
+}
+
+static const char *a4 = "dns_master_loadfile accepts broken zone files "
+ "where the first record has an undefined TTL, "
+ "as long as it is a SOA";
+
+static void
+t4() {
+ int result;
+ t_assert("dns_master_loadfile", 4, T_REQUIRED, a4);
+ result = test_master_x("dns_master_load_4_data");
+ t_result(result);
+}
+
+static const char *a5 = "dns_master_loadfile returns DNS_R_BADCLASS when the "
+ "the record class did not match the zone class";
+
+static void
+t5() {
+ int result;
+
+ t_assert("dns_master_loadfile", 5, T_REQUIRED, a5);
+ result = test_master_x("dns_master_load_5_data");
+
+ t_result(result);
+}
+
+static const char *a6 =
+ "dns_master_loadfile understands DNSKEY RR specifications "
+ "containing key material";
+
+static void
+t6() {
+ int result;
+
+ t_assert("dns_master_loadfile", 6, T_REQUIRED, a6);
+ result = test_master_x("dns_master_load_6_data");
+
+ t_result(result);
+}
+
+static const char *a7 =
+ "dns_master_loadfile understands DNSKEY RR specifications "
+ "containing no key material";
+
+static void
+t7() {
+ int result;
+
+ t_assert("dns_master_loadfile", 7, T_REQUIRED, a7);
+ result = test_master_x("dns_master_load_7_data");
+
+ t_result(result);
+}
+
+static const char *a8 =
+ "dns_master_loadfile understands $INCLUDE";
+
+static void
+t8() {
+ int result;
+
+ t_assert("dns_master_loadfile", 8, T_REQUIRED, a8);
+ result = test_master_x("dns_master_load_8_data");
+
+ t_result(result);
+}
+
+static const char *a9 =
+ "dns_master_loadfile understands $INCLUDE with failure";
+
+static void
+t9() {
+ int result;
+
+ t_assert("dns_master_loadfile", 9, T_REQUIRED, a9);
+ result = test_master_x("dns_master_load_9_data");
+
+ t_result(result);
+}
+
+static const char *a10 =
+ "dns_master_loadfile non-empty blank lines";
+
+static void
+t10() {
+ int result;
+
+ t_assert("dns_master_loadfile", 10, T_REQUIRED, a10);
+ result = test_master_x("dns_master_load_10_data");
+
+ t_result(result);
+}
+
+static const char *a11 =
+ "dns_master_loadfile allow leading zeros in SOA";
+
+static void
+t11() {
+ int result;
+
+ t_assert("dns_master_loadfile", 11, T_REQUIRED, a11);
+ result = test_master_x("dns_master_load_11_data");
+
+ t_result(result);
+}
+
+
+testspec_t T_testlist[] = {
+ { t1, "ISC_R_SUCCESS" },
+ { t2, "ISC_R_UNEXPECTEDEND" },
+ { t3, "DNS_NOOWNER" },
+ { t4, "DNS_NOTTL" },
+ { t5, "DNS_BADCLASS" },
+ { t6, "DNSKEY RR 1" },
+ { t7, "DNSKEY RR 2" },
+ { t8, "$INCLUDE" },
+ { t9, "$INCLUDE w/ DNS_BADCLASS" },
+ { t10, "non empty blank lines" },
+ { t11, "leading zeros in serial" },
+ { NULL, NULL }
+};
+