0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2011, 2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11463c0ac24692e229ec87f307f5e7df3c0a7e10Evan Huntlocal_callback(const char *file, int line, isc_assertiontype_t type,
11463c0ac24692e229ec87f307f5e7df3c0a7e10Evan Hunt const char *cond)
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews UNUSED(file); UNUSED(line); UNUSED(type); UNUSED(cond);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews#define VERSION(callback) ((callback == NULL) ? v1 : v2)
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews#define VERSIONP(callback) ((callback == NULL) ? &v1 : &v2)
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews * Individual unit tests
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrewsattachversion(isc_assertioncallback_t callback) {
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews dns_db_attachversion(db1, VERSION(callback), &v);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_fail("dns_db_attachversion did not assert");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_attachversion passes with matching db/verison");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_attachversion aborts with mis-matching db/verison");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrewscloseversion(isc_assertioncallback_t callback) {
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews dns_db_closeversion(db1, VERSIONP(callback), ISC_FALSE);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_fail("dns_db_closeversion did not assert");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_closeversion passes with matching db/verison");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_closeversion asserts with mis-matching db/verison");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_find(db1, dns_rootname, VERSION(callback),
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_find passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_find asserts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrewsallrdatasets(isc_assertioncallback_t callback) {
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_allrdatasets(db1, node, VERSION(callback), 0,
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_fail("dns_db_allrdatasets did not assert");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_allrdatasets passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_allrdatasets aborts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrewsfindrdataset(isc_assertioncallback_t callback) {
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_findrdataset(db1, node, VERSION(callback),
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_fail("dns_db_findrdataset did not assert");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_findrdataset passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_findrdataset aborts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrewsdeleterdataset(isc_assertioncallback_t callback) {
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_deleterdataset(db1, node, VERSION(callback),
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_fail("dns_db_deleterdataset did not assert");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_deleterdataset passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_deleterdataset aborts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_subtractrdataset(db1, node, VERSION(callback),
702e9f43bc893f1ba687fd376e84afccb9b6a314Evan Hunt atf_tc_fail("dns_db_subtractrdataset did not assert");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_subtractrdataset passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_subtractrdataset aborts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_dump(db1, VERSION(callback), tempname);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_dump passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_dump aborts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_addrdataset(db1, node, VERSION(callback), 0, &rdataset,
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_fail("dns_db_adddataset did not assert");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_addrdataset passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_addrdataset aborts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrewsgetnsec3parameters(isc_assertioncallback_t callback) {
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_getnsec3parameters(db1, VERSION(callback), &hash,
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_getnsec3parameters passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_db_getnsec3parameters aborts with mis-matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews * Create a dummy RRSIG record and set a resigning time.
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews DNS_RDATACOMMON_INIT(&rrsig, dns_rdatatype_rrsig, dns_rdataclass_in);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_rdata_fromstruct(&rdata, dns_rdataclass_in,
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews rdataset.attributes |= DNS_RDATASETATTR_RESIGN;
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews result = dns_db_addrdataset(db1, node, v1, 0, &rdataset, 0, &added);
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews dns_db_resigned(db1, &added, VERSION(callback));
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_rdataset_resigned passes with matching db/version");
af850c4120c5bee9462de4def85d0b4c1b583963Mark Andrews atf_tc_set_md_var(tc, "descr", "check dns_rdataset_resigned aborts with mis-matching db/version");