diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d1bfdc..90501f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,3 +108,7 @@ jobs: cd bld\ cmake ..\cmake -DCMAKE_BUILD_TYPE=Release -DWITH_STATIC=ON cmake --build . --target all_build --config Release + - name: Run tests + run: | + cd bld\ + ctest -V diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0a699da..c2b14cc 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -206,9 +206,24 @@ if (WITH_TESTS) add_executable(${TESTTCP} ${TESTTCP_SOURCES}) target_link_libraries(${TESTLO} PRIVATE Threads::Threads) target_link_libraries(${TESTTCP} PRIVATE Threads::Threads) + if (WIN32) + # If you use the new syntax, on Windows, you need to run `cmake -C Release` instead of `cmake`. + # We do not want that, so we use the old syntax for Windows... + add_test(${TESTLO} "tests/${TESTLO}") + add_test("test-bidirectional-tcp" "tests/${TESTTCP}") + else() + add_test(NAME ${TESTLO} COMMAND ${TESTLO} WORKING_DIRECTORY $) + add_test(NAME "test-bidirectional-tcp" COMMAND ${TESTTCP} WORKING_DIRECTORY $) + endif() + enable_testing() endif() if (WITH_CPP_TESTS) add_executable(${CPPTEST} ${CPPTEST_SOURCES}) + if (WIN32) + add_test(${CPPTEST} "tests/${CPPTEST}") + else() + add_test(NAME ${CPPTEST} COMMAND ${CPPTEST} WORKING_DIRECTORY $) + endif() endif() # Examples