Skip to content

Commit e6d4602

Browse files
committed
Add IPC tests for umfPoolMalloc() after umfCloseIPCHandle()
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 08603a4 commit e6d4602

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

test/ipcFixtures.hpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,21 @@ TEST_P(umfIpcTest, BasicFlow) {
220220
ret = umfPoolFree(pool.get(), ptr);
221221
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
222222

223+
void *ptr1 = umfPoolMalloc(pool.get(), SIZE);
224+
EXPECT_NE(ptr1, nullptr);
225+
226+
void *ptr2 = umfPoolMalloc(pool.get(), SIZE);
227+
EXPECT_NE(ptr2, nullptr);
228+
229+
// fill ptr1 with data from ptr2
230+
memAccessor->copy(ptr1, ptr2, SIZE);
231+
232+
ret = umfPoolFree(pool.get(), ptr1);
233+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
234+
235+
ret = umfPoolFree(pool.get(), ptr2);
236+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
237+
223238
pool.reset(nullptr);
224239
EXPECT_EQ(stat.getCount, 1);
225240
EXPECT_EQ(stat.putCount, stat.getCount);
@@ -328,8 +343,22 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
328343
ret = umfPoolFree(pool.get(), ptr);
329344
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
330345

346+
void *ptr1 = umfPoolMalloc(pool.get(), SIZE);
347+
ASSERT_NE(ptr1, nullptr);
348+
349+
void *ptr2 = umfPoolMalloc(pool.get(), SIZE);
350+
ASSERT_NE(ptr2, nullptr);
351+
352+
// fill ptr1 with data from ptr2
353+
memAccessor->copy(ptr1, ptr2, SIZE);
354+
355+
ret = umfPoolFree(pool.get(), ptr1);
356+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
357+
358+
ret = umfPoolFree(pool.get(), ptr2);
359+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
360+
331361
pool.reset(nullptr);
332-
EXPECT_EQ(stat.allocCount, stat.getCount);
333362
EXPECT_EQ(stat.getCount, stat.putCount);
334363
EXPECT_EQ(stat.openCount, stat.getCount);
335364
EXPECT_EQ(stat.openCount, stat.closeCount);

0 commit comments

Comments
 (0)