@@ -286,6 +286,49 @@ TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
286
286
}
287
287
}
288
288
289
+ TEST_P (umfIpcTest, AllocFreeAllocTest) {
290
+ constexpr size_t SIZE = 64 * 1024 ;
291
+ umf::pool_unique_handle_t pool = makePool ();
292
+ void *ptr = umfPoolMalloc (pool.get (), SIZE);
293
+ EXPECT_NE (ptr, nullptr );
294
+
295
+ umf_ipc_handle_t ipcHandle = nullptr ;
296
+ size_t handleSize = 0 ;
297
+ umf_result_t ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
298
+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
299
+
300
+ void *opened_ptr = nullptr ;
301
+ ret = umfOpenIPCHandle (pool.get (), ipcHandle, &opened_ptr);
302
+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
303
+
304
+ ret = umfCloseIPCHandle (opened_ptr);
305
+ EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
306
+
307
+ ret = umfPoolFree (pool.get (), ptr);
308
+ EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
309
+
310
+ ptr = umfPoolMalloc (pool.get (), SIZE);
311
+ EXPECT_NE (ptr, nullptr );
312
+
313
+ ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
314
+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
315
+
316
+ ret = umfOpenIPCHandle (pool.get (), ipcHandle, &opened_ptr);
317
+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
318
+
319
+ ret = umfCloseIPCHandle (opened_ptr);
320
+ EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
321
+
322
+ ret = umfPoolFree (pool.get (), ptr);
323
+ EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
324
+
325
+ pool.reset (nullptr );
326
+ EXPECT_EQ (stat.allocCount , stat.getCount );
327
+ EXPECT_EQ (stat.getCount , stat.putCount );
328
+ EXPECT_EQ (stat.openCount , stat.getCount );
329
+ EXPECT_EQ (stat.openCount , stat.closeCount );
330
+ }
331
+
289
332
TEST_P (umfIpcTest, ConcurrentGetPutHandles) {
290
333
std::vector<void *> ptrs;
291
334
constexpr size_t ALLOC_SIZE = 100 ;
0 commit comments