Skip to content

Commit

Permalink
Add IPC tests (umfIpcTest) to the file provider
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
  • Loading branch information
ldorau committed Nov 6, 2024
1 parent 4652e08 commit 5c8e46d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
NAME provider_file_memory
SRCS provider_file_memory.cpp
LIBS ${UMF_UTILS_FOR_TEST})
add_umf_test(
NAME provider_file_memory_ipc
SRCS provider_file_memory_ipc.cpp
LIBS ${UMF_UTILS_FOR_TEST} ${LIB_JEMALLOC_POOL})

# This test requires Linux-only file memory provider
if(UMF_POOL_JEMALLOC_ENABLED)
Expand Down
49 changes: 49 additions & 0 deletions test/provider_file_memory_ipc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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/memory_provider.h>
#include <umf/providers/provider_file_memory.h>
#ifdef UMF_POOL_JEMALLOC_ENABLED
#include <umf/pools/pool_jemalloc.h>
#endif
#ifdef UMF_POOL_SCALABLE_ENABLED
#include <umf/pools/pool_scalable.h>
#endif

#include "ipcFixtures.hpp"

using umf_test::test;

#define FILE_PATH ((char *)"tmp_file")

umf_file_memory_provider_params_t get_file_params_shared(char *path) {
umf_file_memory_provider_params_t file_params =
umfFileMemoryProviderParamsDefault(path);
file_params.visibility = UMF_MEM_MAP_SHARED;
return file_params;
}

umf_file_memory_provider_params_t file_params_shared =
get_file_params_shared(FILE_PATH);

HostMemoryAccessor hostAccessor;

static std::vector<ipcTestParams> ipcManyPoolsTestParamsList = {
// TODO: enable it when sizes of allocations in ipcFixtures.hpp are fixed
// {umfProxyPoolOps(), nullptr, umfFileMemoryProviderOps(),
// &file_params_shared, &hostAccessor, true},
#ifdef UMF_POOL_JEMALLOC_ENABLED
{umfJemallocPoolOps(), nullptr, umfFileMemoryProviderOps(),
&file_params_shared, &hostAccessor, false},
#endif
#ifdef UMF_POOL_SCALABLE_ENABLED
{umfScalablePoolOps(), nullptr, umfFileMemoryProviderOps(),
&file_params_shared, &hostAccessor, false},
#endif
};

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);

INSTANTIATE_TEST_SUITE_P(FileProviderDifferentPoolsTest, umfIpcTest,
::testing::ValuesIn(ipcManyPoolsTestParamsList));
7 changes: 7 additions & 0 deletions test/supp/drd-umf_test-provider_file_memory_ipc.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Conditional variable destruction false-positive
drd:CondErr
...
fun:pthread_cond_destroy@*
...
}

0 comments on commit 5c8e46d

Please sign in to comment.