Skip to content

Commit 8e0ec14

Browse files
authored
Merge pull request #822 from ldorau/Add_the_jemalloc_coarse_devdax_and_scalable_coarse_devdax_tests
Add the jemalloc_coarse_devdax and scalable_coarse_devdax tests
2 parents 488c715 + a7f8c8f commit 8e0ec14

12 files changed

+241
-10
lines changed

test/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,20 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
263263
NAME jemalloc_coarse_file
264264
SRCS pools/jemalloc_coarse_file.cpp malloc_compliance_tests.cpp
265265
LIBS jemalloc_pool)
266+
add_umf_test(
267+
NAME jemalloc_coarse_devdax
268+
SRCS pools/jemalloc_coarse_devdax.cpp malloc_compliance_tests.cpp
269+
LIBS jemalloc_pool)
266270
endif()
267271

268272
# This test requires Linux-only file memory provider
269273
if(UMF_POOL_SCALABLE_ENABLED)
270274
add_umf_test(
271275
NAME scalable_coarse_file SRCS pools/scalable_coarse_file.cpp
272276
malloc_compliance_tests.cpp)
277+
add_umf_test(
278+
NAME scalable_coarse_devdax SRCS pools/scalable_coarse_devdax.cpp
279+
malloc_compliance_tests.cpp)
273280
endif()
274281

275282
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND UMF_BUILD_FUZZTESTS)

