tests:Detect buffer creation errors
authorTobin Ehlis <tobine@google.com>
Mon, 13 Nov 2017 23:47:46 +0000 (16:47 -0700)
committerTobin Ehlis <tobine@google.com>
Fri, 17 Nov 2017 16:38:09 +0000 (09:38 -0700)
Handle case when VkBufferTest fails to create the buffer. This means
setting the buffer as no longer valid, and checking for this case
in the test body so we don't try to use an invalid buffer.

tests/layer_validation_tests.cpp

index 640f660..d0a5aee 100644 (file)
@@ -748,6 +748,7 @@ class VkBufferTest {
             bool pass = aVulkanDevice->phy().set_memory_type(memory_requirements.memoryTypeBits, &memory_allocate_info,
                                                              VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
             if (!pass) {
+                CreateCurrent = false;
                 vkDestroyBuffer(VulkanDevice, VulkanBuffer, nullptr);
                 return;
             }
@@ -12230,6 +12231,11 @@ TEST_F(VkLayerTest, DSUpdateOutOfBounds) {
     });
 
     VkBufferTest buffer_test(m_device, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
+    if (!buffer_test.GetBufferCurrent()) {
+        // Something prevented creation of buffer so abort
+        printf("             Buffer creation failed, skipping test\n");
+        return;
+    }
 
     // Correctly update descriptor to avoid "NOT_UPDATED" error
     VkDescriptorBufferInfo buff_info = {};