Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,20 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
NAME jemalloc_coarse_file
SRCS pools/jemalloc_coarse_file.cpp malloc_compliance_tests.cpp
LIBS jemalloc_pool)
add_umf_test(
NAME jemalloc_coarse_devdax
SRCS pools/jemalloc_coarse_devdax.cpp malloc_compliance_tests.cpp
LIBS jemalloc_pool)
endif()

# This test requires Linux-only file memory provider
if(UMF_POOL_SCALABLE_ENABLED)
add_umf_test(
NAME scalable_coarse_file SRCS pools/scalable_coarse_file.cpp
malloc_compliance_tests.cpp)
add_umf_test(
NAME scalable_coarse_devdax SRCS pools/scalable_coarse_devdax.cpp
malloc_compliance_tests.cpp)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND UMF_BUILD_FUZZTESTS)
Expand Down
5 changes: 2 additions & 3 deletions test/malloc_compliance_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ void calloc_compliance_test(umf_memory_pool_handle_t hPool) {
// Checking that the memory returned by calloc is zero filled
for (int i = 0; i < ITERATIONS; i++) {
alloc_size = rand_alloc_size(MAX_ALLOC_SIZE);
alloc_ptr[i] = umfPoolCalloc(hPool, i + 1, alloc_size);
alloc_ptr[i] = umfPoolCalloc(hPool, 2, alloc_size);

ASSERT_NE(alloc_ptr[i], nullptr)
<< "calloc returned NULL, couldn't allocate much memory";
ASSERT_NE(bufferIsFilledWithChar(alloc_ptr[i], alloc_size * (i + 1), 0),
0)
ASSERT_NE(bufferIsFilledWithChar(alloc_ptr[i], 2 * alloc_size, 0), 0)
<< "Memory returned by calloc was not zeroed";
}
free_memory(hPool, alloc_ptr);
Expand Down
18 changes: 18 additions & 0 deletions test/poolFixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "pool.hpp"
#include "provider.hpp"
#include "umf/providers/provider_coarse.h"
#include "umf/providers/provider_devdax_memory.h"

#include <array>
#include <cstring>
Expand Down Expand Up @@ -66,6 +67,23 @@ struct umfPoolTest : umf_test::test,
::testing::WithParamInterface<poolCreateExtParams> {
void SetUp() override {
test::SetUp();

auto [pool_ops, pool_params, provider_ops, provider_params,
coarse_params] = this->GetParam();
if (provider_ops == umfDevDaxMemoryProviderOps()) {
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
if (path == nullptr || path[0] == 0) {
GTEST_SKIP()
<< "Test skipped, UMF_TESTS_DEVDAX_PATH is not set";
}

char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
if (size == nullptr || size[0] == 0) {
GTEST_SKIP()
<< "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set";
}
}

pool = poolCreateExtUnique(this->GetParam());
}

Expand Down
20 changes: 20 additions & 0 deletions test/pools/jemalloc_coarse_devdax.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (C) 2024 Intel Corporation
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "umf/pools/pool_jemalloc.h"
#include "umf/providers/provider_devdax_memory.h"

#include "pool_coarse.hpp"

auto coarseParams = umfCoarseMemoryProviderParamsDefault();
auto devdaxParams = umfDevDaxMemoryProviderParamsDefault(
getenv("UMF_TESTS_DEVDAX_PATH"), getenv("UMF_TESTS_DEVDAX_SIZE")
? atol(getenv("UMF_TESTS_DEVDAX_SIZE"))
: 0);

INSTANTIATE_TEST_SUITE_P(jemallocCoarseDevDaxTest, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfJemallocPoolOps(), nullptr,
umfDevDaxMemoryProviderOps(), &devdaxParams,
&coarseParams}));
3 changes: 2 additions & 1 deletion test/pools/jemalloc_coarse_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "umf/pools/pool_jemalloc.h"
#include "umf/providers/provider_file_memory.h"

#include "pool_coarse_file.hpp"
#include "pool_coarse.hpp"

auto coarseParams = umfCoarseMemoryProviderParamsDefault();
auto fileParams = umfFileMemoryProviderParamsDefault(FILE_PATH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef UMF_TEST_POOL_COARSE_FILE_HPP
#define UMF_TEST_POOL_COARSE_FILE_HPP 1
#ifndef UMF_TEST_POOL_COARSE_HPP
#define UMF_TEST_POOL_COARSE_HPP 1

#include "umf/providers/provider_coarse.h"
#include "umf/providers/provider_file_memory.h"

#include "pool.hpp"
#include "poolFixtures.hpp"

using umf_test::test;
using namespace umf_test;

#define FILE_PATH ((char *)"/tmp/file_provider")
#define FILE_PATH ((char *)"tmp_file_provider")

#endif /* UMF_TEST_POOL_COARSE_FILE_HPP */
#endif /* UMF_TEST_POOL_COARSE_HPP */
20 changes: 20 additions & 0 deletions test/pools/scalable_coarse_devdax.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (C) 2024 Intel Corporation
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "umf/pools/pool_scalable.h"
#include "umf/providers/provider_devdax_memory.h"

#include "pool_coarse.hpp"

auto coarseParams = umfCoarseMemoryProviderParamsDefault();
auto devdaxParams = umfDevDaxMemoryProviderParamsDefault(
getenv("UMF_TESTS_DEVDAX_PATH"), getenv("UMF_TESTS_DEVDAX_SIZE")
? atol(getenv("UMF_TESTS_DEVDAX_SIZE"))
: 0);

INSTANTIATE_TEST_SUITE_P(scalableCoarseDevDaxTest, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfScalablePoolOps(), nullptr,
umfDevDaxMemoryProviderOps(), &devdaxParams,
&coarseParams}));
3 changes: 2 additions & 1 deletion test/pools/scalable_coarse_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "umf/pools/pool_scalable.h"
#include "umf/providers/provider_file_memory.h"

