Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,18 @@ endif()

option(AUTOTEST "Enable autotests (mainly for CI)" OFF)

if(AUTOTEST)
add_library(run_auto_test
auto_tests/run_auto_test.c
auto_tests/run_auto_test.h)
target_link_modules(run_auto_test toxcore misc_tools)
endif()

function(auto_test target)
if(AUTOTEST AND NOT (MSVC AND ARGV1 STREQUAL "MSVC_DONT_BUILD"))
add_executable(auto_${target}_test ${CPUFEATURES}
auto_tests/${target}_test.c)
target_link_modules(auto_${target}_test toxcore misc_tools)
target_link_modules(auto_${target}_test toxcore misc_tools run_auto_test)
if(NOT ARGV1 STREQUAL "DONT_RUN")
add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} auto_${target}_test)
set_tests_properties(${target} PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}")
Expand Down Expand Up @@ -444,6 +451,7 @@ auto_test(send_message)
auto_test(set_name)
auto_test(set_status_message)
auto_test(skeleton)
auto_test(tcp_backup)
auto_test(tox_many)
auto_test(tox_many_tcp)
auto_test(tox_one)
Expand Down
7 changes: 6 additions & 1 deletion auto_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ cc_library(

cc_library(
name = "run_auto_test",
testonly = True,
srcs = ["run_auto_test.c"],
hdrs = ["run_auto_test.h"],
deps = [
":check_compat",
"//c-toxcore/testing:misc_tools",
"//c-toxcore/toxcore",
],
)

flaky_tests = {
Expand Down
10 changes: 9 additions & 1 deletion auto_tests/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
if BUILD_TESTS

noinst_LTLIBRARIES += librun_auto_test.la
librun_auto_test_la_SOURCES = ../auto_tests/run_auto_test.c ../auto_tests/run_auto_test.h

TESTS = \
bootstrap_test \
conference_double_invite_test \
Expand Down Expand Up @@ -33,6 +36,7 @@ TESTS = \
set_name_test \
set_status_message_test \
skeleton_test \
tcp_backup_test \
TCP_test \
tcp_relay_test \
tox_many_tcp_test \
Expand All @@ -50,13 +54,13 @@ AUTOTEST_LDADD = \
$(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
libmisc_tools.la \
librun_auto_test.la \
libtoxcore.la \
libtoxencryptsave.la \
$(LIBSODIUM_LIBS) \
$(NACL_OBJECTS) \
$(NACL_LIBS)


if BUILD_AV
TESTS += conference_av_test toxav_basic_test toxav_many_test
AUTOTEST_LDADD += libtoxav.la
Expand Down Expand Up @@ -196,6 +200,10 @@ tcp_relay_test_SOURCES = ../auto_tests/tcp_relay_test.c
tcp_relay_test_CFLAGS = $(AUTOTEST_CFLAGS)
tcp_relay_test_LDADD = $(AUTOTEST_LDADD)

tox_many_tcp_test_SOURCES = ../auto_tests/tcp_backup_test.c
tox_many_tcp_test_CFLAGS = $(AUTOTEST_CFLAGS)
tox_many_tcp_test_LDADD = $(AUTOTEST_LDADD)

TCP_test_SOURCES = ../auto_tests/TCP_test.c
TCP_test_CFLAGS = $(AUTOTEST_CFLAGS)
TCP_test_LDADD = $(AUTOTEST_LDADD)
Expand Down
Loading