test/dns: regression for empty hostname

Refs: #332
This commit is contained in:
Azat Khuzhin 2016-03-25 00:21:06 +03:00
parent d49a65879f
commit d7348bab60

View File

@ -593,6 +593,26 @@ end:
regress_clean_dnsserver();
}
static void
dns_search_empty_test(void *arg)
{
struct basic_test_data *data = arg;
struct event_base *base = data->base;
struct evdns_base *dns = NULL;
dns = evdns_base_new(base, 0);
evdns_base_search_add(dns, "whatever.example.com");
n_replies_left = 1;
exit_base = base;
tt_ptr_op(evdns_base_resolve_ipv4(dns, "", 0, generic_dns_callback, NULL), ==, NULL);
end:
if (dns)
evdns_base_free(dns, 0);
}
static void
dns_search_test(void *arg)
{
return dns_search_test_impl(arg, 0);
@ -2104,6 +2124,7 @@ struct testcase_t dns_testcases[] = {
DNS_LEGACY(gethostbyname6, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
DNS_LEGACY(gethostbyaddr, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
{ "resolve_reverse", dns_resolve_reverse, TT_FORK|TT_OFF_BY_DEFAULT, NULL, NULL },
{ "search_empty", dns_search_empty_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
{ "search", dns_search_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
{ "search_lower", dns_search_lower_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
{ "search_cancel", dns_search_cancel_test,