当前位置: 首页>>代码示例>>C++>>正文


C++ dns_test_begin函数代码示例

本文整理汇总了C++中dns_test_begin函数的典型用法代码示例。如果您正苦于以下问题:C++ dns_test_begin函数的具体用法?C++ dns_test_begin怎么用?C++ dns_test_begin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dns_test_begin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getnsec3parameters

static void
getnsec3parameters(isc_assertioncallback_t callback) {
	isc_result_t result;
	dns_hash_t hash;
	isc_uint8_t flags;
	isc_uint16_t iterations;
	unsigned char salt[DNS_NSEC3_SALTSIZE];
	size_t salt_length = sizeof(salt);

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	setup_db();

	isc_assertion_setcallback(callback);
	result = dns_db_getnsec3parameters(db1, VERSION(callback), &hash,
					   &flags, &iterations, salt,
					   &salt_length);
	if (callback != NULL)
		atf_tc_fail("dns_db_dump did not assert");
	ATF_REQUIRE_EQ(result, ISC_R_NOTFOUND);

	close_db();

	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:26,代码来源:dbversion_test.c

示例2: allrdatasets

static void
allrdatasets(isc_assertioncallback_t callback) {
	isc_result_t result;
	dns_dbnode_t *node = NULL;
	dns_rdatasetiter_t *iterator = NULL;

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	setup_db();

	result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	isc_assertion_setcallback(callback);
	result = dns_db_allrdatasets(db1, node, VERSION(callback), 0,
				     &iterator);
	if (callback != NULL)
		atf_tc_fail("dns_db_allrdatasets did not assert");
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	dns_rdatasetiter_destroy(&iterator);
	ATF_REQUIRE_EQ(iterator, NULL);

	dns_db_detachnode(db1, &node);
	ATF_REQUIRE_EQ(node, NULL);

	close_db();

	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:31,代码来源:dbversion_test.c

示例3: ATF_TC_BODY

ATF_TC_BODY(zonemgr_createzone, tc) {
	dns_zonemgr_t *myzonemgr = NULL;
	dns_zone_t *zone = NULL;
	isc_result_t result;

	UNUSED(tc);

	result = dns_test_begin(NULL, ISC_TRUE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr,
				    &myzonemgr);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	/* This should not succeed until the dns_zonemgr_setsize() is run */
	result = dns_zonemgr_createzone(myzonemgr, &zone);
	ATF_REQUIRE_EQ(result, ISC_R_FAILURE);

	result = dns_zonemgr_setsize(myzonemgr, 1);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	/* Now it should succeed */
	result = dns_zonemgr_createzone(myzonemgr, &zone);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	ATF_CHECK(zone != NULL);

	if (zone != NULL)
		dns_zone_detach(&zone);

	dns_zonemgr_shutdown(myzonemgr);
	dns_zonemgr_detach(&myzonemgr);
	ATF_REQUIRE_EQ(myzonemgr, NULL);

	dns_test_end();
}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:35,代码来源:zonemgr_test.c

示例4: ATF_TC_BODY

ATF_TC_BODY(loadraw, tc) {
	isc_result_t result;

	UNUSED(tc);

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	/* Raw format version 0 */
	result = test_master("testdata/master/master12.data",
			     dns_masterformat_raw, NULL, NULL);
	ATF_CHECK_STREQ(isc_result_totext(result), "success");
	ATF_CHECK(headerset);
	ATF_CHECK_EQ(header.flags, 0);

	/* Raw format version 1, no source serial  */
	result = test_master("testdata/master/master13.data",
			     dns_masterformat_raw, NULL, NULL);
	ATF_CHECK_STREQ(isc_result_totext(result), "success");
	ATF_CHECK(headerset);
	ATF_CHECK_EQ(header.flags, 0);

	/* Raw format version 1, source serial == 2011120101 */
	result = test_master("testdata/master/master14.data",
			     dns_masterformat_raw, NULL, NULL);
	ATF_CHECK_STREQ(isc_result_totext(result), "success");
	ATF_CHECK(headerset);
	ATF_CHECK((header.flags & DNS_MASTERRAW_SOURCESERIALSET) != 0);
	ATF_CHECK_EQ(header.sourceserial, 2011120101);

	dns_test_end();
}
开发者ID:JeanCaron,项目名称:bind9,代码行数:32,代码来源:master_test.c

示例5: find

static void
find(isc_assertioncallback_t callback) {
	isc_result_t result;
	dns_rdataset_t rdataset;
	dns_fixedname_t fixed;

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	setup_db();

	dns_rdataset_init(&rdataset);
	dns_fixedname_init(&fixed);

	isc_assertion_setcallback(callback);
	result = dns_db_find(db1, dns_rootname, VERSION(callback),
			     dns_rdatatype_soa, 0, 0, NULL,
			     dns_fixedname_name(&fixed), &rdataset, NULL);
	if (callback != NULL)
		atf_tc_fail("dns_db_find did not assert");
	ATF_REQUIRE_EQ(result, DNS_R_NXDOMAIN);

	close_db();

	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:26,代码来源:dbversion_test.c

示例6: ATF_TC_BODY

ATF_TC_BODY(zonemgr_unreachable, tc) {
	dns_zonemgr_t *zonemgr = NULL;
	dns_zone_t *zone = NULL;
	isc_sockaddr_t addr1, addr2;
	struct in_addr in;
	isc_result_t result;
	isc_time_t now;

	UNUSED(tc);

	TIME_NOW(&now);

	result = dns_test_begin(NULL, ISC_TRUE);

	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr,
				    &zonemgr);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_test_makezone("foo", &zone, NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_zonemgr_setsize(zonemgr, 1);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_zonemgr_managezone(zonemgr, zone);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	in.s_addr = inet_addr("10.53.0.1");
	isc_sockaddr_fromin(&addr1, &in, 2112);
	in.s_addr = inet_addr("10.53.0.2");
	isc_sockaddr_fromin(&addr2, &in, 5150);
	ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now));
	dns_zonemgr_unreachableadd(zonemgr, &addr1, &addr2, &now);
	ATF_CHECK(dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now));

	in.s_addr = inet_addr("10.53.0.3");
	isc_sockaddr_fromin(&addr2, &in, 5150);
	ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now));
	dns_zonemgr_unreachableadd(zonemgr, &addr1, &addr2, &now);
	ATF_CHECK(dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now));

	dns_zonemgr_unreachabledel(zonemgr, &addr1, &addr2);
	ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now));

	in.s_addr = inet_addr("10.53.0.2");
	isc_sockaddr_fromin(&addr2, &in, 5150);
	ATF_CHECK(dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now));
	dns_zonemgr_unreachabledel(zonemgr, &addr1, &addr2);
	ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now));

	dns_zonemgr_releasezone(zonemgr, zone);
	dns_zone_detach(&zone);
	dns_zonemgr_shutdown(zonemgr);
	dns_zonemgr_detach(&zonemgr);
	ATF_REQUIRE_EQ(zonemgr, NULL);

	dns_test_end();
}
开发者ID:Feechka,项目名称:bind9,代码行数:60,代码来源:zonemgr_test.c