#include "pool_coarse_file.hpp"
#include "pool_coarse.hpp"

auto coarseParams = umfCoarseMemoryProviderParamsDefault();
auto fileParams = umfFileMemoryProviderParamsDefault(FILE_PATH);
Expand Down
34 changes: 34 additions & 0 deletions test/supp/drd-umf_test-jemalloc_coarse_devdax.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
False-positive ConflictingAccess in libjemalloc.so
drd:ConflictingAccess
obj:*/libjemalloc.so*
...
fun:mallocx
...
}

{
False-positive ConflictingAccess in libjemalloc.so
drd:ConflictingAccess
obj:*/libjemalloc.so*
...
fun:op_free
...
}

{
False-positive ConflictingAccess in libjemalloc.so
drd:ConflictingAccess
obj:*/libjemalloc.so*
...
fun:__nptl_deallocate_tsd
...
}

{
False-positive ConflictingAccess in critnib_insert
drd:ConflictingAccess
fun:store
fun:critnib_insert
...
}
49 changes: 49 additions & 0 deletions test/supp/drd-umf_test-scalable_coarse_devdax.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
False-positive ConflictingAccess in libtbbmalloc.so
drd:ConflictingAccess
obj:*/libtbbmalloc.so*
}

{
False-positive ConflictingAccess in libtbbmalloc.so
drd:ConflictingAccess
obj:*/libtbbmalloc.so*
...
fun:tbb_malloc
...
}

{
False-positive ConflictingAccess in libtbbmalloc.so
drd:ConflictingAccess
obj:*/libtbbmalloc.so*
...
fun:tbb_aligned_malloc
...
}

{
False-positive ConflictingAccess in libtbbmalloc.so
drd:ConflictingAccess
obj:*/libtbbmalloc.so*
...
fun:tbb_free
...
}

{
False-positive ConflictingAccess in libtbbmalloc.so
drd:ConflictingAccess
obj:*/libtbbmalloc.so*
...
fun:__nptl_deallocate_tsd
...
}

{
False-positive ConflictingAccess in _Z22pow2AlignedAllocHelperP17umf_memory_pool_t
drd:ConflictingAccess
fun:memset
fun:_Z22pow2AlignedAllocHelperP17umf_memory_pool_t
...
}
34 changes: 34 additions & 0 deletions test/supp/helgrind-umf_test-jemalloc_coarse_devdax.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
False-positive Race in libjemalloc.so
Helgrind:Race
obj:*/libjemalloc.so*
...
fun:mallocx
...
}

{
False-positive Race in libjemalloc.so
Helgrind:Race
obj:*/libjemalloc.so*
...
fun:op_free
...
}

{
False-positive Race in libjemalloc.so
Helgrind:Race
obj:*/libjemalloc.so*
...
fun:__nptl_deallocate_tsd
...
}

{
False-positive Race in critnib_insert
Helgrind:Race
fun:store
fun:critnib_insert
...
}
49 changes: 49 additions & 0 deletions test/supp/helgrind-umf_test-scalable_coarse_devdax.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
False-positive Race in libtbbmalloc.so
Helgrind:Race
obj:*/libtbbmalloc.so*
}

{
False-positive Race in libtbbmalloc.so
Helgrind:Race
obj:*/libtbbmalloc.so*
...
fun:tbb_malloc
...
}

{
False-positive Race in libtbbmalloc.so
Helgrind:Race
obj:*/libtbbmalloc.so*
...
fun:tbb_aligned_malloc
...
}

{
False-positive Race in libtbbmalloc.so
Helgrind:Race
obj:*/libtbbmalloc.so*
...
fun:tbb_free
...
}

{
False-positive Race in libtbbmalloc.so
Helgrind:Race
obj:*/libtbbmalloc.so*
...
fun:__nptl_deallocate_tsd
...
}

{
False-positive Race in _Z22pow2AlignedAllocHelperP17umf_memory_pool_t
Helgrind:Race
fun:memset
fun:_Z22pow2AlignedAllocHelperP17umf_memory_pool_t
...
}
Loading