diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-10-06 20:56:38 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-10-06 21:27:02 +0000 |
commit | b2b96b1aa19ef2eb2816303e606a3f23550538dc (patch) | |
tree | 57468b25458f50cf74dd8a5a138d576053b01995 /auto_tests | |
parent | c7365b14f31926b6fd95e0efe9e8fefbbf265d24 (diff) |
Avoid use of IPv6 in tests if not supported (e.g. on Travis).
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/network_test.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/auto_tests/network_test.c b/auto_tests/network_test.c index 7cfba1c0..391d6ff0 100644 --- a/auto_tests/network_test.c +++ b/auto_tests/network_test.c | |||
@@ -25,7 +25,6 @@ START_TEST(test_addr_resolv_localhost) | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | const char localhost[] = "localhost"; | 27 | const char localhost[] = "localhost"; |
28 | int localhost_split = 0; | ||
29 | 28 | ||
30 | IP ip; | 29 | IP ip; |
31 | ip_init(&ip, 0); // ipv6enabled = 0 | 30 | ip_init(&ip, 0); // ipv6enabled = 0 |
@@ -46,6 +45,10 @@ START_TEST(test_addr_resolv_localhost) | |||
46 | ip_init(&ip, 1); // ipv6enabled = 1 | 45 | ip_init(&ip, 1); // ipv6enabled = 1 |
47 | res = addr_resolve(localhost, &ip, nullptr); | 46 | res = addr_resolve(localhost, &ip, nullptr); |
48 | 47 | ||
48 | #if USE_IPV6 | ||
49 | |||
50 | int localhost_split = 0; | ||
51 | |||
49 | if (!(res & TOX_ADDR_RESOLVE_INET6)) { | 52 | if (!(res & TOX_ADDR_RESOLVE_INET6)) { |
50 | res = addr_resolve("ip6-localhost", &ip, nullptr); | 53 | res = addr_resolve("ip6-localhost", &ip, nullptr); |
51 | localhost_split = 1; | 54 | localhost_split = 1; |
@@ -67,6 +70,8 @@ START_TEST(test_addr_resolv_localhost) | |||
67 | return; | 70 | return; |
68 | } | 71 | } |
69 | 72 | ||
73 | #endif | ||
74 | |||
70 | ip_init(&ip, 1); // ipv6enabled = 1 | 75 | ip_init(&ip, 1); // ipv6enabled = 1 |
71 | ip.family = net_family_unspec; | 76 | ip.family = net_family_unspec; |
72 | IP extra; | 77 | IP extra; |