From: Andreas Beckmann Date: Mon, 6 Dec 2021 17:03:05 +0000 (+0100) Subject: [PATCH 139/144] do not dlopen(libpocl.so) without ENABLE_ICD X-Git-Tag: archive/raspbian/1.8-3+rpi1^2~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2e6b7ed3865ce572f3e63c94e8c59e76ba4e3baf;p=pocl.git [PATCH 139/144] do not dlopen(libpocl.so) without ENABLE_ICD Gbp-Pq: Name 0139-do-not-dlopen-libpocl.so-without-ENABLE_ICD.patch --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fe8a207..8b185a6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -37,11 +37,15 @@ if(ENABLE_HOST_CPU_DEVICES) endif() ####################################################################### -if (UNIX AND ENABLE_LOADABLE_DRIVERS) +if(UNIX AND HAVE_DLFCN_H) +if(ENABLE_ICD) add_test(NAME pocl_test_dlopen_libpocl COMMAND test_dlopen) set_tests_properties("pocl_test_dlopen_libpocl" PROPERTIES LABELS "internal;dlopen;vulkan") set_property(TEST "pocl_version_check" APPEND PROPERTY DEPENDS "pocl_test_dlopen_libpocl") +endif() + +if(ENABLE_LOADABLE_DRIVERS) if(BUILD_BASIC) add_test(NAME pocl_test_dlopen_device_basic COMMAND test_dlopen basic) @@ -85,7 +89,9 @@ if(ENABLE_VULKAN) set_property(TEST "pocl_version_check" APPEND PROPERTY DEPENDS "pocl_test_dlopen_device_vulkan") endif() -endif () +endif() + +endif() ####################################################################### add_subdirectory("kernel") diff --git a/tests/runtime/test_dlopen.c b/tests/runtime/test_dlopen.c index f586c1f..b3b525e 100644 --- a/tests/runtime/test_dlopen.c +++ b/tests/runtime/test_dlopen.c @@ -43,6 +43,7 @@ main (int argc, char **argv) SHLIB_ORIGIN "/../../lib/CL/devices/%s/libpocl-devices-%s.so", argv[1], argv[1]); +#ifdef ENABLE_ICD void *handle_libpocl = dlopen (libpocl, RTLD_NOW | RTLD_GLOBAL); if (!handle_libpocl) { @@ -50,6 +51,7 @@ main (int argc, char **argv) libpocl, dlerror ()); ret = 1; } +#endif if (ret == 0 && argc > 1) { @@ -64,8 +66,10 @@ main (int argc, char **argv) dlclose (handle_device); } +#ifdef ENABLE_ICD if (handle_libpocl) dlclose (handle_libpocl); +#endif return ret; }