diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-10-03 08:57:14 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-10-04 08:03:19 -0400 |
commit | fdfb4b196b7c38f45f2d37f73fcc96d746816cc3 (patch) | |
tree | 55083aa1c31c9234f860f7a88c8f981ee75ef534 /src/test/test_addr.c | |
parent | 4a0749596cc21198dd853bb0c631e9658db7fe2d (diff) | |
download | tor-fdfb4b196b7c38f45f2d37f73fcc96d746816cc3.tar.gz tor-fdfb4b196b7c38f45f2d37f73fcc96d746816cc3.zip |
Use {mock,unmock}_hostname_resolver() in relevant tests
These tests all invoke the hostname resolver in one way or another,
and therefore potentially block if our DNS server is missing,
absent, or extremely slow. Closes ticket 31841.
Diffstat (limited to 'src/test/test_addr.c')
-rw-r--r-- | src/test/test_addr.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/test_addr.c b/src/test/test_addr.c index f99e3be8f5..c89c6e78d4 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -12,6 +12,7 @@ #include "test/log_test_helpers.h" #include "lib/net/resolve.h" #include "test/rng_test_helpers.h" +#include "test/resolve_test_helpers.h" #ifdef HAVE_SYS_UN_H #include <sys/un.h> @@ -1160,6 +1161,7 @@ test_addr_parse_canonical(void *arg) static void test_addr_parse(void *arg) { + int r; tor_addr_t addr; uint16_t port; @@ -1169,6 +1171,8 @@ test_addr_parse(void *arg) (void)arg; + mock_hostname_resolver(); + /* IPv6-mapped IPv4 addresses. Tor doesn't really use these. */ TEST_ADDR_V6_PARSE("11:22:33:44:55:66:1.2.3.4", 0, "11:22:33:44:55:66:102:304"); @@ -1273,7 +1277,7 @@ test_addr_parse(void *arg) "11:22::88",99); done: - ; + unmock_hostname_resolver(); } static void |