Fix freeing custom device in dynamic state tests
authorRicardo Garcia <rgarcia@igalia.com>
Mon, 4 Apr 2022 15:58:55 +0000 (17:58 +0200)
committerMatthew Netsch <mnetsch@qti.qualcomm.com>
Fri, 8 Apr 2022 19:58:06 +0000 (19:58 +0000)
Some dynamic state tests use a custom device that was not being properly
freed when existing a test group that used the device. This sometimes
caused crashes on program termination.

No tests should be affected by this change. This fix only touches the
test hierarchy. However, to check the fix doesn't break anything:

dEQP-VK.dynamic_state.*

Components: Vulkan
VK-GL-CTS issue: 3602

Change-Id: I6bf97900497b6e795c1fbacef5b3fc68619a9ff4

external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateTests.cpp

index 96d0639..9d13c5d 100644 (file)
@@ -56,9 +56,8 @@ void createChildren (tcu::TestCaseGroup* group, vk::PipelineConstructionType pip
                group->addChild(createDynamicStateComputeTests  (testCtx));
 }
 
-static void cleanupGroup(tcu::TestCaseGroup* group)
+static void cleanupGroup(tcu::TestCaseGroup*, vk::PipelineConstructionType)
 {
-       DE_UNREF(group);
        // Destroy singleton objects.
        cleanupDevice();
 }
@@ -67,9 +66,9 @@ static void cleanupGroup(tcu::TestCaseGroup* group)
 
 tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
 {
-       de::MovePtr<tcu::TestCaseGroup> monolithicGroup                 (createTestGroup(testCtx, "monolithic",                         "Monolithic pipeline tests",                                    createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC));
-       de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup    (createTestGroup(testCtx, "pipeline_library",           "Graphics pipeline library tests",                              createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY));
-       de::MovePtr<tcu::TestCaseGroup> fastLinkedLibraryGroup  (createTestGroup(testCtx, "fast_linked_library",        "Fast linked graphics pipeline library tests",  createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_FAST_LINKED_LIBRARY));
+       de::MovePtr<tcu::TestCaseGroup> monolithicGroup                 (createTestGroup(testCtx, "monolithic",                         "Monolithic pipeline tests",                                    createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC, cleanupGroup));
+       de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup    (createTestGroup(testCtx, "pipeline_library",           "Graphics pipeline library tests",                              createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY, cleanupGroup));
+       de::MovePtr<tcu::TestCaseGroup> fastLinkedLibraryGroup  (createTestGroup(testCtx, "fast_linked_library",        "Fast linked graphics pipeline library tests",  createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_FAST_LINKED_LIBRARY, cleanupGroup));
 
        de::MovePtr<tcu::TestCaseGroup> mainGroup(new tcu::TestCaseGroup(testCtx, "dynamic_state", "Dynamic State Tests"));
        mainGroup->addChild(monolithicGroup.release());