r16492@catbus: nickm | 2007-11-06 23:27:32 -0500

Fix unit tests so that an outdated nameserver means "Skip IPv6 tests", not "Abort."


svn:r487
This commit is contained in:
Nick Mathewson 2007-11-07 04:28:54 +00:00
parent 7c507668d7
commit bab0e6d440
2 changed files with 17 additions and 4 deletions

View File

@ -38,4 +38,6 @@ Changes in current version:
o Small code cleanups in epoll_dispatch().
o Increase the maximum number of addresses read from a packet in evdns to 32.
o Remove support for the rtsig method: it hasn't compiled for a while, and nobody seems to miss it very much. Let us know if there's a good reason to put it back in.
o Rename the "class" field in evdns_server_request to dns_question_class, so that it won't break compilation under C++. Use a macro so that old code won't break. Mark the macro as deprecated.
o Rename the "class" field in evdns_server_request to dns_question_class, so that it won't break compilation under C++. Use a macro so that old code won't break. Mark the macro as deprecated.
o Fix DNS unit tests so that having a DNS server with broken IPv6 support is no longer cause for aborting the unit tests.

View File

@ -64,15 +64,24 @@
#include "log.h"
static int dns_ok = 0;
static int dns_err = 0;
void
dns_gethostbyname_cb(int result, char type, int count, int ttl,
void *addresses, void *arg)
{
dns_ok = 0;
dns_ok = dns_err = 0;
if (result != DNS_ERR_NONE)
if (result == DNS_ERR_TIMEOUT) {
fprintf(stdout, "[Timed out] ");
dns_err = result;
goto out;
}
if (result != DNS_ERR_NONE) {
fprintf(stdout, "[Error code %d] ", result);
goto out;
}
fprintf(stderr, "type: %d, count: %d, ttl: %d: ", type, count, ttl);
@ -148,8 +157,10 @@ dns_gethostbyname6(void)
if (dns_ok == DNS_IPv6_AAAA) {
fprintf(stdout, "OK\n");
} else if (!dns_ok && dns_err == DNS_ERR_TIMEOUT) {
fprintf(stdout, "SKIPPED\n");
} else {
fprintf(stdout, "FAILED\n");
fprintf(stdout, "FAILED (%d)\n", dns_ok);
exit(1);
}
}