Skip to content

Commit ceafbce

Browse files
Merge pull request #1539 from vinser52/svinogra_ipc_put_after_free
Add PutIPCHandleAfterFree IPC test
2 parents c5c751c + 10ffe19 commit ceafbce

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/ipcFixtures.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,29 @@ TEST_P(umfIpcTest, openInTwoIpcHandlers) {
705705
EXPECT_EQ(stat.closeCount, stat.openCount);
706706
}
707707

708+
TEST_P(umfIpcTest, PutIPCHandleAfterFree) {
709+
constexpr size_t SIZE = 100;
710+
umf_test::pool_unique_handle_t pool = makePool();
711+
ASSERT_NE(pool.get(), nullptr);
712+
713+
void *ptr = umfPoolMalloc(pool.get(), SIZE);
714+
EXPECT_NE(ptr, nullptr);
715+
716+
umf_ipc_handle_t ipcHandle = nullptr;
717+
size_t handleSize = 0;
718+
umf_result_t ret = umfGetIPCHandle(ptr, &ipcHandle, &handleSize);
719+
ASSERT_EQ(ret, UMF_RESULT_SUCCESS);
720+
721+
ret = umfPoolFree(pool.get(), ptr);
722+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
723+
724+
ret = umfPutIPCHandle(ipcHandle);
725+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
726+
727+
pool.reset(nullptr);
728+
EXPECT_EQ(stat.putCount, stat.getCount);
729+
}
730+
708731
TEST_P(umfIpcTest, ConcurrentGetConcurrentPutHandles) {
709732
concurrentGetConcurrentPutHandles(false);
710733
}

0 commit comments

Comments
 (0)