Skip to content

Commit 2fc3d26

Browse files
committed
Set COMMON_SIZE to 4096 in ipcFixtures.hpp
Set COMMON_SIZE to 4096 in ipcFixtures.hpp, because the minimum size of allocation of a memory provider is the minimum page size. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 7ab4ef3 commit 2fc3d26

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/ipcFixtures.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct umfIpcTest : umf_test::test,
6666
providerParams = provider_params;
6767
memAccessor = accessor;
6868
freeNotSupported = free_not_supp;
69+
COMMON_SIZE = 4096;
6970
}
7071

7172
void TearDown() override { test::TearDown(); }
@@ -125,6 +126,7 @@ struct umfIpcTest : umf_test::test,
125126
umf_memory_provider_ops_t *providerOps = nullptr;
126127
void *providerParams = nullptr;
127128
bool freeNotSupported = false;
129+
size_t COMMON_SIZE;
128130
};
129131

130132
static inline umf_result_t
@@ -156,7 +158,7 @@ TEST_P(umfIpcTest, GetIPCHandleSizeInvalidArgs) {
156158
}
157159

158160
TEST_P(umfIpcTest, GetIPCHandleInvalidArgs) {
159-
constexpr size_t SIZE = 100;
161+
size_t SIZE = COMMON_SIZE;
160162
umf_ipc_handle_t ipcHandle = nullptr;
161163
size_t handleSize = 0;
162164
umf_result_t ret = umfGetIPCHandle(nullptr, &ipcHandle, &handleSize);
@@ -182,7 +184,7 @@ TEST_P(umfIpcTest, GetIPCHandleInvalidArgs) {
182184
}
183185

184186
TEST_P(umfIpcTest, BasicFlow) {
185-
constexpr size_t SIZE = 100;
187+
size_t SIZE = COMMON_SIZE;
186188
std::vector<int> expected_data(SIZE);
187189
umf::pool_unique_handle_t pool = makePool();
188190
int *ptr = (int *)umfPoolMalloc(pool.get(), SIZE * sizeof(int));
@@ -245,7 +247,7 @@ TEST_P(umfIpcTest, BasicFlow) {
245247
}
246248

247249
TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
248-
constexpr size_t SIZE = 100;
250+
size_t SIZE = COMMON_SIZE;
249251
constexpr size_t NUM_ALLOCS = 100;
250252
constexpr size_t NUM_POOLS = 4;
251253
void *ptrs[NUM_ALLOCS];
@@ -304,7 +306,7 @@ TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
304306
}
305307

306308
TEST_P(umfIpcTest, AllocFreeAllocTest) {
307-
constexpr size_t SIZE = 64 * 1024;
309+
size_t SIZE = (64 * 1024 > COMMON_SIZE) ? 64 * 1024 : COMMON_SIZE;
308310
umf::pool_unique_handle_t pool = makePool();
309311
void *ptr = umfPoolMalloc(pool.get(), SIZE);
310312
EXPECT_NE(ptr, nullptr);
@@ -361,7 +363,7 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
361363
}
362364

363365
TEST_P(umfIpcTest, openInTwoPools) {
364-
constexpr size_t SIZE = 100;
366+
size_t SIZE = COMMON_SIZE;
365367
std::vector<int> expected_data(SIZE);
366368
umf::pool_unique_handle_t pool1 = makePool();
367369
umf::pool_unique_handle_t pool2 = makePool();
@@ -416,7 +418,7 @@ TEST_P(umfIpcTest, openInTwoPools) {
416418

417419
TEST_P(umfIpcTest, ConcurrentGetPutHandles) {
418420
std::vector<void *> ptrs;
419-
constexpr size_t ALLOC_SIZE = 100;
421+
size_t ALLOC_SIZE = COMMON_SIZE;
420422
constexpr size_t NUM_POINTERS = 100;
421423
umf::pool_unique_handle_t pool = makePool();
422424

@@ -465,7 +467,7 @@ TEST_P(umfIpcTest, ConcurrentGetPutHandles) {
465467

466468
TEST_P(umfIpcTest, ConcurrentOpenCloseHandles) {
467469
std::vector<void *> ptrs;
468-
constexpr size_t ALLOC_SIZE = 100;
470+
size_t ALLOC_SIZE = COMMON_SIZE;
469471
constexpr size_t NUM_POINTERS = 100;
470472
umf::pool_unique_handle_t pool = makePool();
471473

0 commit comments

Comments
 (0)