Do run DynamicLibrary::Load unit test under Linux

Use existing path for libc.so on Linux/x86_64 platforms to prevent the
test from just exiting without doing anything.

Also don't give a compilation error for unknown platforms, just a
run-time warning is sufficient.
This commit is contained in:
Vadim Zeitlin
2022-06-29 22:25:08 +02:00
parent c1a573d216
commit e32f49bca0
+9 -7
View File
@@ -28,12 +28,17 @@ TEST_CASE("DynamicLibrary::Load", "[dynlib]")
#if defined(__WINDOWS__)
static const char* const LIB_NAME = "kernel32.dll";
static const char* const FUNC_NAME = "lstrlenA";
#elif defined(__UNIX__)
#ifdef __DARWIN__
#elif defined(__DARWIN__)
static const char* const LIB_NAME = "/usr/lib/libc.dylib";
#elif defined(__LINUX__)
#ifdef __x86_64__
static const char* const LIB_NAME = "/lib/x86_64-linux-gnu/libc.so.6";
#else
static const char* const LIB_NAME = "/lib/libc.so.6";
#endif
#else
// weird: using just libc.so does *not* work!
static const char* const LIB_NAME = "/lib/libc.so.6";
// Try some generic fallback.
static const char* const LIB_NAME = "/usr/lib/libc.so";
#endif
static const char* const FUNC_NAME = "strlen";
@@ -47,9 +52,6 @@ TEST_CASE("DynamicLibrary::Load", "[dynlib]")
return;
}
#endif // !__DARWIN__
#else
#error "don't know how to test wxDllLoader on this platform"
#endif
wxDynamicLibrary lib(LIB_NAME);
REQUIRE( lib.IsLoaded() );