示例7: test_seek_nx

/*
 * seek_emty: walk database starting at an empty nonterminal node
 * (should fail)
 */
static void test_seek_nx(const atf_tc_t *tc) {
	isc_result_t result;
	dns_db_t *db = NULL;
	dns_dbiterator_t *iter = NULL;
	dns_name_t *seekname;
	dns_fixedname_t f1;

	UNUSED(tc);

	dns_fixedname_init(&f1);
	seekname = dns_fixedname_name(&f1);

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN,
				 atf_tc_get_md_var(tc, "X-filename"));
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_db_createiterator(db, 0, &iter);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = make_name("nonexistent." TEST_ORIGIN, seekname);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_dbiterator_seek(iter, seekname);
	ATF_CHECK_EQ(result, ISC_R_NOTFOUND);

	dns_dbiterator_destroy(&iter);
	dns_db_detach(&db);
	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:36,代码来源:dbiterator_test.c

示例8: ATF_TC_BODY

ATF_TC_BODY(create, tc) {
	isc_result_t result;
	dns_dtenv_t *dtenv = NULL;

	UNUSED(tc);

	cleanup();

	result = dns_test_begin(NULL, ISC_TRUE);
	ATF_REQUIRE(result == ISC_R_SUCCESS);

	result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, 1, &dtenv);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	if (dtenv != NULL)
		dns_dt_detach(&dtenv);

	ATF_CHECK(isc_file_exists(TAPFILE));

	result = dns_dt_create(mctx, dns_dtmode_unix, TAPSOCK, 1, &dtenv);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	if (dtenv != NULL)
		dns_dt_detach(&dtenv);

	/* 'create' should succeed, but the file shouldn't exist yet */
	ATF_CHECK(!isc_file_exists(TAPSOCK));

	result = dns_dt_create(mctx, 33, TAPSOCK, 1, &dtenv);
	ATF_CHECK_EQ(result, ISC_R_FAILURE);
	ATF_CHECK_EQ(dtenv, NULL);

	cleanup();

	dns_dt_shutdown();
	dns_test_end();
}
开发者ID:crossbuild,项目名称:bind,代码行数:35,代码来源:dnstap_test.c

