Skip to content
Snippets Groups Projects
Unverified Commit 68389ebe authored by thorstenhater's avatar thorstenhater Committed by GitHub
Browse files

Do not build/use dynamic catalogue tests if not built with -fPIC (#1341)

Fixes #1340.
parent 3531f7ee
No related branches found
No related tags found
No related merge requests found
...@@ -174,16 +174,6 @@ set(unit_sources ...@@ -174,16 +174,6 @@ set(unit_sources
unit_test_catalogue.cpp unit_test_catalogue.cpp
) )
# for unit testing
make_catalogue(
NAME dummy
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/dummy"
OUTPUT "CAT_DUMMY_SOURCES"
MECHS dummy
ARBOR "${PROJECT_SOURCE_DIR}"
STANDALONE ON)
if(ARB_WITH_GPU) if(ARB_WITH_GPU)
list(APPEND unit_sources list(APPEND unit_sources
test_intrin.cu test_intrin.cu
...@@ -215,7 +205,18 @@ endif() ...@@ -215,7 +205,18 @@ endif()
add_executable(unit EXCLUDE_FROM_ALL ${unit_sources} ${test_mech_sources}) add_executable(unit EXCLUDE_FROM_ALL ${unit_sources} ${test_mech_sources})
add_dependencies(unit build_test_mods) add_dependencies(unit build_test_mods)
add_dependencies(tests unit) add_dependencies(tests unit)
add_dependencies(unit dummy-catalogue)
if(${CMAKE_POSITION_INDEPENDENT_CODE})
make_catalogue(
NAME dummy
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/dummy"
OUTPUT "CAT_DUMMY_SOURCES"
MECHS dummy
ARBOR "${PROJECT_SOURCE_DIR}"
STANDALONE ON)
target_compile_definitions(unit PRIVATE USE_DYNAMIC_CATALOGUES)
add_dependencies(unit dummy-catalogue)
endif()
if(ARB_WITH_NVCC) if(ARB_WITH_NVCC)
target_compile_options(unit PRIVATE -DARB_CUDA) target_compile_options(unit PRIVATE -DARB_CUDA)
......
...@@ -291,6 +291,7 @@ TEST(mechcat, names) { ...@@ -291,6 +291,7 @@ TEST(mechcat, names) {
} }
} }
#ifdef USE_DYNAMIC_CATALOGUES
TEST(mechcat, loading) { TEST(mechcat, loading) {
EXPECT_THROW(load_catalogue(LIBDIR "/does-not-exist-catalogue.so"), file_not_found_error); EXPECT_THROW(load_catalogue(LIBDIR "/does-not-exist-catalogue.so"), file_not_found_error);
EXPECT_THROW(load_catalogue(LIBDIR "/libarbor.a"), bad_catalogue_error); EXPECT_THROW(load_catalogue(LIBDIR "/libarbor.a"), bad_catalogue_error);
...@@ -298,7 +299,9 @@ TEST(mechcat, loading) { ...@@ -298,7 +299,9 @@ TEST(mechcat, loading) {
EXPECT_NO_THROW(cat = &load_catalogue(LIBDIR "/dummy-catalogue.so")); EXPECT_NO_THROW(cat = &load_catalogue(LIBDIR "/dummy-catalogue.so"));
ASSERT_NE(cat, nullptr); ASSERT_NE(cat, nullptr);
EXPECT_EQ(std::vector<std::string>{"dummy"}, cat->mechanism_names()); EXPECT_EQ(std::vector<std::string>{"dummy"}, cat->mechanism_names());
} }
#endif
TEST(mechcat, derived_info) { TEST(mechcat, derived_info) {
auto cat = build_fake_catalogue(); auto cat = build_fake_catalogue();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment