Skip to content

Commit 9c91404

Browse files
committed
Add the jemalloc_coarse_file and scalable_coarse_file tests
Add the jemalloc_coarse_file and scalable_coarse_file tests that test the coarse provider with upstream file provider and two pool managers: jemalloc and scalable pool. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
1 parent 29c4aac commit 9c91404

8 files changed

+236
-4
lines changed

test/CMakeLists.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ if(UMF_BUILD_LIBUMF_POOL_DISJOINT)
168168
endif()
169169

170170
if(UMF_BUILD_LIBUMF_POOL_DISJOINT
171-
AND UMF_BUILD_LIBUMF_POOL_JEMALLOC
171+
AND UMF_POOL_JEMALLOC_ENABLED
172172
AND UMF_POOL_SCALABLE_ENABLED
173173
AND (NOT UMF_DISABLE_HWLOC))
174174
add_umf_test(
@@ -177,7 +177,7 @@ if(UMF_BUILD_LIBUMF_POOL_DISJOINT
177177
LIBS disjoint_pool jemalloc_pool ${JEMALLOC_LIBRARIES})
178178
endif()
179179

180-
if(UMF_BUILD_LIBUMF_POOL_JEMALLOC AND (NOT UMF_DISABLE_HWLOC))
180+
if(UMF_POOL_JEMALLOC_ENABLED AND (NOT UMF_DISABLE_HWLOC))
181181
add_umf_test(
182182
NAME jemalloc_pool
183183
SRCS pools/jemalloc_pool.cpp malloc_compliance_tests.cpp
@@ -190,8 +190,7 @@ if(UMF_POOL_SCALABLE_ENABLED AND (NOT UMF_DISABLE_HWLOC))
190190
endif()
191191

192192
if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
193-
# only for
194-
# Linux now
193+
# only for Linux now
195194
if(PkgConfig_FOUND)
196195
pkg_check_modules(LIBNUMA numa)
197196
endif()
@@ -257,6 +256,22 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
257256
NAME provider_file_memory
258257
SRCS provider_file_memory.cpp
259258
LIBS ${UMF_UTILS_FOR_TEST})
259+
260+
# This test requires Linux-only file memory provider
261+
if(UMF_POOL_JEMALLOC_ENABLED)
262+
add_umf_test(
263+
NAME jemalloc_coarse_file
264+
SRCS pools/jemalloc_coarse_file.cpp malloc_compliance_tests.cpp
265+
LIBS jemalloc_pool)
266+
endif()
267+
268+
# This test requires Linux-only file memory provider
269+
if(UMF_POOL_SCALABLE_ENABLED)
270+
add_umf_test(
271+
NAME scalable_coarse_file SRCS pools/scalable_coarse_file.cpp
272+
malloc_compliance_tests.cpp)
273+
endif()
274+
260275
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND UMF_BUILD_FUZZTESTS)
261276
add_subdirectory(fuzz)
262277
endif()

test/pools/jemalloc_coarse_file.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
7+
#include "pool_coarse_file.hpp"
8+
9+
auto coarseParams = umfCoarseMemoryProviderParamsDefault();
10+
auto fileParams = umfFileMemoryProviderParamsDefault(FILE_PATH);
11+
12+
INSTANTIATE_TEST_SUITE_P(jemallocCoarseFileTest, umfPoolTest,
13+
::testing::Values(poolCreateExtParams{
14+
umfJemallocPoolOps(), nullptr,
15+
umfFileMemoryProviderOps(), &fileParams,
16+
&coarseParams}));

test/pools/pool_coarse_file.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
#ifndef UMF_TEST_POOL_COARSE_FILE_HPP
6+
#define UMF_TEST_POOL_COARSE_FILE_HPP 1
7+
8+
#include "umf/providers/provider_coarse.h"
9+
#include "umf/providers/provider_file_memory.h"
10+
11+
#include "pool.hpp"
12+
#include "poolFixtures.hpp"
13+
14+
using umf_test::test;
15+
using namespace umf_test;
16+
17+
#define FILE_PATH ((char *)"/tmp/file_provider")
18+
19+
#endif /* UMF_TEST_POOL_COARSE_FILE_HPP */

test/pools/scalable_coarse_file.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
7+
#include "pool_coarse_file.hpp"
8+
9+
auto coarseParams = umfCoarseMemoryProviderParamsDefault();
10+
auto fileParams = umfFileMemoryProviderParamsDefault(FILE_PATH);
11+
12+
INSTANTIATE_TEST_SUITE_P(scalableCoarseFileTest, umfPoolTest,
13+
::testing::Values(poolCreateExtParams{
14+
umfScalablePoolOps(), nullptr,
15+
umfFileMemoryProviderOps(), &fileParams,
16+
&coarseParams}));
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+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
False-positive Race in libjemalloc.so
3+
Helgrind:Race
4+
obj:*/libjemalloc.so*
5+
...
6+
fun:mallocx
7+
...
8+
}
9+
10+
{
11+
False-positive Race in libjemalloc.so
12+
Helgrind:Race
13+
obj:*/libjemalloc.so*
14+
...
15+
fun:op_free
16+
...
17+
}
18+
19+
{
20+
False-positive Race in libjemalloc.so
21+
Helgrind:Race
22+
obj:*/libjemalloc.so*
23+
...
24+
fun:__nptl_deallocate_tsd
25+
...
26+
}
27+
28+
{
29+
False-positive Race in critnib_insert
30+
Helgrind:Race
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 Race in libtbbmalloc.so
3+
Helgrind:Race
4+
obj:*/libtbbmalloc.so*
5+
}
6+
7+
{
8+
False-positive Race in libtbbmalloc.so
9+
Helgrind:Race
10+
obj:*/libtbbmalloc.so*
11+
...
12+
fun:tbb_malloc
13+
...
14+
}
15+
16+
{
17+
False-positive Race in libtbbmalloc.so
18+
Helgrind:Race
19+
obj:*/libtbbmalloc.so*
20+
...
21+
fun:tbb_aligned_malloc
22+
...
23+
}
24+
25+
{
26+
False-positive Race in libtbbmalloc.so
27+
Helgrind:Race
28+
obj:*/libtbbmalloc.so*
29+
...
30+
fun:tbb_free
31+
...
32+
}
33+
34+
{
35+
False-positive Race in libtbbmalloc.so
36+
Helgrind:Race
37+
obj:*/libtbbmalloc.so*
38+
...
39+
fun:__nptl_deallocate_tsd
40+
...
41+
}
42+
43+
{
44+
False-positive Race in _Z22pow2AlignedAllocHelperP17umf_memory_pool_t
45+
Helgrind:Race
46+
fun:memset
47+
fun:_Z22pow2AlignedAllocHelperP17umf_memory_pool_t
48+
...
49+
}

0 commit comments

Comments
 (0)