From 75d7357c4c5d884c684aee72d7a352a7d51591cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Chevalier?= Date: Wed, 13 Dec 2023 21:56:15 +0100 Subject: [PATCH] Run tests in CI (#10) * Repair tests * Enable CI tests * Run Kokkos in CI tests --- .github/workflows/cmake-single-platform.yml | 10 +++++----- CMakePresets.json | 5 ++++- examples/kokkos/CMakeLists.txt | 4 ++++ src/shaman/unit_tests/CMakeLists.txt | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 31e64ec..f2d521c 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -27,9 +27,9 @@ jobs: # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build - # - name: Test - # working-directory: ${{github.workspace}}/build - # # Execute tests defined by the CMake configuration. - # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - # run: ctest -C ${{env.BUILD_TYPE}} + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{env.BUILD_TYPE}} diff --git a/CMakePresets.json b/CMakePresets.json index 491bb0a..0dbc969 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -22,7 +22,10 @@ }, { "name": "develop", - "inherits": ["all", "download"] + "inherits": ["all", "download"], + "cacheVariables": { + "SHAMAN_ENABLE_TESTS": "ON" + } } ], "buildPresets": [ diff --git a/examples/kokkos/CMakeLists.txt b/examples/kokkos/CMakeLists.txt index b59da42..db3a2a6 100644 --- a/examples/kokkos/CMakeLists.txt +++ b/examples/kokkos/CMakeLists.txt @@ -3,3 +3,7 @@ find_package(Kokkos REQUIRED) add_executable(kokkos_simple simple_example.cpp) target_link_libraries(kokkos_simple PUBLIC shaman) target_link_libraries(kokkos_simple PUBLIC Kokkos::kokkos) + +if (SHAMAN_EXAMPLES_TESTS) + add_test(NAME test_kokkos_simple COMMAND kokkos_simple) +endif () \ No newline at end of file diff --git a/src/shaman/unit_tests/CMakeLists.txt b/src/shaman/unit_tests/CMakeLists.txt index eab2124..089c259 100644 --- a/src/shaman/unit_tests/CMakeLists.txt +++ b/src/shaman/unit_tests/CMakeLists.txt @@ -4,7 +4,7 @@ if (GTest_FOUND) include(GoogleTest) add_executable(shaman_unittests test_eft.cc) - target_link_libraries(shaman_unittests GTest::Main) + target_link_libraries(shaman_unittests GTest::gtest_main) target_compile_features(shaman_unittests PUBLIC cxx_std_11 # for std::fma