toxcore/auto_tests/bootstrap_test.c
jfreegman 10d59d610b
Refactor autotest live network bootstrapping
- Use one node list and public bootstrap function for all autotests
- Use ifdefs for testnet/mainnet nodes
- Replace a few broken nodes with working ones
2022-01-22 11:24:28 -05:00

42 lines
954 B
C

#include <stdio.h>
#include "../testing/misc_tools.h"
#include "check_compat.h"
typedef struct State {
uint32_t index;
uint64_t clock;
} State;
#include "run_auto_test.h"
int main(void)
{
setvbuf(stdout, nullptr, _IONBF, 0);
Tox *tox_udp = tox_new_log(nullptr, nullptr, nullptr);
bootstrap_toxes_live_network(&tox_udp, 1, false);
printf("Waiting for connection");
do {
printf(".");
fflush(stdout);
tox_iterate(tox_udp, nullptr);
c_sleep(ITERATION_INTERVAL);
} while (tox_self_get_connection_status(tox_udp) == TOX_CONNECTION_NONE);
const Tox_Connection status = tox_self_get_connection_status(tox_udp);
ck_assert_msg(status == TOX_CONNECTION_UDP,
"expected connection status to be UDP, but got %d", status);
printf("Connection (UDP): %d\n", tox_self_get_connection_status(tox_udp));
tox_kill(tox_udp);
(void)run_auto_test;
return 0;
}