From e1b035507381c2a91d86eb9d122b0df974c6e30f Mon Sep 17 00:00:00 2001 From: Manuel Mohr Date: Fri, 29 Sep 2023 11:15:30 +0200 Subject: [PATCH] [UnitMux] Fix test tear down If the allocator info is not restored to a valid state before the end of the test, the device is not destroyed properly as `muxDestroyDevice()` checks for a valid allocator info before doing anything. If the device object holds any exclusive resources, this makes all following tests fail. --- modules/mux/test/muxCreateFence.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/mux/test/muxCreateFence.cpp b/modules/mux/test/muxCreateFence.cpp index 4f7135605..4a45c9750 100644 --- a/modules/mux/test/muxCreateFence.cpp +++ b/modules/mux/test/muxCreateFence.cpp @@ -40,6 +40,8 @@ TEST_P(muxCreateFenceTest, InvalidDevice) { TEST_P(muxCreateFenceTest, InvalidAllocator) { mux_fence_t fence; + const mux_allocator_info_t saved_allocator = allocator; + allocator.alloc = nullptr; allocator.free = nullptr; ASSERT_ERROR_EQ(mux_error_null_allocator_callback, @@ -54,6 +56,9 @@ TEST_P(muxCreateFenceTest, InvalidAllocator) { allocator.free = nullptr; ASSERT_ERROR_EQ(mux_error_null_allocator_callback, muxCreateFence(device, allocator, &fence)); + + // Restore allocator to properly tear down test + allocator = saved_allocator; } TEST_P(muxCreateFenceTest, NullFence) {