diff --git a/src/SIOBlock.cc b/src/SIOBlock.cc index 4645d2a74..8dea9105b 100644 --- a/src/SIOBlock.cc +++ b/src/SIOBlock.cc @@ -165,6 +165,11 @@ std::vector> SIOBlockLibraryLoader::getLibN libs.emplace_back(std::move(filename), dir); } } + if (std::getenv("PODIO_SIOBLOCK_PATH") && libs.empty()) { + throw std::runtime_error( + "No SIOBlocks libraries found in PODIO_SIOBLOCK_PATH. Please set PODIO_SIOBLOCK_PATH to the directory " + "containing the SIOBlocks libraries or unset it to fallback to LD_LIBRARY_PATH."); + } } return libs; diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 5aa2db37e..e57da8103 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -61,21 +61,11 @@ if (NOT FORCE_RUN_ALL_TESTS) endif() endif() -option(SKIP_CATCH_DISCOVERY "Skip the Catch2 test discovery" OFF) - -# To work around https://github.com/catchorg/Catch2/issues/2424 we need the -# DL_PATH argument for catch_discoer_tests which requires CMake 3.22 at least -# The whole issue can be avoided if we skip the catch test discovery and set the -# environment on our own -if (CMAKE_VERSION VERSION_LESS 3.22) - set(SKIP_CATCH_DISCOVERY ON) -endif() - -if (USE_SANITIZER MATCHES "Memory(WithOrigin)?" OR SKIP_CATCH_DISCOVERY) +if (USE_SANITIZER MATCHES "Memory(WithOrigin)?") # Automatic test discovery fails with Memory sanitizers due to some issues in # Catch2. So in that case we skip the discovery step and simply run the thing # directly in the tests. - if (FORCE_RUN_ALL_TESTS OR SKIP_CATCH_DISCOVERY) + if (FORCE_RUN_ALL_TESTS) # Unfortunately Memory sanitizer seems to be really unhappy with Catch2 and # it fails to successfully launch the executable and execute any test. Here # we just include them in order to have them show up as failing @@ -88,9 +78,10 @@ else() WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} TEST_PREFIX "UT_" # make it possible to filter easily with -R ^UT TEST_SPEC ${filter_tests} # discover only tests that are known to not fail - DL_PATHS ${CMAKE_CURRENT_BINARY_DIR}:${PROJECT_BINARY_DIR}/src:${PROJECT_BINARY_DIR}/tests:$:$<$:$>:$ENV{LD_LIBRARY_PATH} PROPERTIES ENVIRONMENT - PODIO_SIOBLOCK_PATH=${CMAKE_CURRENT_BINARY_DIR} + PODIO_SIOBLOCK_PATH=${PROJECT_BINARY_DIR}/tests + ENVIRONMENT + LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}:${PROJECT_BINARY_DIR}/src:${PROJECT_BINARY_DIR}/tests:$:$<$:$>:$ENV{LD_LIBRARY_PATH} ) endif()