Make dht_test more stable.

By making it run in a port range far away from other tests. This test
creates 100 DHTs and makes either itself or other tests run out of ports.
This commit is contained in:
iphydf 2018-06-17 23:41:42 +00:00
parent a725d73235
commit 16f5cc8c24
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -411,7 +411,7 @@ START_TEST(test_addto_lists_ipv6)
} }
END_TEST END_TEST
#define DHT_DEFAULT_PORT (TOX_PORT_DEFAULT + 20) #define DHT_DEFAULT_PORT (TOX_PORT_DEFAULT + 1000)
static void print_pk(uint8_t *public_key) static void print_pk(uint8_t *public_key)
{ {
@ -475,7 +475,8 @@ static void test_list_main(void)
dhts[i] = new_DHT(log, new_networking(log, ip, DHT_DEFAULT_PORT + i), true); dhts[i] = new_DHT(log, new_networking(log, ip, DHT_DEFAULT_PORT + i), true);
ck_assert_msg(dhts[i] != nullptr, "Failed to create dht instances %u", i); ck_assert_msg(dhts[i] != nullptr, "Failed to create dht instances %u", i);
ck_assert_msg(net_port(dhts[i]->net) != DHT_DEFAULT_PORT + i, "Bound to wrong port"); ck_assert_msg(net_port(dhts[i]->net) != DHT_DEFAULT_PORT + i,
"Bound to wrong port: %d", net_port(dhts[i]->net));
} }
for (j = 0; j < NUM_DHT; ++j) { for (j = 0; j < NUM_DHT; ++j) {