mosquitto/test/lib/CMakeLists.txt
Kai Buschulte a883bda9c1 Add CMake test target
Use `ctest` or `make test` to run all tests.
With this it's also possible to run tests on a Mac.

Relative paths used in tests become absolute ones to make tests
executable from any build folder.

Also fixed race condition in
  test/broker/11-persistent-subscription-no-local.py

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
2022-06-22 23:56:50 +01:00

25 lines
589 B
CMake

add_subdirectory(c)
add_subdirectory(cpp)
file(GLOB PY_TEST_FILES [0-9][0-9]-*.py)
set(EXCLUDE_LIST
03-publish-c2b-qos1-timeout
03-publish-c2b-qos2-timeout
)
foreach(PY_TEST_FILE ${PY_TEST_FILES})
get_filename_component(PY_TEST_NAME ${PY_TEST_FILE} NAME_WE)
if(${PY_TEST_NAME} IN_LIST EXCLUDE_LIST)
continue()
endif()
add_test(NAME lib-${PY_TEST_NAME}
COMMAND ${PY_TEST_FILE} c/${PY_TEST_NAME}.test
)
set_tests_properties(lib-${PY_TEST_NAME}
PROPERTIES
ENVIRONMENT "BUILD_ROOT=${CMAKE_BINARY_DIR}"
)
endforeach()