From d9e91f73e5760fc6ee115ac2947e1ef999f6bef5 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Fri, 19 Aug 2022 17:27:54 +0400 Subject: Enable tests --- .github/workflows/build_and_test.yml | 39 +++++++++++++++++++++++++- CMakeLists.txt | 14 +++++----- source/test/programs/CMakeLists.txt | 54 ++++++++++++++++++------------------ 3 files changed, 72 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1b93305..6f29517 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -16,7 +16,7 @@ jobs: build: strategy: matrix: - os: [ windows-2019 ] + os: [ ubuntu-latest, macos-latest, windows-2019 ] runs-on: ${{ matrix.os }} @@ -81,3 +81,40 @@ jobs: flags: ${{ runner.os }} name: ${{ runner.os }} build fail_ci_if_error: false + + integration: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-2019 ] + name: [ fetch_content, find_package ] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up CMake 3.18 + uses: jwlawson/actions-setup-cmake@v1.8 + with: + cmake-version: 3.18 + + - name: Build + if: runner.os != 'Windows' + run: | + cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE -B build -S . + cmake --build build --config $BUILD_TYPE + working-directory: ./source/test/integration/${{ matrix.name }} + + - name: Build with Visual Studio + if: runner.os == 'Windows' + shell: bash + run: | + cmake -B build -S . + cmake --build build --config $BUILD_TYPE + working-directory: ./source/test/integration/${{ matrix.name }} + + - name: Run + shell: bash + run: | + ctest -V -C $BUILD_TYPE + working-directory: ./source/test/integration/${{ matrix.name }}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index 573cbdf..2ca6ce3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,13 +141,13 @@ if(KIT_ENABLE_TESTING) --coverage) endif() - #add_test( - # NAME ${KIT_LIBRARY}_unittests - # COMMAND ${KIT_TEST_SUITE} --no-carriage-return) - #set_tests_properties( - # ${KIT_LIBRARY}_unittests - # PROPERTIES - # TIMEOUT "120") + add_test( + NAME ${KIT_LIBRARY}_unittests + COMMAND ${KIT_TEST_SUITE} --no-carriage-return) + set_tests_properties( + ${KIT_LIBRARY}_unittests + PROPERTIES + TIMEOUT "120") endif() add_subdirectory(source) diff --git a/source/test/programs/CMakeLists.txt b/source/test/programs/CMakeLists.txt index 7decb0d..22e50de 100644 --- a/source/test/programs/CMakeLists.txt +++ b/source/test/programs/CMakeLists.txt @@ -1,33 +1,33 @@ if(KIT_ENABLE_TESTING) - #add_executable(too_many_tests too_many_tests.c) - #target_link_libraries(too_many_tests ${KIT_TEST_LIBRARY}) - #add_test( - # NAME too_many_tests_test - # COMMAND too_many_tests --quiet) - #set_tests_properties( - # too_many_tests_test - # PROPERTIES - # TIMEOUT "15") + add_executable(too_many_tests too_many_tests.c) + target_link_libraries(too_many_tests ${KIT_TEST_LIBRARY}) + add_test( + NAME too_many_tests_test + COMMAND too_many_tests --quiet) + set_tests_properties( + too_many_tests_test + PROPERTIES + TIMEOUT "15") - #add_executable(too_many_assertions too_many_assertions.c) - #target_link_libraries(too_many_assertions ${KIT_TEST_LIBRARY}) - #add_test( - # NAME too_many_assertions_test - # COMMAND too_many_assertions --quiet) - #set_tests_properties( - # too_many_assertions_test - # PROPERTIES - # TIMEOUT "15") + add_executable(too_many_assertions too_many_assertions.c) + target_link_libraries(too_many_assertions ${KIT_TEST_LIBRARY}) + add_test( + NAME too_many_assertions_test + COMMAND too_many_assertions --quiet) + set_tests_properties( + too_many_assertions_test + PROPERTIES + TIMEOUT "15") - #add_executable(cpp_example cpp_example.cpp) - #target_link_libraries(cpp_example ${KIT_TEST_LIBRARY}) - #add_test( - # NAME cpp_example_test - # COMMAND cpp_example --quiet) - #set_tests_properties( - # cpp_example_test - # PROPERTIES - # TIMEOUT "15") + add_executable(cpp_example cpp_example.cpp) + target_link_libraries(cpp_example ${KIT_TEST_LIBRARY}) + add_test( + NAME cpp_example_test + COMMAND cpp_example --quiet) + set_tests_properties( + cpp_example_test + PROPERTIES + TIMEOUT "15") add_executable(signals signals.cpp) target_link_libraries(signals ${KIT_TEST_LIBRARY}) -- cgit v1.2.3