Skip to content

Commit 30d0ea1

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

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/ipcFixtures.hpp

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

223+
ptr = (int *)umfPoolMalloc(pool.get(), SIZE);
224+
EXPECT_NE(ptr, nullptr);
225+
226+
// use the allocated memory - fill it with a 0xAB pattern
227+
const uint32_t pattern = 0xAB;
228+
memAccessor->fill(ptr, SIZE, &pattern, sizeof(pattern));
229+
230+
ret = umfPoolFree(pool.get(), ptr);
231+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
232+
223233
pool.reset(nullptr);
224234
EXPECT_EQ(stat.getCount, 1);
225235
EXPECT_EQ(stat.putCount, stat.getCount);
@@ -328,8 +338,17 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
328338
ret = umfPoolFree(pool.get(), ptr);
329339
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
330340

341+
ptr = umfPoolMalloc(pool.get(), SIZE);
342+
EXPECT_NE(ptr, nullptr);
343+
344+
// use the allocated memory - fill it with a 0xAB pattern
345+
const uint32_t pattern = 0xAB;
346+
memAccessor->fill(ptr, SIZE, &pattern, sizeof(pattern));
347+
348+
ret = umfPoolFree(pool.get(), ptr);
349+
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
350+
331351
pool.reset(nullptr);
332-
EXPECT_EQ(stat.allocCount, stat.getCount);
333352
EXPECT_EQ(stat.getCount, stat.putCount);
334353
EXPECT_EQ(stat.openCount, stat.getCount);
335354
EXPECT_EQ(stat.openCount, stat.closeCount);

0 commit comments

Comments
 (0)