00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <atf-c.h>
00024
00025 #include <unistd.h>
00026 #include <stdlib.h>
00027
00028 #include <dns/db.h>
00029 #include <dns/dbiterator.h>
00030 #include <dns/name.h>
00031 #include <dns/journal.h>
00032
00033 #include "dnstest.h"
00034
00035
00036
00037
00038
00039 #define BUFLEN 255
00040 #define BIGBUFLEN (64 * 1024)
00041 #define TEST_ORIGIN "test"
00042
00043
00044
00045
00046
00047 ATF_TC(getoriginnode);
00048 ATF_TC_HEAD(getoriginnode, tc) {
00049 atf_tc_set_md_var(tc, "descr",
00050 "test multiple calls to dns_db_getoriginnode");
00051 }
00052 ATF_TC_BODY(getoriginnode, tc) {
00053 dns_db_t *db = NULL;
00054 dns_dbnode_t *node = NULL;
00055 isc_mem_t *mymctx = NULL;
00056 isc_result_t result;
00057
00058 result = isc_mem_create(0, 0, &mymctx);
00059 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00060
00061 result = isc_hash_create(mymctx, NULL, 256);
00062 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00063
00064 result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone,
00065 dns_rdataclass_in, 0, NULL, &db);
00066 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00067
00068 result = dns_db_getoriginnode(db, &node);
00069 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00070 dns_db_detachnode(db, &node);
00071
00072 result = dns_db_getoriginnode(db, &node);
00073 ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
00074 dns_db_detachnode(db, &node);
00075
00076 dns_db_detach(&db);
00077 isc_mem_detach(&mymctx);
00078 }
00079
00080
00081
00082
00083 ATF_TP_ADD_TCS(tp) {
00084 ATF_TP_ADD_TC(tp, getoriginnode);
00085 return (atf_no_error());
00086 }