Add cmake option for building additional tests

Closes #1262
This commit is contained in:
zugz (tox) 2018-12-08 12:32:32 +01:00
parent 9770880e97
commit 0f8f82a3cf
No known key found for this signature in database
GPG Key ID: 6F2BDA289D04F249
3 changed files with 39 additions and 13 deletions

View File

@ -508,18 +508,21 @@ if(NOT WIN32
endif() endif()
endif() endif()
add_executable(DHT_test ${CPUFEATURES} option(BUILD_MISC_TESTS "Build additional tests" OFF)
if (BUILD_MISC_TESTS)
add_executable(DHT_test ${CPUFEATURES}
testing/DHT_test.c) testing/DHT_test.c)
target_link_modules(DHT_test toxcore misc_tools) target_link_modules(DHT_test toxcore misc_tools)
add_executable(Messenger_test ${CPUFEATURES} add_executable(Messenger_test ${CPUFEATURES}
testing/Messenger_test.c) testing/Messenger_test.c)
target_link_modules(Messenger_test toxcore misc_tools) target_link_modules(Messenger_test toxcore misc_tools)
add_executable(random_testing ${CPUFEATURES} add_executable(random_testing ${CPUFEATURES}
testing/random_testing.cc) testing/random_testing.cc)
target_link_modules(random_testing toxcore misc_tools) target_link_modules(random_testing toxcore misc_tools)
add_executable(save-generator add_executable(save-generator
other/fun/save-generator.c) other/fun/save-generator.c)
target_link_modules(save-generator toxcore misc_tools) target_link_modules(save-generator toxcore misc_tools)
endif()

View File

@ -83,8 +83,10 @@ There are some options that are available to configure the build.
| Name | Description | Expected Value | Default Value | | Name | Description | Expected Value | Default Value |
|------------------------|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|---------------------------------------------------| |------------------------|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|---------------------------------------------------|
| `AUTOTEST` | Enable autotests (mainly for CI). | ON or OFF | OFF |
| `BOOTSTRAP_DAEMON` | Enable building of tox-bootstrapd, the DHT bootstrap node daemon. For Unix-like systems only. | ON or OFF | ON | | `BOOTSTRAP_DAEMON` | Enable building of tox-bootstrapd, the DHT bootstrap node daemon. For Unix-like systems only. | ON or OFF | ON |
| `BUILD_AV_TEST` | Build toxav test. | ON or OFF | ON | | `BUILD_AV_TEST` | Build toxav test. | ON or OFF | ON |
| `BUILD_MISC_TESTS` | Build additional tests. | ON or OFF | OFF |
| `BUILD_TOXAV` | Whether to build the tox AV library. | ON or OFF | ON | | `BUILD_TOXAV` | Whether to build the tox AV library. | ON or OFF | ON |
| `CMAKE_INSTALL_PREFIX` | Path to where everything should be installed. | Directory path. | Platform-dependent. Refer to CMake documentation. | | `CMAKE_INSTALL_PREFIX` | Path to where everything should be installed. | Directory path. | Platform-dependent. Refer to CMake documentation. |
| `DHT_BOOTSTRAP` | Enable building of `DHT_bootstrap` | ON or OFF | ON | | `DHT_BOOTSTRAP` | Enable building of `DHT_bootstrap` | ON or OFF | ON |
@ -94,7 +96,6 @@ There are some options that are available to configure the build.
| `STRICT_ABI` | Enforce strict ABI export in dynamic libraries. | ON or OFF | OFF | | `STRICT_ABI` | Enforce strict ABI export in dynamic libraries. | ON or OFF | OFF |
| `TEST_TIMEOUT_SECONDS` | Limit runtime of each test to the number of seconds specified. | Positive number or nothing (empty string). | Empty string. | | `TEST_TIMEOUT_SECONDS` | Limit runtime of each test to the number of seconds specified. | Positive number or nothing (empty string). | Empty string. |
| `USE_IPV6` | Use IPv6 in tests. | ON or OFF | ON | | `USE_IPV6` | Use IPv6 in tests. | ON or OFF | ON |
| `AUTOTEST` | Enable autotests (mainly for CI). | ON or OFF | OFF |
You can get this list of option using the following commands You can get this list of option using the following commands

View File

@ -52,3 +52,25 @@ if(WIN32 OR APPLE)
# Windows and OSX don't have this linker functionality. # Windows and OSX don't have this linker functionality.
set(STRICT_ABI OFF) set(STRICT_ABI OFF)
endif() endif()
if(STRICT_ABI)
if(AUTOTEST)
message("AUTOTEST option is incompatible with STRICT_ABI. Disabling AUTOTEST.")
endif()
set(AUTOTEST OFF)
if(BUILD_MISC_TESTS)
message("BUILD_MISC_TESTS option is incompatible with STRICT_ABI. Disabling BUILD_MISC_TESTS.")
endif()
set(BUILD_MISC_TESTS OFF)
if(BOOTSTRAP_DAEMON)
message("BOOTSTRAP_DAEMON option is incompatible with STRICT_ABI. Disabling BOOTSTRAP_DAEMON.")
endif()
set(BOOTSTRAP_DAEMON OFF)
if(DHT_BOOTSTRAP)
message("DHT_BOOTSTRAP option is incompatible with STRICT_ABI. Disabling DHT_BOOTSTRAP.")
endif()
set(DHT_BOOTSTRAP OFF)
endif()