tests: Capture unexpected messages before first desired message is set
authorChris Forbes <chrisforbes@google.com>
Fri, 16 Sep 2016 02:36:39 +0000 (14:36 +1200)
committerChris Forbes <chrisforbes@google.com>
Sun, 18 Sep 2016 20:54:42 +0000 (08:54 +1200)
Otherwise, tests that specify what they want late are vulnerable to
accidental errors in their setup code.

Signed-off-by: Chris Forbes <chrisforbes@google.com>
tests/layer_validation_tests.cpp

index 341f557..14cc8e7 100644 (file)
@@ -119,8 +119,9 @@ class ErrorMonitor {
     ErrorMonitor() {
         test_platform_thread_create_mutex(&m_mutex);
         test_platform_thread_lock_mutex(&m_mutex);
-        m_msgFlags = VK_DEBUG_REPORT_INFORMATION_BIT_EXT;
+        m_msgFlags = VK_DEBUG_REPORT_ERROR_BIT_EXT;
         m_bailout = NULL;
+        m_desiredMsgSet = false;
         test_platform_thread_unlock_mutex(&m_mutex);
     }
 
@@ -134,6 +135,7 @@ class ErrorMonitor {
         m_desiredMsg = msgString;
         m_msgFound = VK_FALSE;
         m_msgFlags = msgFlags;
+        m_desiredMsgSet = true;
         test_platform_thread_unlock_mutex(&m_mutex);
     }
 
@@ -144,7 +146,7 @@ class ErrorMonitor {
             *m_bailout = true;
         }
         string errorString(msgString);
-        if (errorString.find(m_desiredMsg) != string::npos) {
+        if (m_desiredMsgSet && errorString.find(m_desiredMsg) != string::npos) {
             if (m_msgFound) { // If multiple matches, don't lose all but the last!
                 m_otherMsgs.push_back(m_failureMsg);
             }
@@ -212,6 +214,7 @@ class ErrorMonitor {
     test_platform_thread_mutex m_mutex;
     bool *m_bailout;
     VkBool32 m_msgFound;
+    bool m_desiredMsgSet;
 };
 
 static VKAPI_ATTR VkBool32 VKAPI_CALL myDbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject,