tests: Fix layer validation test issues
Fix issues identified by Application Verifier on Windows, which were
leading to invalid/unpredictable test results.
- Fix VkDeviceObj::queue_props dangling pointer issue, as a result
of initialization from a std::vector::data() call on a temporary
vector.
- Add ErrorMonitor destructor to destroy ErrorMonitor::m_mutex.
Change-Id: I5bfb756a60f2ba13e7023fd6b50cde6c7622af59
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 0be2409..07ca4c0 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -117,6 +117,8 @@
test_platform_thread_unlock_mutex(&m_mutex);
}
+ ~ErrorMonitor() { test_platform_thread_delete_mutex(&m_mutex); }
+
void SetDesiredFailureMsg(VkFlags msgFlags, const char *msgString) {
// also discard all collected messages to this point
test_platform_thread_lock_mutex(&m_mutex);
@@ -1090,7 +1092,8 @@
TEST_DESCRIPTION("Two command buffers, each in a separate QueueSubmit call "
"submitted on separate queues followed by a QueueWaitIdle.");
- if (m_device->queue_props->queueCount < 2)
+ if ((m_device->queue_props.empty()) ||
+ (m_device->queue_props[0].queueCount < 2))
return;
m_errorMonitor->ExpectSuccess();
@@ -1196,7 +1199,8 @@
"submitted on separate queues, the second having a fence"
"followed by a QueueWaitIdle.");
- if (m_device->queue_props->queueCount < 2)
+ if ((m_device->queue_props.empty()) ||
+ (m_device->queue_props[0].queueCount < 2))
return;
m_errorMonitor->ExpectSuccess();
@@ -1310,7 +1314,8 @@
"submitted on separate queues, the second having a fence"
"followed by two consecutive WaitForFences calls on the same fence.");
- if (m_device->queue_props->queueCount < 2)
+ if ((m_device->queue_props.empty()) ||
+ (m_device->queue_props[0].queueCount < 2))
return;
m_errorMonitor->ExpectSuccess();
@@ -1423,7 +1428,8 @@
"submitted on separate queues, the second having a fence, "
"followed by a WaitForFences call.");
- if (m_device->queue_props->queueCount < 2)
+ if ((m_device->queue_props.empty()) ||
+ (m_device->queue_props[0].queueCount < 2))
return;
m_errorMonitor->ExpectSuccess();
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index e647c9d..64d428b 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -397,7 +397,7 @@
init();
props = phy().properties();
- queue_props = phy().queue_properties().data();
+ queue_props = phy().queue_properties();
}
VkDeviceObj::VkDeviceObj(uint32_t id, VkPhysicalDevice obj,
@@ -407,7 +407,7 @@
init(layer_names, extension_names);
props = phy().properties();
- queue_props = phy().queue_properties().data();
+ queue_props = phy().queue_properties();
}
void VkDeviceObj::get_device_queue() {
diff --git a/tests/vkrenderframework.h b/tests/vkrenderframework.h
index ec3524a..e64b3f9 100644
--- a/tests/vkrenderframework.h
+++ b/tests/vkrenderframework.h
@@ -45,7 +45,7 @@
uint32_t id;
VkPhysicalDeviceProperties props;
- const VkQueueFamilyProperties *queue_props;
+ std::vector<VkQueueFamilyProperties> queue_props;
VkQueue m_queue;
};