# HG changeset patch # User Sebastien Jodogne # Date 1637771916 -3600 # Node ID 15f9cc6c11f09263840d16cef2e225e9ee2d9cb6 # Parent 6290a0b34aade6ab76f827d435c9ec4603aeb31f fix unit test SharedLibrary.Basic diff -r 6290a0b34aad -r 15f9cc6c11f0 OrthancServer/UnitTestsSources/PluginsTests.cpp --- a/OrthancServer/UnitTestsSources/PluginsTests.cpp Wed Nov 24 12:22:41 2021 +0100 +++ b/OrthancServer/UnitTestsSources/PluginsTests.cpp Wed Nov 24 17:38:36 2021 +0100 @@ -34,6 +34,7 @@ #include "PrecompiledHeadersUnitTests.h" #include +#include "../../OrthancFramework/Sources/Compatibility.h" #include "../../OrthancFramework/Sources/OrthancException.h" #include "../Plugins/Engine/PluginsManager.h" @@ -86,11 +87,25 @@ //ASSERT_TRUE(l.HasFunction("_init")); #elif defined(__linux__) || defined(__FreeBSD_kernel__) - SharedLibrary l("libdl.so"); - ASSERT_THROW(l.GetFunction("world"), OrthancException); - ASSERT_TRUE(l.GetFunction("dlopen") != NULL); - ASSERT_TRUE(l.HasFunction("dlclose")); - ASSERT_FALSE(l.HasFunction("world")); + std::unique_ptr l; + try + { + /** + * Since Orthanc 1.9.8, we test the "libdl.so.2" instead of the + * "libdl.so", as discussed here: + * https://groups.google.com/g/orthanc-users/c/I5g1fN6MCvg/m/JVdvRyjJAAAJ + **/ + l.reset(new SharedLibrary("libdl.so.2")); + } + catch (OrthancException&) + { + l.reset(new SharedLibrary("libdl.so")); // Fallback for backward compat + } + + ASSERT_THROW(l->GetFunction("world"), OrthancException); + ASSERT_TRUE(l->GetFunction("dlopen") != NULL); + ASSERT_TRUE(l->HasFunction("dlclose")); + ASSERT_FALSE(l->HasFunction("world")); #elif defined(__FreeBSD__) || defined(__OpenBSD__) // dlopen() in FreeBSD/OpenBSD is supplied by libc, libc.so is