示例9: dump

static void
dump(isc_assertioncallback_t callback) {
	isc_result_t result;
	FILE *f = NULL;

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	setup_db();

	result = isc_file_openunique(tempname, &f);
	fclose(f);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	isc_assertion_setcallback(callback);
	result = dns_db_dump(db1, VERSION(callback), tempname);
	(void)unlink(tempname);
	if (callback != NULL)
		atf_tc_fail("dns_db_dump did not assert");
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	close_db();

	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:25,代码来源:dbversion_test.c

示例10: ATF_TC_BODY

ATF_TC_BODY(isc_dh_computesecret, tc) {
	dst_key_t *key = NULL;
	isc_buffer_t buf;
	unsigned char array[1024];
	isc_result_t ret;
	dns_fixedname_t fname;
	dns_name_t *name;

	UNUSED(tc);

	ret = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS);

	dns_fixedname_init(&fname);
	name = dns_fixedname_name(&fname);
	isc_buffer_constinit(&buf, "dh.", 3);
	isc_buffer_add(&buf, 3);
	ret = dns_name_fromtext(name, &buf, NULL, 0, NULL);
	ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS);

	ret = dst_key_fromfile(name, 18602, DST_ALG_DH,
			       DST_TYPE_PUBLIC | DST_TYPE_KEY,
			       "./", mctx, &key);
	ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS);

	isc_buffer_init(&buf, array, sizeof(array));
	ret = dst_key_computesecret(key, key, &buf);
	ATF_REQUIRE_EQ(ret, DST_R_NOTPRIVATEKEY);
	ret = key->func->computesecret(key, key, &buf);
	ATF_REQUIRE_EQ(ret, DST_R_COMPUTESECRETFAILURE);

	dst_key_free(&key);
	dns_test_end();
}
开发者ID:execunix,项目名称:vinos,代码行数:34,代码来源:dh_test.c

示例11: deleterdataset

