VK-GL-CTS
VK-GL-CTS copied to clipboard
DRM device test throws unhandled exception under the normal conditions.
https://github.com/KhronosGroup/VK-GL-CTS/blob/a3338eb2ded98b5befda64f9325db0d219095a00/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp#L128
DynamicLibrary() constructor what accepts an array of libraries treats an array as a list of libraries which MUST be loaded, otherwise it throws exception if any of libraries could not be opened.
Historically under QNX we ship libdrm.so.1, so in our case the test is terminated, because it cannot find libdrm.so and libdrm.so.2 together. Probably intention of this code was to load any of these libraries, but actually it doesn't do that.
Thanks, would you be willing to make a fix?
@mgorchak-blackberry could you please check the following fix for the main branch?
diff --git a/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp
index 3222a51df..77b6d650e 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 d5d835e71..8ea814c25 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 3284f9dc9..894852b07 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);
}
}
Fixed in https://github.com/KhronosGroup/VK-GL-CTS/commit/885f2dc8a7ba04e2af7b7a4a0a6bb04d8c3c2e99
Please open a new issue if things are still not correct