|
14 | 14 | #include "auto_test_support.h" |
15 | 15 | #include "check_compat.h" |
16 | 16 |
|
17 | | -/* The Travis-CI container responds poorly to ::1 as a localhost address |
18 | | - * You're encouraged to -D FORCE_TESTS_IPV6 on a local test */ |
| 17 | +#ifndef USE_IPV6 |
| 18 | +#define USE_IPV6 1 |
| 19 | +#endif |
| 20 | + |
19 | 21 | #ifdef TOX_LOCALHOST |
20 | 22 | #undef TOX_LOCALHOST |
21 | 23 | #endif |
22 | | -#ifdef FORCE_TESTS_IPV6 |
| 24 | +#if USE_IPV6 |
23 | 25 | #define TOX_LOCALHOST "::1" |
24 | 26 | #else |
25 | 27 | #define TOX_LOCALHOST "127.0.0.1" |
@@ -74,6 +76,7 @@ static void reload_tox(Tox **tox, struct Tox_Options *const in_opts, void *user_ |
74 | 76 | } |
75 | 77 |
|
76 | 78 | struct Tox_Options *const options = (in_opts == nullptr) ? tox_options_new(nullptr) : in_opts; |
| 79 | + tox_options_set_ipv6_enabled(options, USE_IPV6); |
77 | 80 |
|
78 | 81 | tox_options_set_savedata_type(options, TOX_SAVEDATA_TYPE_TOX_SAVE); |
79 | 82 |
|
@@ -138,19 +141,22 @@ static void test_few_clients(void) |
138 | 141 | time_t con_time = 0, cur_time = time(nullptr); |
139 | 142 |
|
140 | 143 | struct Tox_Options *opts1 = tox_options_new(nullptr); |
| 144 | + tox_options_set_ipv6_enabled(opts1, USE_IPV6); |
141 | 145 | tox_options_set_tcp_port(opts1, TCP_RELAY_PORT); |
142 | 146 | Tox_Err_New t_n_error; |
143 | 147 | Tox *tox1 = tox_new_log(opts1, &t_n_error, &index[0]); |
144 | 148 | ck_assert_msg(t_n_error == TOX_ERR_NEW_OK, "Failed to create tox instance: %d", t_n_error); |
145 | 149 | tox_options_free(opts1); |
146 | 150 |
|
147 | 151 | struct Tox_Options *opts2 = tox_options_new(nullptr); |
| 152 | + tox_options_set_ipv6_enabled(opts2, USE_IPV6); |
148 | 153 | tox_options_set_udp_enabled(opts2, false); |
149 | 154 | tox_options_set_local_discovery_enabled(opts2, false); |
150 | 155 | Tox *tox2 = tox_new_log(opts2, &t_n_error, &index[1]); |
151 | 156 | ck_assert_msg(t_n_error == TOX_ERR_NEW_OK, "Failed to create tox instance: %d", t_n_error); |
152 | 157 |
|
153 | 158 | struct Tox_Options *opts3 = tox_options_new(nullptr); |
| 159 | + tox_options_set_ipv6_enabled(opts3, USE_IPV6); |
154 | 160 | tox_options_set_local_discovery_enabled(opts3, false); |
155 | 161 | Tox *tox3 = tox_new_log(opts3, &t_n_error, &index[2]); |
156 | 162 | ck_assert_msg(t_n_error == TOX_ERR_NEW_OK, "Failed to create tox instance: %d", t_n_error); |
|
0 commit comments