diff --git a/CMakeLists.txt b/CMakeLists.txt index 715160cf..cd05ad70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -515,10 +515,6 @@ auto_test(tox_one) auto_test(tox_strncasecmp) auto_test(typing) auto_test(version) -# TODO(iphydf): These tests are broken. The code needs to be fixed, as the -# tests themselves are correct. -auto_test(selfname_change_conference DONT_RUN) -auto_test(self_conference_title_change DONT_RUN) if(BUILD_TOXAV) auto_test(toxav_basic) diff --git a/auto_tests/BUILD.bazel b/auto_tests/BUILD.bazel index af8920b1..7b0cab7d 100644 --- a/auto_tests/BUILD.bazel +++ b/auto_tests/BUILD.bazel @@ -33,7 +33,7 @@ cc_library( cc_test( name = "monolith_test", size = "small", - srcs = ["monolith_test.cpp"], + srcs = ["monolith_test.cc"], copts = ["-Wno-sign-compare"], deps = [ ":helpers", diff --git a/auto_tests/monolith_test.cc b/auto_tests/monolith_test.cc index 9fa7ee26..d89c7625 100644 --- a/auto_tests/monolith_test.cc +++ b/auto_tests/monolith_test.cc @@ -89,14 +89,6 @@ namespace save_load_test { int main(void); #include "save_load_test.c" } // namespace save_load_test -namespace selfname_change_conference_test { -int main(void); -#include "selfname_change_conference_test.c" -} // namespace selfname_change_conference_test -namespace self_conference_title_change_test { -int main(void); -#include "self_conference_title_change_test.c" -} // namespace self_conference_title_change_test namespace send_message_test { int main(void); #include "send_message_test.c" diff --git a/auto_tests/self_conference_title_change_test.c b/auto_tests/self_conference_title_change_test.c deleted file mode 100644 index 706c1338..00000000 --- a/auto_tests/self_conference_title_change_test.c +++ /dev/null @@ -1,88 +0,0 @@ -/* self_conference_title_change.c - * - * Small test for checking if obtaining savedata, saving it to disk and using - * works correctly. - * - * Copyright (C) 2017 Tox project All Rights Reserved. - * - * This file is part of Tox. - * - * Tox is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Tox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Tox. If not, see . - * - */ -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 600 -#endif - -#include -#include -#include -#include - -#include "../toxcore/tox.h" -#include "../toxencryptsave/toxencryptsave.h" - -#include "helpers.h" - -static const char *newtitle = "kitten over darknet"; - -static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_number, const uint8_t *title, - size_t length, void *user_data) -{ - if (!memcmp(title, newtitle, tox_conference_get_title_size(tox, conference_number, nullptr))) { - printf("success: title was changed and updated in the conference"); - exit(0); - } -} - -int main(void) -{ - setvbuf(stdout, nullptr, _IONBF, 0); - - uint32_t conference_number; - struct Tox_Options *to = tox_options_new(nullptr); - Tox *t; - TOX_ERR_CONFERENCE_NEW conference_err; - TOX_ERR_CONFERENCE_TITLE title_err; - - t = tox_new_log(to, nullptr, nullptr); - tox_options_free(to); - - tox_callback_conference_title(t, &cbtitlechange); - - if ((conference_number = tox_conference_new(t, &conference_err)) == UINT32_MAX) { - tox_kill(t); - fprintf(stderr, "error: could not create new conference, error code %d\n", conference_err); - return 2; - } - - tox_iterate(t, nullptr); - c_sleep(tox_iteration_interval(t)); - - if (!tox_conference_set_title(t, conference_number, (const uint8_t *)newtitle, strlen(newtitle), &title_err)) { - tox_kill(t); - fprintf(stderr, "error: could not set conference title, error code %d\n", title_err); - return 3; - } - - tox_iterate(t, nullptr); - c_sleep(tox_iteration_interval(t)); - tox_iterate(t, nullptr); - - fprintf(stderr, "error: title was not changed in callback. exiting.\n"); - - tox_kill(t); - - return 1; -} diff --git a/auto_tests/selfname_change_conference_test.c b/auto_tests/selfname_change_conference_test.c deleted file mode 100644 index dadfbeb6..00000000 --- a/auto_tests/selfname_change_conference_test.c +++ /dev/null @@ -1,94 +0,0 @@ -/* selfname_change_conference_test.c - * - * Small test for checking if obtaining savedata, saving it to disk and using - * works correctly. - * - * Copyright (C) 2017 Tox project All Rights Reserved. - * - * This file is part of Tox. - * - * Tox is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Tox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Tox. If not, see . - * - */ -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 600 -#endif - -#include -#include -#include -#include - -#include "helpers.h" - -#include "../toxcore/tox.h" -#include "../toxencryptsave/toxencryptsave.h" - -static const char *newname = "chris"; - -static void cbconfmembers(Tox *tox, uint32_t conference_number, uint32_t peer_number, - const uint8_t *name, size_t length, - void *user_data) -{ - uint8_t new_peer_name[TOX_MAX_NAME_LENGTH + 1]; - - if (!tox_conference_peer_get_name(tox, conference_number, peer_number, new_peer_name, nullptr)) { - return; - } - - if (!memcmp(newname, new_peer_name, tox_conference_peer_get_name_size(tox, conference_number, peer_number, nullptr))) { - printf("success: own name was changed and updated in the conference"); - exit(0); - } -} - -int main(void) -{ - setvbuf(stdout, nullptr, _IONBF, 0); - - struct Tox_Options *to = tox_options_new(nullptr); - Tox *t; - TOX_ERR_CONFERENCE_NEW conference_err; - TOX_ERR_SET_INFO name_err; - - t = tox_new_log(to, nullptr, nullptr); - tox_options_free(to); - - tox_callback_conference_peer_name(t, cbconfmembers); - - if (tox_conference_new(t, &conference_err) == UINT32_MAX) { - tox_kill(t); - fprintf(stderr, "error: could not create new conference, error code %d\n", conference_err); - return 2; - } - - tox_iterate(t, nullptr); - c_sleep(tox_iteration_interval(t)); - - if (!tox_self_set_name(t, (const uint8_t *)newname, strlen(newname), &name_err)) { - tox_kill(t); - fprintf(stderr, "error: could not set own name, error code %d\n", name_err); - return 3; - } - - tox_iterate(t, nullptr); - c_sleep(tox_iteration_interval(t)); - tox_iterate(t, nullptr); - - fprintf(stderr, "error: name was not changed in callback. exiting.\n"); - - tox_kill(t); - - return 1; -} diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index 075f00d1..117eb69d 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel @@ -30,6 +30,10 @@ cc_binary( cc_binary( name = "av_test", srcs = ["av_test.c"], + # We must always optimise this program, because otherwise GCC won't inline + # cvArcLength but also not emit it out of line, resulting in undefined + # reference errors. + copts = ["-O1"], deps = [ "//c-toxcore/toxav", "//c-toxcore/toxav:monolith",