Skip to content

Commit 92d1ac9

Browse files
committed
refarctor IPC tests
1 parent 6873226 commit 92d1ac9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/ipcFixtures.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct umfIpcTest : umf_test::test,
163163
TEST_P(umfIpcTest, GetIPCHandleSize) {
164164
size_t size = 0;
165165
umf::pool_unique_handle_t pool = makePool();
166+
ASSERT_NE(pool.get(), nullptr);
166167

167168
umf_result_t ret = umfPoolGetIPCHandleSize(pool.get(), &size);
168169
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
@@ -175,6 +176,8 @@ TEST_P(umfIpcTest, GetIPCHandleSizeInvalidArgs) {
175176
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
176177

177178
umf::pool_unique_handle_t pool = makePool();
179+
ASSERT_NE(pool.get(), nullptr);
180+
178181
ret = umfPoolGetIPCHandleSize(pool.get(), nullptr);
179182
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
180183
}
@@ -191,6 +194,8 @@ TEST_P(umfIpcTest, GetIPCHandleInvalidArgs) {
191194
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
192195

193196
umf::pool_unique_handle_t pool = makePool();
197+
ASSERT_NE(pool.get(), nullptr);
198+
194199
ptr = umfPoolMalloc(pool.get(), SIZE);
195200
EXPECT_NE(ptr, nullptr);
196201

@@ -214,6 +219,8 @@ TEST_P(umfIpcTest, BasicFlow) {
214219
constexpr size_t SIZE = 100;
215220
std::vector<int> expected_data(SIZE);
216221
umf::pool_unique_handle_t pool = makePool();
222+
ASSERT_NE(pool.get(), nullptr);
223+
217224
int *ptr = (int *)umfPoolMalloc(pool.get(), SIZE * sizeof(int));
218225
EXPECT_NE(ptr, nullptr);
219226

@@ -284,6 +291,7 @@ TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
284291
void *openedPtrs[NUM_POOLS][NUM_ALLOCS];
285292
std::vector<umf::pool_unique_handle_t> pools_to_open;
286293
umf::pool_unique_handle_t pool = makePool();
294+
ASSERT_NE(pool.get(), nullptr);
287295

288296
for (size_t i = 0; i < NUM_POOLS; ++i) {
289297
pools_to_open.push_back(makePool());
@@ -342,6 +350,8 @@ TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
342350
TEST_P(umfIpcTest, AllocFreeAllocTest) {
343351
constexpr size_t SIZE = 64 * 1024;
344352
umf::pool_unique_handle_t pool = makePool();
353+
ASSERT_NE(pool.get(), nullptr);
354+
345355
umf_ipc_handler_handle_t ipcHandler = nullptr;
346356

347357
umf_result_t ret = umfPoolGetIPCHandler(pool.get(), &ipcHandler);
@@ -401,7 +411,9 @@ TEST_P(umfIpcTest, openInTwoIpcHandlers) {
401411
constexpr size_t SIZE = 100;
402412
std::vector<int> expected_data(SIZE);
403413
umf::pool_unique_handle_t pool1 = makePool();
414+
ASSERT_NE(pool1.get(), nullptr);
404415
umf::pool_unique_handle_t pool2 = makePool();
416+
ASSERT_NE(pool2.get(), nullptr);
405417
umf_ipc_handler_handle_t ipcHandler1 = nullptr;
406418
umf_ipc_handler_handle_t ipcHandler2 = nullptr;
407419

@@ -466,6 +478,7 @@ TEST_P(umfIpcTest, ConcurrentGetPutHandles) {
466478
constexpr size_t ALLOC_SIZE = 100;
467479
constexpr size_t NUM_POINTERS = 100;
468480
umf::pool_unique_handle_t pool = makePool();
481+
ASSERT_NE(pool.get(), nullptr);
469482

470483
for (size_t i = 0; i < NUM_POINTERS; ++i) {
471484
void *ptr = umfPoolMalloc(pool.get(), ALLOC_SIZE);
@@ -515,6 +528,7 @@ TEST_P(umfIpcTest, ConcurrentOpenCloseHandles) {
515528
constexpr size_t ALLOC_SIZE = 100;
516529
constexpr size_t NUM_POINTERS = 100;
517530
umf::pool_unique_handle_t pool = makePool();
531+
ASSERT_NE(pool.get(), nullptr);
518532

519533
for (size_t i = 0; i < NUM_POINTERS; ++i) {
520534
void *ptr = umfPoolMalloc(pool.get(), ALLOC_SIZE);

0 commit comments

Comments
 (0)