static void
deleterdataset(isc_assertioncallback_t callback) {
	isc_result_t result;
	dns_rdataset_t rdataset;
	dns_fixedname_t fixed;
	dns_dbnode_t *node = NULL;

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	setup_db();

	dns_rdataset_init(&rdataset);
	dns_fixedname_init(&fixed);

	result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	isc_assertion_setcallback(callback);
	result = dns_db_deleterdataset(db1, node, VERSION(callback),
				       dns_rdatatype_soa, 0);
	if (callback != NULL)
		atf_tc_fail("dns_db_deleterdataset did not assert");
	ATF_REQUIRE_EQ(result, DNS_R_UNCHANGED);

	dns_db_detachnode(db1, &node);
	ATF_REQUIRE_EQ(node, NULL);

	close_db();

	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:32,代码来源:dbversion_test.c

示例12: test_seek

/* seek: walk database starting at a particular node */
static void test_seek(const atf_tc_t *tc) {
	isc_result_t result;
	dns_db_t *db = NULL;
	dns_dbiterator_t *iter = NULL;
	dns_dbnode_t *node = NULL;
	dns_name_t *name, *seekname;
	dns_fixedname_t f1, f2;
	int i = 0;

	UNUSED(tc);

	dns_fixedname_init(&f1);
	name = dns_fixedname_name(&f1);
	dns_fixedname_init(&f2);
	seekname = dns_fixedname_name(&f2);

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN,
				 atf_tc_get_md_var(tc, "X-filename"));
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_db_createiterator(db, 0, &iter);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = make_name("c." TEST_ORIGIN, seekname);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_dbiterator_seek(iter, seekname);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);

	while (result == ISC_R_SUCCESS) {
		result = dns_dbiterator_current(iter, &node, name);
		if (result == DNS_R_NEWORIGIN)
			result = ISC_R_SUCCESS;
		ATF_CHECK_EQ(result, ISC_R_SUCCESS);
		dns_db_detachnode(db, &node);
		result = dns_dbiterator_next(iter);
		i++;
	}

	ATF_CHECK_EQ(i, atoi(atf_tc_get_md_var(tc, "X-nodes")));

	dns_dbiterator_destroy(&iter);
	dns_db_detach(&db);
	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:49,代码来源:dbiterator_test.c

示例13: ATF_TC_BODY

ATF_TC_BODY(max_iterations, tc) {
	isc_result_t result;

	UNUSED(tc);

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	iteration_test("testdata/nsec3/1024.db", 150);
	iteration_test("testdata/nsec3/2048.db", 500);
	iteration_test("testdata/nsec3/4096.db", 2500);
	iteration_test("testdata/nsec3/min-1024.db", 150);
	iteration_test("testdata/nsec3/min-2048.db", 500);

	dns_test_end();
}
开发者ID:crossbuild,项目名称:bind,代码行数:16,代码来源:nsec3_test.c

示例14: ATF_TC_BODY

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();

	build_name_from_str(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();
}
开发者ID:fatman2021,项目名称:netbsd-src,代码行数:46,代码来源:rbt_test.c

示例15: ATF_TC_BODY

ATF_TC_BODY (zonemgr_managezone, tc)
{
    dns_zonemgr_t *zonemgr = NULL;

    dns_zone_t *zone = NULL;

    isc_result_t result;

    UNUSED (tc);

    result = dns_test_begin (NULL, ISC_TRUE);
    ATF_REQUIRE_EQ (result, ISC_R_SUCCESS);

    result = dns_zonemgr_create (mctx, taskmgr, timermgr, socketmgr, &zonemgr);
    ATF_REQUIRE_EQ (result, ISC_R_SUCCESS);

    result = make_zone ("foo", &zone);
    ATF_REQUIRE_EQ (result, ISC_R_SUCCESS);

    /* This should not succeed until the dns_zonemgr_setsize() is run */
    result = dns_zonemgr_managezone (zonemgr, zone);
    ATF_REQUIRE_EQ (result, ISC_R_FAILURE);

    ATF_REQUIRE_EQ (dns_zonemgr_getcount (zonemgr, DNS_ZONESTATE_ANY), 0);

    result = dns_zonemgr_setsize (zonemgr, 1);
    ATF_REQUIRE_EQ (result, ISC_R_SUCCESS);

    /* Now it should succeed */
    result = dns_zonemgr_managezone (zonemgr, zone);
    ATF_REQUIRE_EQ (result, ISC_R_SUCCESS);

    ATF_REQUIRE_EQ (dns_zonemgr_getcount (zonemgr, DNS_ZONESTATE_ANY), 1);

    dns_zonemgr_releasezone (zonemgr, zone);
    dns_zone_detach (&zone);

    ATF_REQUIRE_EQ (dns_zonemgr_getcount (zonemgr, DNS_ZONESTATE_ANY), 0);

    dns_zonemgr_shutdown (zonemgr);
    dns_zonemgr_detach (&zonemgr);
    ATF_REQUIRE_EQ (zonemgr, NULL);

    dns_test_end ();
}
开发者ID:274914765,项目名称:C,代码行数:45,代码来源:zonemgr_test.c


注:本文中的dns_test_begin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。