t_resolver.c revision c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840e
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley/*
69fe9aaafdd6a141610e86a777d325db75422070Mark Andrews * Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC")
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington *
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and/or distribute this software for any
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley * purpose with or without fee is hereby granted, provided that the above
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley * copyright notice and this permission notice appear in all copies.
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley *
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews */
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley/* $Id: t_resolver.c,v 1.3 2011/02/03 12:18:11 tbox Exp $ */
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence#include <config.h>
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#include <ctype.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#include <stdlib.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#include <isc/mem.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#include <isc/util.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#include <isc/string.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#include <isc/timer.h>
142784f574e0b63e8bbcccb762eb8727ac7c76feBrian Wellington#include <isc/task.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#include <dns/dispatch.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#include <dns/resolver.h>
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews#include <dns/result.h>
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews#include <dns/view.h>
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafsson
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#include <tests/t_api.h>
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleychar *progname;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#define CHECK(x) RUNTIME_CHECK(ISC_R_SUCCESS == (x))
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
558ab0f6a8046499bfe3e39ea4789036313b72b3Michael Graff
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleyisc_mem_t *mctx = NULL;
de4ef688d73a449d4c1218adbb35a4f70a71e672Brian Wellingtonisc_timermgr_t *timer_manager = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleyisc_socketmgr_t *socket_manager = NULL;
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrenceisc_taskmgr_t *task_manager = NULL;
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrencedns_dispatchmgr_t *dispatch_manager = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleydns_view_t *view = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleydns_dispatch_t *dispatch_v4 = NULL;
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafssonstatic void
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleysetup_create_dispatch_v4(void)
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley{
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley isc_sockaddr_t local_address;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley isc_sockaddr_any(&local_address);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley CHECK(dns_dispatch_getudp(dispatch_manager, socket_manager,
6af51ff1a30dd977c4fc6c342a0661bb4f6501a5Bob Halley task_manager, &local_address,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley 4096, 100, 100, 100, 500, 0, 0,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley &dispatch_v4));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleystatic void
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleysetup(void) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 1 */ CHECK(isc_mem_create(0, 0, &mctx));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 2 */ CHECK(isc_timermgr_create(mctx, &timer_manager));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 3 */ CHECK(isc_taskmgr_create(mctx, 1, 0, &task_manager));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 4 */ CHECK(isc_socketmgr_create(mctx, &socket_manager));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 5 */ CHECK(dns_dispatchmgr_create(mctx, NULL, &dispatch_manager));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 6 */ CHECK(dns_view_create(mctx, dns_rdataclass_in, "testview", &view));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 7 */ setup_create_dispatch_v4();
6af51ff1a30dd977c4fc6c342a0661bb4f6501a5Bob Halley}
c90f5e8d1edbd5c277f2ee320167a12a30ba7c7bMichael Graff
6af51ff1a30dd977c4fc6c342a0661bb4f6501a5Bob Halleystatic void
c90f5e8d1edbd5c277f2ee320167a12a30ba7c7bMichael Graffteardown(void) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 7 */ dns_dispatch_detach(&dispatch_v4);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 6 */ dns_view_detach(&view);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 5 */ dns_dispatchmgr_destroy(&dispatch_manager);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 4 */ isc_socketmgr_destroy(&socket_manager);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 3 */ isc_taskmgr_destroy(&task_manager);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 2 */ isc_timermgr_destroy(&timer_manager);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley /* 1 */ isc_mem_destroy(&mctx);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
6af51ff1a30dd977c4fc6c342a0661bb4f6501a5Bob Halleystatic isc_result_t
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleymake_resolver(dns_resolver_t **resolverp) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley isc_result_t result;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley result = dns_resolver_create(view,
6af51ff1a30dd977c4fc6c342a0661bb4f6501a5Bob Halley task_manager, 1, 1,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley socket_manager,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley timer_manager,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley 0, /* unsigned int options, */
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dispatch_manager,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dispatch_v4,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley NULL, /* dns_dispatch_t *dispatchv6, */
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley resolverp);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley return (result);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafssonstatic void
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafssondestroy_resolver(dns_resolver_t **resolverp) {
315879710704bbcf66df301664cd90df8ad31265David Lawrence dns_resolver_shutdown(*resolverp);
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafsson dns_resolver_detach(resolverp);
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafsson}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleystatic void
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleytest_dns_resolver_create() {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_t *resolver = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
e605e98f3e4be079f545b26bb53ba02a6d04b0b6Andreas Gustafsson t_assert("test_dns_resolver_create", 1, T_REQUIRED, "%s",
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley "a resolver can be created successfully");
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafsson setup();
bfa633fc0e5dea8f65676c5393993ba7053a9899Andreas Gustafsson CHECK(make_resolver(&resolver));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley destroy_resolver(&resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley teardown();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_result(T_PASS);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleystatic void
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleytest_dns_resolver_gettimeout(void) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_t *resolver = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley int test_result;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley unsigned int timeout;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_assert("test_dns_resolver_gettimeout", 1, T_REQUIRED, "%s",
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews "The default timeout is returned from _gettimeout()");
315879710704bbcf66df301664cd90df8ad31265David Lawrence setup();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley CHECK(make_resolver(&resolver));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley timeout = dns_resolver_gettimeout(resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_info("The default timeout is %d second%s\n", timeout, (timeout == 1 ? "" : "s"));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley test_result = (timeout > 0) ? T_PASS : T_FAIL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley destroy_resolver(&resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley teardown();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_result(test_result);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleystatic void
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleytest_dns_resolver_settimeout(void) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_t *resolver = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley int test_result;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley unsigned int default_timeout, timeout;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_assert("test_dns_resolver_settimeout", 1, T_REQUIRED, "%s",
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley "_settimeout() can change the timeout to a non-default");
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley setup();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley CHECK(make_resolver(&resolver));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley default_timeout = dns_resolver_gettimeout(resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_info("The default timeout is %d second%s\n", default_timeout,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley (default_timeout == 1 ? "" : "s"));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_settimeout(resolver, default_timeout + 1);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley timeout = dns_resolver_gettimeout(resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_info("The new timeout is %d second%s\n", timeout,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley (timeout == 1 ? "" : "s"));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley test_result = (timeout == default_timeout + 1) ? T_PASS : T_FAIL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley destroy_resolver(&resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley teardown();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_result(test_result);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleystatic void
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleytest_dns_resolver_settimeout_to_default(void) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_t *resolver = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley int test_result;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley unsigned int default_timeout, timeout;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff t_assert("test_dns_resolver_settimeout_to_default", 1, T_REQUIRED, "%s",
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley "_settimeout() can change the timeout back to a default value"
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley " by specifying 0 as the timeout.");
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley setup();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley CHECK(make_resolver(&resolver));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley default_timeout = dns_resolver_gettimeout(resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_info("The default timeout is %d second%s\n", default_timeout,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley (default_timeout == 1 ? "" : "s"));
808af432356c7592e80bd41416eca61e7bc8791dBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_settimeout(resolver, default_timeout - 1);
808af432356c7592e80bd41416eca61e7bc8791dBob Halley timeout = dns_resolver_gettimeout(resolver);
808af432356c7592e80bd41416eca61e7bc8791dBob Halley t_info("The new timeout is %d second%s\n", timeout,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley (timeout == 1 ? "" : "s"));
808af432356c7592e80bd41416eca61e7bc8791dBob Halley
808af432356c7592e80bd41416eca61e7bc8791dBob Halley dns_resolver_settimeout(resolver, 0);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley timeout = dns_resolver_gettimeout(resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley test_result = (timeout == default_timeout) ? T_PASS : T_FAIL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley destroy_resolver(&resolver);
95b41befcb9e75df2b451ceeb9f8812ccedcc25fAndreas Gustafsson teardown();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_result(test_result);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleystatic void
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleytest_dns_resolver_settimeout_over_maximum(void) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_t *resolver = NULL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley int test_result;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley unsigned int timeout;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_assert("test_dns_resolver_settimeout_over_maximum", 1, T_REQUIRED, "%s",
558ab0f6a8046499bfe3e39ea4789036313b72b3Michael Graff "_settimeout() cannot set the value larger than the maximum.");
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley setup();
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley CHECK(make_resolver(&resolver));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley dns_resolver_settimeout(resolver, 4000000);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley timeout = dns_resolver_gettimeout(resolver);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_info("The new timeout is %d second%s\n", timeout,
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley (timeout == 1 ? "" : "s"));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley test_result = (timeout < 4000000 && timeout > 0) ? T_PASS : T_FAIL;
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews destroy_resolver(&resolver);
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews teardown();
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews
9297259c7abecc78470fdeca173c101137e4b5bbMark Andrews t_result(test_result);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleytestspec_t T_testlist[] = {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley { (PFV) test_dns_resolver_create, "dns_resolver_create" },
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley { (PFV) test_dns_resolver_settimeout, "dns_resolver_settimeout" },
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley { (PFV) test_dns_resolver_gettimeout, "dns_resolver_gettimeout" },
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley { (PFV) test_dns_resolver_settimeout_to_default, "test_dns_resolver_settimeout_to_default" },
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley { (PFV) test_dns_resolver_settimeout_over_maximum, "test_dns_resolver_settimeout_over_maximum" },
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley { (PFV) 0, NULL }
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley};
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#ifdef WIN32
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleyint
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halleymain(int argc, char **argv) {
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley t_settests(T_testlist);
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley return (t_main(argc, argv));
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley}
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley#endif
99a9539ccde4a3769fd890bdae5bcce3a3492fbaBob Halley