From: Ricardo Garcia Date: Mon, 12 Dec 2022 09:17:21 +0000 (+0100) Subject: Treat DynamicLibrary library list as alternatives X-Git-Tag: upstream/1.3.5~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=885f2dc8a7ba04e2af7b7a4a0a6bb04d8c3c2e99;p=platform%2Fupstream%2FVK-GL-CTS.git Treat DynamicLibrary library list as alternatives Instead of attempting to load all libraries provided, we should only attempt to load one of them and stop when the first one succeeds. Affects WSI tests in DRM envs. Specifically affects: dEQP-VK.api.device_drm_properties.drm_files_exist Components: Framework, Vulkan VK-GL-CTS issue: 4171 VK-GL-CTS public issue: 303 Change-Id: Ib86d25662ce0b783b37ebacb26a6944452d22fd2 --- diff --git a/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp index 3222a51..77b6d65 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp @@ -74,7 +74,7 @@ void testFilesExist (const VkPhysicalDeviceDrmPropertiesEXT& deviceDrmProperties #endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) if (!primaryFound && !renderFound) { - TCU_THROW(NotSupportedError, "Nether DRM primary nor render device files were found"); + TCU_THROW(NotSupportedError, "Neither DRM primary nor render device files were found"); } } diff --git a/framework/common/tcuLibDrm.cpp b/framework/common/tcuLibDrm.cpp index d5d835e..8ea814c 100644 --- a/framework/common/tcuLibDrm.cpp +++ b/framework/common/tcuLibDrm.cpp @@ -199,7 +199,7 @@ const char* LibDrm::libDrmFiles[] = { "libdrm.so.2", "libdrm.so", - DE_NULL + nullptr }; } // tcu diff --git a/framework/delibs/decpp/deDynamicLibrary.cpp b/framework/delibs/decpp/deDynamicLibrary.cpp index 3284f9d..894852b 100644 --- a/framework/delibs/decpp/deDynamicLibrary.cpp +++ b/framework/delibs/decpp/deDynamicLibrary.cpp @@ -30,7 +30,7 @@ namespace de { DynamicLibrary::DynamicLibrary (const char* fileName) - : m_library(DE_NULL) + : m_library(nullptr) { m_library = deDynamicLibrary_open(fileName); if (!m_library) @@ -38,13 +38,22 @@ DynamicLibrary::DynamicLibrary (const char* fileName) } DynamicLibrary::DynamicLibrary (const char* fileNames[]) - : m_library(DE_NULL) + : m_library(nullptr) { - for (int i = 0; !m_library && fileNames[i]; i++) + for (size_t i = 0u; fileNames[i] != nullptr; ++i) { m_library = deDynamicLibrary_open(fileNames[i]); - if (!m_library) - throw std::runtime_error(std::string("Failed to open dynamic library: '") + fileNames[0] + "'"); + if (m_library) + break; + } + + if (!m_library) + { + std::string nameList; + for (size_t i = 0u; fileNames[i] != nullptr; ++i) + nameList += (nameList.empty() ? "" : ", ") + std::string(fileNames[i]); + const std::string msg = "Failed to open dynamic library: tried " + nameList; + throw std::runtime_error(msg); } }