From caa45673ec8ee702d31a762fd7486257c6d56ccf Mon Sep 17 00:00:00 2001 From: "Gregory Mullen (grayhatter)" Date: Mon, 11 Jul 2016 16:14:35 -0700 Subject: [PATCH] fix auto_tests on travis closes #9 --- .travis.yml | 12 +++--------- auto_tests/tox_test.c | 29 +++++++++++++++++++++++------ other/apidsl/README.md | 4 ++-- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index ca202b6261..58a4bfa789 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 648230f03c..f4ae61d484 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c @@ -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 @@ -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) { @@ -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"); } { @@ -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"); } { @@ -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; } diff --git a/other/apidsl/README.md b/other/apidsl/README.md index 3c194df531..3ba4467833 100644 --- a/other/apidsl/README.md +++ b/other/apidsl/README.md @@ -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 ``` @@ -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.** \ No newline at end of file +**Always pass output from ``apidsl`` through astyle.**