comparison OrthancServer/UnitTestsSources/PluginsTests.cpp @ 4819:70d2a97ca8cb openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 25 Nov 2021 13:12:32 +0100
parents f0038043fb97 15f9cc6c11f0
children 2e71a08eea15
comparison
equal deleted inserted replaced
4785:61da49321754 4819:70d2a97ca8cb
20 20
21 21
22 #include "PrecompiledHeadersUnitTests.h" 22 #include "PrecompiledHeadersUnitTests.h"
23 #include <gtest/gtest.h> 23 #include <gtest/gtest.h>
24 24
25 #include "../../OrthancFramework/Sources/Compatibility.h"
25 #include "../../OrthancFramework/Sources/OrthancException.h" 26 #include "../../OrthancFramework/Sources/OrthancException.h"
26 #include "../Plugins/Engine/PluginsManager.h" 27 #include "../Plugins/Engine/PluginsManager.h"
27 28
28 using namespace Orthanc; 29 using namespace Orthanc;
29 30
72 73
73 //ASSERT_TRUE(l.GetFunction("_init") != NULL); 74 //ASSERT_TRUE(l.GetFunction("_init") != NULL);
74 //ASSERT_TRUE(l.HasFunction("_init")); 75 //ASSERT_TRUE(l.HasFunction("_init"));
75 76
76 #elif defined(__linux__) || defined(__FreeBSD_kernel__) 77 #elif defined(__linux__) || defined(__FreeBSD_kernel__)
77 SharedLibrary l("libdl.so"); 78 std::unique_ptr<SharedLibrary> l;
78 ASSERT_THROW(l.GetFunction("world"), OrthancException); 79 try
79 ASSERT_TRUE(l.GetFunction("dlopen") != NULL); 80 {
80 ASSERT_TRUE(l.HasFunction("dlclose")); 81 /**
81 ASSERT_FALSE(l.HasFunction("world")); 82 * Since Orthanc 1.9.8, we test the "libdl.so.2" instead of the
83 * "libdl.so", as discussed here:
84 * https://groups.google.com/g/orthanc-users/c/I5g1fN6MCvg/m/JVdvRyjJAAAJ
85 **/
86 l.reset(new SharedLibrary("libdl.so.2"));
87 }
88 catch (OrthancException&)
89 {
90 l.reset(new SharedLibrary("libdl.so")); // Fallback for backward compat
91 }
92
93 ASSERT_THROW(l->GetFunction("world"), OrthancException);
94 ASSERT_TRUE(l->GetFunction("dlopen") != NULL);
95 ASSERT_TRUE(l->HasFunction("dlclose"));
96 ASSERT_FALSE(l->HasFunction("world"));
82 97
83 #elif defined(__FreeBSD__) || defined(__OpenBSD__) 98 #elif defined(__FreeBSD__) || defined(__OpenBSD__)
84 // dlopen() in FreeBSD/OpenBSD is supplied by libc, libc.so is 99 // dlopen() in FreeBSD/OpenBSD is supplied by libc, libc.so is
85 // a ldscript, so we can't actually use it. Use thread 100 // a ldscript, so we can't actually use it. Use thread
86 // library instead - if it works - dlopen() is good. 101 // library instead - if it works - dlopen() is good.