summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-11-07 04:30:28 +0000
committerNick Mathewson <nickm@torproject.org>2007-11-07 04:30:28 +0000
commit5347de42cc835b934bd61d4a713d8924242754ea (patch)
tree0d096f6d9a72c95c40038afcfd778fbed7a5be48
parent30583dd07eaf88d34991c295af88c35e702e8351 (diff)
downloadlibevent-5347de42cc835b934bd61d4a713d8924242754ea.tar.gz
r16494@catbus: nickm | 2007-11-06 23:29:11 -0500
Backport: Fix unit tests so that an outdated nameserver means "Skip IPv6 tests", not "Abort." svn:r488
-rw-r--r--ChangeLog1
-rw-r--r--test/regress_dns.c17
2 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c535f9c2..162632b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ Changes since 1.3e:
o Fix evhttp.h compilation when TAILQ_ENTRY is not defined.
o Fix buffer overrun in evdns_resolve_reverse_ipv6 (backported)
o Increase the maximum number of addresses read from a packet in evdns to 32.
+ o Fix DNS unit tests so that having a DNS server with broken IPv6 support is no longer cause for aborting the unit tests.
Changes since 1.3d:
o demote most http warnings to debug messages
diff --git a/test/regress_dns.c b/test/regress_dns.c
index 35313b53..f33ac42e 100644
--- a/test/regress_dns.c
+++ b/test/regress_dns.c
@@ -62,15 +62,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);
@@ -146,8 +155,10 @@ dns_gethostbyname6()
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);
}
}