Skip to content

Commit 8c1f929

Browse files
committed
Minimum size of allocation in case of /dev/dax device is 2 MB
The minimum size of an allocation in case of a /dev/dax device is 2 MB. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent b39d6f8 commit 8c1f929

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/ipcFixtures.hpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222

2323
#ifdef UMF_TEST_PROVIDER_FREE_NOT_SUPPORTED
2424
#define get_umf_result_of_free(expected_result) UMF_RESULT_ERROR_NOT_SUPPORTED
25+
// the minimum size for a /dev/dax device
26+
constexpr size_t COMMON_SIZE = 2 * 1024 * 1024; // 2MB
2527
#else
2628
#define get_umf_result_of_free(expected_result) (expected_result)
29+
constexpr size_t COMMON_SIZE = 100;
2730
#endif
2831

2932
class MemoryAccessor {
@@ -164,7 +167,7 @@ TEST_P(umfIpcTest, GetIPCHandleSizeInvalidArgs) {
164167
}
165168

166169
TEST_P(umfIpcTest, GetIPCHandleInvalidArgs) {
167-
constexpr size_t SIZE = 100;
170+
constexpr size_t SIZE = COMMON_SIZE;
168171
umf_ipc_handle_t ipcHandle = nullptr;
169172
size_t handleSize = 0;
170173
umf_result_t ret = umfGetIPCHandle(nullptr, &ipcHandle, &handleSize);
@@ -189,7 +192,7 @@ TEST_P(umfIpcTest, GetIPCHandleInvalidArgs) {
189192
}
190193

191194
TEST_P(umfIpcTest, BasicFlow) {
192-
constexpr size_t SIZE = 100;
195+
constexpr size_t SIZE = COMMON_SIZE;
193196
std::vector<int> expected_data(SIZE);
194197
umf::pool_unique_handle_t pool = makePool();
195198
int *ptr = (int *)umfPoolMalloc(pool.get(), SIZE * sizeof(int));
@@ -263,7 +266,7 @@ TEST_P(umfIpcTest, BasicFlow) {
263266
}
264267

265268
TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
266-
constexpr size_t SIZE = 100;
269+
constexpr size_t SIZE = COMMON_SIZE;
267270
constexpr size_t NUM_ALLOCS = 100;
268271
constexpr size_t NUM_POOLS = 4;
269272
void *ptrs[NUM_ALLOCS];
@@ -321,7 +324,7 @@ TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
321324
}
322325

323326
TEST_P(umfIpcTest, AllocFreeAllocTest) {
324-
constexpr size_t SIZE = 64 * 1024;
327+
constexpr size_t SIZE = (64 * 1024 > COMMON_SIZE) ? 64 * 1024 : COMMON_SIZE;
325328
umf::pool_unique_handle_t pool = makePool();
326329
void *ptr = umfPoolMalloc(pool.get(), SIZE);
327330
EXPECT_NE(ptr, nullptr);
@@ -381,7 +384,7 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
381384
}
382385

383386
TEST_P(umfIpcTest, openInTwoPools) {
384-
constexpr size_t SIZE = 100;
387+
constexpr size_t SIZE = COMMON_SIZE;
385388
std::vector<int> expected_data(SIZE);
386389
umf::pool_unique_handle_t pool1 = makePool();
387390
umf::pool_unique_handle_t pool2 = makePool();
@@ -435,7 +438,7 @@ TEST_P(umfIpcTest, openInTwoPools) {
435438

436439
TEST_P(umfIpcTest, ConcurrentGetPutHandles) {
437440
std::vector<void *> ptrs;
438-
constexpr size_t ALLOC_SIZE = 100;
441+
constexpr size_t ALLOC_SIZE = COMMON_SIZE;
439442
constexpr size_t NUM_POINTERS = 100;
440443
umf::pool_unique_handle_t pool = makePool();
441444

@@ -483,7 +486,7 @@ TEST_P(umfIpcTest, ConcurrentGetPutHandles) {
483486

484487
TEST_P(umfIpcTest, ConcurrentOpenCloseHandles) {
485488
std::vector<void *> ptrs;
486-
constexpr size_t ALLOC_SIZE = 100;
489+
constexpr size_t ALLOC_SIZE = COMMON_SIZE;
487490
constexpr size_t NUM_POINTERS = 100;
488491
umf::pool_unique_handle_t pool = makePool();
489492

0 commit comments

Comments
 (0)