tests: GH428 Addition of tests for sync validation cases

This branch adds tests that challenge the validation layer on
various synchronization validation cases:

3) INVALID_EVENT - call vkQueueSubmit with an event that has
    been deleted
    InUseDestroyedSignaled

Change-Id: I9f3459944ef9a200b129d6dfaf157f56faa9d70a
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index eb1ea25..47cada4 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -13741,11 +13741,14 @@
 TEST_F(VkLayerTest, InUseDestroyedSignaled) {
     TEST_DESCRIPTION("Use vkCmdExecuteCommands with invalid state "
                      "in primary and secondary command buffers. "
-                     "Delete objects that are inuse");
+                     "Delete objects that are inuse. Call VkQueueSubmit "
+                     "with an event that has been deleted.");
 
     ASSERT_NO_FATAL_FAILURE(InitState());
     ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
 
+    const char *submit_with_deleted_event_message =
+            "Cannot submit cmd buffer using deleted event 0x";
     const char *cannot_delete_event_message =
             "Cannot delete event 0x";
     const char *cannot_delete_semaphore_message =
@@ -13762,6 +13765,23 @@
     vkCmdSetEvent(m_commandBuffer->handle(), event,
                   VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
 
+    EndCommandBuffer();
+    vkDestroyEvent(m_device->device(), event, nullptr);
+
+    VkSubmitInfo submit_info = {};
+    submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+    submit_info.commandBufferCount = 1;
+    submit_info.pCommandBuffers =&m_commandBuffer->handle();
+    m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+                                         submit_with_deleted_event_message);
+    vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE);
+    m_errorMonitor->VerifyFound();
+
+    m_errorMonitor->SetDesiredFailureMsg(0, "");
+    vkResetCommandBuffer(m_commandBuffer->handle(), 0);
+
+    vkCreateEvent(m_device->device(), &event_create_info, nullptr, &event);
+
     VkSemaphoreCreateInfo semaphore_create_info = {};
     semaphore_create_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
     VkSemaphore semaphore;
@@ -13841,21 +13861,22 @@
 
     pipe.CreateVKPipeline(pipeline_layout, m_renderPass);
 
+    BeginCommandBuffer();
+    vkCmdSetEvent(m_commandBuffer->handle(), event,
+                  VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
+
     vkCmdBindPipeline(m_commandBuffer->GetBufferHandle(),
                       VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
     vkCmdBindDescriptorSets(m_commandBuffer->GetBufferHandle(),
                             VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0,
                             1, &descriptorset, 0, NULL);
 
-    vkEndCommandBuffer(m_commandBuffer->handle());
+    EndCommandBuffer();
 
-    VkSubmitInfo submit_info = {};
-    submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
-    submit_info.commandBufferCount = 1;
-    submit_info.pCommandBuffers =&m_commandBuffer->handle();
     submit_info.signalSemaphoreCount = 1;
     submit_info.pSignalSemaphores = &semaphore;
     vkQueueSubmit(m_device->m_queue, 1, &submit_info, fence);
+
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
                                          cannot_delete_event_message);
     vkDestroyEvent(m_device->device(), event, nullptr);