diff options
author | Petr Kraus <petr_kraus@email.cz> | 2019-06-12 20:13:33 +0200 |
---|---|---|
committer | Mark Lobodzinski <mark@lunarg.com> | 2019-06-13 15:13:01 -0600 |
commit | 84bc35d7ac3d99913bf0affd90cbb5460115be57 (patch) | |
tree | 484434b109a89c6e59b0247c9ef0396d141b4000 /tests/vklayertests_others.cpp | |
parent | a45d47bfcb235a723b2ec06a61f82740d8f1aee5 (diff) | |
download | vulkan-validation-layers-84bc35d7ac3d99913bf0affd90cbb5460115be57.tar.gz |
tests: Test creation with VkAllocationCallbacks
Diffstat (limited to 'tests/vklayertests_others.cpp')
-rw-r--r-- | tests/vklayertests_others.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/vklayertests_others.cpp b/tests/vklayertests_others.cpp index 3666209cb..4c2ddfc5c 100644 --- a/tests/vklayertests_others.cpp +++ b/tests/vklayertests_others.cpp @@ -723,6 +723,62 @@ TEST_F(VkLayerTest, UseObjectWithWrongDevice) { vkDestroyDevice(second_device, NULL); } +TEST_F(VkLayerTest, InvalidAllocationCallbacks) { + TEST_DESCRIPTION("Test with invalid VkAllocationCallbacks"); + + ASSERT_NO_FATAL_FAILURE(Init()); + + // vkCreateInstance, and vkCreateDevice tend to crash in the Loader Trampoline ATM, so choosing vkCreateCommandPool + const VkCommandPoolCreateInfo cpci = {VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr, 0, + DeviceObj()->QueueFamilyMatching(0, 0, true)}; + VkCommandPool cmdPool; + + struct Alloc { + static VKAPI_ATTR void *VKAPI_CALL alloc(void *, size_t, size_t, VkSystemAllocationScope) { return nullptr; }; + static VKAPI_ATTR void *VKAPI_CALL realloc(void *, void *, size_t, size_t, VkSystemAllocationScope) { return nullptr; }; + static VKAPI_ATTR void VKAPI_CALL free(void *, void *){}; + static VKAPI_ATTR void VKAPI_CALL internalAlloc(void *, size_t, VkInternalAllocationType, VkSystemAllocationScope){}; + static VKAPI_ATTR void VKAPI_CALL internalFree(void *, size_t, VkInternalAllocationType, VkSystemAllocationScope){}; + }; + + { + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkAllocationCallbacks-pfnAllocation-00632"); + const VkAllocationCallbacks allocator = {nullptr, nullptr, Alloc::realloc, Alloc::free, nullptr, nullptr}; + vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool); + m_errorMonitor->VerifyFound(); + } + + { + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkAllocationCallbacks-pfnReallocation-00633"); + const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, nullptr, Alloc::free, nullptr, nullptr}; + vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool); + m_errorMonitor->VerifyFound(); + } + + { + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkAllocationCallbacks-pfnFree-00634"); + const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, Alloc::realloc, nullptr, nullptr, nullptr}; + vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool); + m_errorMonitor->VerifyFound(); + } + + { + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, + "VUID-VkAllocationCallbacks-pfnInternalAllocation-00635"); + const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, Alloc::realloc, Alloc::free, nullptr, Alloc::internalFree}; + vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool); + m_errorMonitor->VerifyFound(); + } + + { + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, + "VUID-VkAllocationCallbacks-pfnInternalAllocation-00635"); + const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, Alloc::realloc, Alloc::free, Alloc::internalAlloc, nullptr}; + vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool); + m_errorMonitor->VerifyFound(); + } +} + TEST_F(VkLayerTest, MismatchedQueueFamiliesOnSubmit) { TEST_DESCRIPTION( "Submit command buffer created using one queue family and attempt to submit them on a queue created in a different queue " |