Skip to content

Commit

Permalink
fix auto_tests on travis
Browse files Browse the repository at this point in the history
closes #9
  • Loading branch information
Gregory Mullen (grayhatter) committed Jul 11, 2016
1 parent 7dab040 commit caa4567
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
12 changes: 3 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,12 @@ script:
--enable-ntox \
CFLAGS="-O0 -Wall -Wextra -fprofile-arcs -ftest-coverage"
- make
- make check || true
- make check
- if [ -f build/test-suite.log ]; then cat build/test-suite.log; fi
- make dist

after_script:
- coveralls --exclude auto_tests --exclude other --exclude testing --gcov-options '\-lp'

#notifications:
# email: false
#
# irc:
# channels:
# - "chat.freenode.net#tox-dev"
# on_success: always
# on_failure: always
notifications:
irc: "irc.freenode.net#toktok-status"
29 changes: 23 additions & 6 deletions auto_tests/tox_test.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/* Auto Tests
*
* Tox Tests
*
* These tests required that no other Tox clients are running/accessable at
* localhost. These test expect and the timeouts depend on the speed and size
* of a private Tox network, trying to connect to outside clients will increase
* the length of time each test will take. Often surpassing a reasonable timeout
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand All @@ -21,6 +31,12 @@
#define c_sleep(x) usleep(1000*x)
#endif

/* The travis container responds poorly to ::1 as a localhost address */
#ifdef FORCE_TESTS_IPV6
#define TOX_LOCALHOST "::1"
#else
#define TOX_LOCALHOST "127.0.0.1"
#endif

void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata)
{
Expand Down Expand Up @@ -924,8 +940,9 @@ START_TEST(test_many_clients_tcp)
tox_callback_friend_request(toxes[i], accept_friend_request, &to_comp);
uint8_t dpk[TOX_PUBLIC_KEY_SIZE];
tox_self_get_dht_id(toxes[0], dpk);
ck_assert_msg(tox_add_tcp_relay(toxes[i], "::1", TCP_RELAY_PORT, dpk, 0), "add relay error");
ck_assert_msg(tox_bootstrap(toxes[i], "::1", 33445, dpk, 0), "Bootstrap error");
TOX_ERR_BOOTSTRAP error = 0;
ck_assert_msg(tox_add_tcp_relay(toxes[i], TOX_LOCALHOST, TCP_RELAY_PORT, dpk, &error), "add relay error, %i, %i", i, error);
ck_assert_msg(tox_bootstrap(toxes[i], TOX_LOCALHOST, 33445, dpk, 0), "Bootstrap error");
}

{
Expand Down Expand Up @@ -1019,9 +1036,9 @@ START_TEST(test_many_clients_tcp_b)
tox_callback_friend_request(toxes[i], accept_friend_request, &to_comp);
uint8_t dpk[TOX_PUBLIC_KEY_SIZE];
tox_self_get_dht_id(toxes[(i % NUM_TCP_RELAYS)], dpk);
ck_assert_msg(tox_add_tcp_relay(toxes[i], "::1", TCP_RELAY_PORT + (i % NUM_TCP_RELAYS), dpk, 0), "add relay error");
ck_assert_msg(tox_add_tcp_relay(toxes[i], TOX_LOCALHOST, TCP_RELAY_PORT + (i % NUM_TCP_RELAYS), dpk, 0), "add relay error");
tox_self_get_dht_id(toxes[0], dpk);
ck_assert_msg(tox_bootstrap(toxes[i], "::1", 33445, dpk, 0), "Bootstrap error");
ck_assert_msg(tox_bootstrap(toxes[i], TOX_LOCALHOST, 33445, dpk, 0), "Bootstrap error");
}

{
Expand Down Expand Up @@ -1278,8 +1295,8 @@ Suite *tox_suite(void)
DEFTESTCASE(one);
DEFTESTCASE_SLOW(few_clients, 80);
DEFTESTCASE_SLOW(many_clients, 80);
DEFTESTCASE_SLOW(many_clients_tcp, 20);
DEFTESTCASE_SLOW(many_clients_tcp_b, 20);
DEFTESTCASE_SLOW(many_clients_tcp, 40);
DEFTESTCASE_SLOW(many_clients_tcp_b, 80);
DEFTESTCASE_SLOW(many_group, 100);
return s;
}
Expand Down
4 changes: 2 additions & 2 deletions other/apidsl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you want to do it quickly and you don't have time for anything other than cop
Command to run from ``toxcore`` directory (quick way, involves using curl):
```bash
rm toxcore/tox.h && \
( curl -X POST --data-binary @- https://criticism.herokuapp.com/apidsl < ./other/apidsl/tox.in.h > ./toxcore/tox.h ) && \
( curl -X POST --data-binary @- https://apidsl.herokuapp.com/apidsl < ./other/apidsl/tox.in.h > ./toxcore/tox.h ) && \
astyle --options=./other/astyle/astylerc ./toxcore/tox.h
```

Expand All @@ -46,4 +46,4 @@ If you prefer to have more control over what is happening, there are steps below
astyle --options=./other/astyle/astylerc ./toxcore/tox.h
```

**Always pass output from ``apidsl`` through astyle.**
**Always pass output from ``apidsl`` through astyle.**

0 comments on commit caa4567

Please sign in to comment.