summaryrefslogtreecommitdiff
path: root/auto_tests/bootstrap_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-02-05 16:11:49 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-02-08 14:57:34 +0000
commit8a0e98bab8a4bccd11adc0e2c838910ed1b6d794 (patch)
tree09e6cab043b303a26829521914d8b5d1e15df846 /auto_tests/bootstrap_test.c
parent36ba80aacb2a582854f0e5e3ed0d69ca63db52ea (diff)
Fix LAN discovery on FreeBSD.
Also, add an auto-test for bootstrap and for LAN discovery. Bootstrap is never tested otherwise, and LAN discovery is a prerequisite for everything else. Having these two tests lets us rule out or identify LAN discovery as a possible cause for test failures.
Diffstat (limited to 'auto_tests/bootstrap_test.c')
-rw-r--r--auto_tests/bootstrap_test.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/auto_tests/bootstrap_test.c b/auto_tests/bootstrap_test.c
new file mode 100644
index 00000000..488bd48e
--- /dev/null
+++ b/auto_tests/bootstrap_test.c
@@ -0,0 +1,34 @@
1#ifndef _XOPEN_SOURCE
2#define _XOPEN_SOURCE 600
3#endif
4
5#include "helpers.h"
6
7static uint8_t const key[] = {
8 0xF4, 0x04, 0xAB, 0xAA, 0x1C, 0x99, 0xA9, 0xD3,
9 0x7D, 0x61, 0xAB, 0x54, 0x89, 0x8F, 0x56, 0x79,
10 0x3E, 0x1D, 0xEF, 0x8B, 0xD4, 0x6B, 0x10, 0x38,
11 0xB9, 0xD8, 0x22, 0xE8, 0x46, 0x0F, 0xAB, 0x67,
12};
13
14int main(void)
15{
16 Tox *tox = tox_new_log(nullptr, nullptr, nullptr);
17
18 tox_bootstrap(tox, "node.tox.biribiri.org", 33445, key, nullptr);
19
20 printf("Waiting for connection");
21
22 while (tox_self_get_connection_status(tox) == TOX_CONNECTION_NONE) {
23 printf(".");
24 fflush(stdout);
25
26 tox_iterate(tox, nullptr);
27 c_sleep(1000);
28 }
29
30 printf("Connection: %d\n", tox_self_get_connection_status(tox));
31
32 tox_kill(tox);
33 return 0;
34}