]> granicus.if.org Git - libevent/commitdiff
r16492@catbus: nickm | 2007-11-06 23:27:32 -0500
authorNick Mathewson <nickm@torproject.org>
Wed, 7 Nov 2007 04:28:54 +0000 (04:28 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 7 Nov 2007 04:28:54 +0000 (04:28 +0000)
 Fix unit tests so that an outdated nameserver means "Skip IPv6 tests", not "Abort."

svn:r487

ChangeLog
test/regress_dns.c

index 294319ffdaf17cff82af9702f9e7b0e81876e2ff..a78429eda06ea1c3599a485b018219913944f905 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
\ No newline at end of file
+ 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.
+
index 1b14adc6332fd0d2b492e71e6aa241397ba47829..0161de0eb325272f41e097306c0eefd64f3e9d07 100644 (file)
 #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);
        }
 }