Mercurial > hg > orthanc
changeset 4813:15f9cc6c11f0
fix unit test SharedLibrary.Basic
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 Nov 2021 17:38:36 +0100 |
parents | 6290a0b34aad |
children | 46bfa3a4fd63 |
files | OrthancServer/UnitTestsSources/PluginsTests.cpp |
diffstat | 1 files changed, 20 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 <gtest/gtest.h> +#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<SharedLibrary> 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