test/malloc_compliance_tests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ void calloc_compliance_test(umf_memory_pool_handle_t hPool) {
8585
// Checking that the memory returned by calloc is zero filled
8686
for (int i = 0; i < ITERATIONS; i++) {
8787
alloc_size = rand_alloc_size(MAX_ALLOC_SIZE);
88-
alloc_ptr[i] = umfPoolCalloc(hPool, i + 1, alloc_size);
88+
alloc_ptr[i] = umfPoolCalloc(hPool, 2, alloc_size);
8989

9090
ASSERT_NE(alloc_ptr[i], nullptr)
9191
<< "calloc returned NULL, couldn't allocate much memory";
92-
ASSERT_NE(bufferIsFilledWithChar(alloc_ptr[i], alloc_size * (i + 1), 0),
93-
0)
92+
ASSERT_NE(bufferIsFilledWithChar(alloc_ptr[i], 2 * alloc_size, 0), 0)
9493
<< "Memory returned by calloc was not zeroed";
9594
}
9695
free_memory(hPool, alloc_ptr);

test/poolFixtures.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "pool.hpp"
99
#include "provider.hpp"
1010
#include "umf/providers/provider_coarse.h"
11+
#include "umf/providers/provider_devdax_memory.h"
1112

1213
#include <array>
1314
#include <cstring>
@@ -66,6 +67,23 @@ struct umfPoolTest : umf_test::test,
6667
::testing::WithParamInterface<poolCreateExtParams> {
6768
void SetUp() override {
6869
test::SetUp();
70+
71+
auto [pool_ops, pool_params, provider_ops, provider_params,
72+
coarse_params] = this->GetParam();
73+
if (provider_ops == umfDevDaxMemoryProviderOps()) {
74+
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
75+
if (path == nullptr || path[0] == 0) {
76+
GTEST_SKIP()
77+
<< "Test skipped, UMF_TESTS_DEVDAX_PATH is not set";
78+
}
79+
80+
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
81+
if (size == nullptr || size[0] == 0) {
82+
GTEST_SKIP()
83+
<< "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set";
84+
}
85+
}
86+
6987
pool = poolCreateExtUnique(this->GetParam());
7088
}
7189

test/pools/jemalloc_coarse_devdax.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (C) 2024 Intel Corporation
2+
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#include "umf/pools/pool_jemalloc.h"
6+
#include "umf/providers/provider_devdax_memory.h"
7+
8+
#include "pool_coarse.hpp"
9+
10+
auto coarseParams = umfCoarseMemoryProviderParamsDefault();
11+
auto devdaxParams = umfDevDaxMemoryProviderParamsDefault(
12+
getenv("UMF_TESTS_DEVDAX_PATH"), getenv("UMF_TESTS_DEVDAX_SIZE")
13+
? atol(getenv("UMF_TESTS_DEVDAX_SIZE"))
14+
: 0);
15+
16+
INSTANTIATE_TEST_SUITE_P(jemallocCoarseDevDaxTest, umfPoolTest,
17+
::testing::Values(poolCreateExtParams{
18+
umfJemallocPoolOps(), nullptr,
19+
umfDevDaxMemoryProviderOps(), &devdaxParams,
20+
&coarseParams}));

test/pools/jemalloc_coarse_file.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
#include "umf/pools/pool_jemalloc.h"
6+
#include "umf/providers/provider_file_memory.h"
67

7-
#include "pool_coarse_file.hpp"
8+
#include "pool_coarse.hpp"
89

910
auto coarseParams = umfCoarseMemoryProviderParamsDefault();
1011
auto fileParams = umfFileMemoryProviderParamsDefault(FILE_PATH);

test/pools/pool_coarse_file.hpp renamed to test/pools/pool_coarse.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_TEST_POOL_COARSE_FILE_HPP
6-
#define UMF_TEST_POOL_COARSE_FILE_HPP 1
5+
#ifndef UMF_TEST_POOL_COARSE_HPP
6+
#define UMF_TEST_POOL_COARSE_HPP 1
77

88
#include "umf/providers/provider_coarse.h"
9-
#include "umf/providers/provider_file_memory.h"
109

1110
#include "pool.hpp"
1211
#include "poolFixtures.hpp"
1312

1413
using umf_test::test;
1514
using namespace umf_test;
1615

17-
#define FILE_PATH ((char *)"/tmp/file_provider")
16+
#define FILE_PATH ((char *)"tmp_file_provider")
1817

19-
#endif /* UMF_TEST_POOL_COARSE_FILE_HPP */
18+
#endif /* UMF_TEST_POOL_COARSE_HPP */

test/pools/scalable_coarse_devdax.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (C) 2024 Intel Corporation
2+
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#include "umf/pools/pool_scalable.h"
6+
#include "umf/providers/provider_devdax_memory.h"
7+
8+
#include "pool_coarse.hpp"
9+
10+
auto coarseParams = umfCoarseMemoryProviderParamsDefault();
11+
auto devdaxParams = umfDevDaxMemoryProviderParamsDefault(
12+
getenv("UMF_TESTS_DEVDAX_PATH"), getenv("UMF_TESTS_DEVDAX_SIZE")
13+
? atol(getenv("UMF_TESTS_DEVDAX_SIZE"))
14+
: 0);
15+
16+
INSTANTIATE_TEST_SUITE_P(scalableCoarseDevDaxTest, umfPoolTest,
17+
::testing::Values(poolCreateExtParams{
18+
umfScalablePoolOps(), nullptr,
19+
umfDevDaxMemoryProviderOps(), &devdaxParams,
20+
&coarseParams}));

test/pools/scalable_coarse_file.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
#include "umf/pools/pool_scalable.h"
6+
#include "umf/providers/provider_file_memory.h"
67

7-
#include "pool_coarse_file.hpp"
8+
#include "pool_coarse.hpp"
89

910
auto coarseParams = umfCoarseMemoryProviderParamsDefault();
1011
auto fileParams = umfFileMemoryProviderParamsDefault(FILE_PATH);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
False-positive ConflictingAccess in libjemalloc.so
3+
drd:ConflictingAccess
4+
obj:*/libjemalloc.so*
5+
...
6+
fun:mallocx
7+
...
8+
}
9+
10+
{
11+
False-positive ConflictingAccess in libjemalloc.so
12+
drd:ConflictingAccess
13+
obj:*/libjemalloc.so*
14+
...
15+
fun:op_free
16+
...
17+
}
18+
19+
{
20+
False-positive ConflictingAccess in libjemalloc.so
21+
drd:ConflictingAccess
22+
obj:*/libjemalloc.so*
23+
...
24+
fun:__nptl_deallocate_tsd
25+
...
26+
}
27+
28+
{
29+
False-positive ConflictingAccess in critnib_insert
30+
drd:ConflictingAccess
31+
fun:store
32+
fun:critnib_insert
33+
...
34+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
False-positive ConflictingAccess in libtbbmalloc.so
3+
drd:ConflictingAccess
4+
obj:*/libtbbmalloc.so*
5+
}
6+
7+
{
8+
False-positive ConflictingAccess in libtbbmalloc.so
9+
drd:ConflictingAccess
10+
obj:*/libtbbmalloc.so*
11+
...
12+
fun:tbb_malloc
13+
...
14+
}
15+
16+
{
17+
False-positive ConflictingAccess in libtbbmalloc.so
18+
drd:ConflictingAccess
19+
obj:*/libtbbmalloc.so*
20+
...
21+
fun:tbb_aligned_malloc
22+
...
23+
}
24+
25+
{
26+
False-positive ConflictingAccess in libtbbmalloc.so
27+
drd:ConflictingAccess
28+
obj:*/libtbbmalloc.so*
29+
...
30+
fun:tbb_free
31+
...
32+
}
33+
34+
{
35+
False-positive ConflictingAccess in libtbbmalloc.so
36+
drd:ConflictingAccess
37+
obj:*/libtbbmalloc.so*
38+
...
39+
fun:__nptl_deallocate_tsd
40+
...
41+
}
42+
43+
{
44+
False-positive ConflictingAccess in _Z22pow2AlignedAllocHelperP17umf_memory_pool_t
45+
drd:ConflictingAccess
46+
fun:memset
47+
fun:_Z22pow2AlignedAllocHelperP17umf_memory_pool_t
48+
...
49+
}

0 commit comments

Comments
 (0)