From 86f3e91a88875d30cc51dae8d07133f8653a1198 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Thu, 25 Oct 2018 11:44:52 +0200 Subject: [PATCH] Plug MPI tests even when MPI is not used to build the code This allows to test Messenger functionalities even for sequential builds --- tests/CMakeLists.txt | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e6bfb691b..b817c9a89 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -13,12 +13,10 @@ add_executable (unit_tests test_TinyVector.cpp ) -if (${PASTIS_HAS_MPI}) - add_executable (mpi_unit_tests - mpi_test_main.cpp - mpi_test_Messenger.cpp - ) -endif() +add_executable (mpi_unit_tests + mpi_test_main.cpp + mpi_test_Messenger.cpp + ) target_include_directories(Catch2 INTERFACE ${CATCH_INCLUDE_DIR}) @@ -28,15 +26,13 @@ target_link_libraries (unit_tests Catch2 ) -if (${PASTIS_HAS_MPI}) - target_link_libraries (mpi_unit_tests - PastisUtils - kokkos - ${PARMETIS_LIBRARIES} - ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} - Catch2 - ) -endif() +target_link_libraries (mpi_unit_tests + PastisUtils + kokkos + ${PARMETIS_LIBRARIES} + ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} + Catch2 + ) enable_testing() @@ -48,9 +44,10 @@ if (${PASTIS_HAS_MPI}) ${MPIEXEC_PREFLAGS} ${PASTIS_BINARY_DIR}/mpi_unit_tests ${MPIEXEC_POSTFLAGS}) +else() + add_test(mpi_unit_tests ${PASTIS_BINARY_DIR}/mpi_unit_tests) +endif() # Should patch ParseAndAddCatchTests macro to allow additional command parameter # to launch tests - set_tests_properties("mpi_unit_tests" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran" - LABELS "mpi") -endif() +set_tests_properties("mpi_unit_tests" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran" LABELS "mpi") -- GitLab