Skip to content

Commit dee91d1

Browse files
committed
Add IPC tests (umfIpcTest) to the file provider
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent bf6dc3e commit dee91d1

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
283283
NAME provider_file_memory
284284
SRCS provider_file_memory.cpp
285285
LIBS ${UMF_UTILS_FOR_TEST})
286+
add_umf_test(
287+
NAME provider_file_memory_ipc
288+
SRCS provider_file_memory_ipc.cpp
289+
LIBS ${UMF_UTILS_FOR_TEST} ${LIB_JEMALLOC_POOL})
286290

287291
# This test requires Linux-only file memory provider
288292
if(UMF_POOL_JEMALLOC_ENABLED)

test/provider_file_memory_ipc.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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/memory_provider.h>
6+
#include <umf/providers/provider_file_memory.h>
7+
#ifdef UMF_POOL_JEMALLOC_ENABLED
8+
#include <umf/pools/pool_jemalloc.h>
9+
#endif
10+
#ifdef UMF_POOL_SCALABLE_ENABLED
11+
#include <umf/pools/pool_scalable.h>
12+
#endif
13+
14+
#include "ipcFixtures.hpp"
15+
16+
using umf_test::test;
17+
18+
#define FILE_PATH ((char *)"tmp_file")
19+
20+
umf_file_memory_provider_params_t get_file_params_shared(char *path) {
21+
umf_file_memory_provider_params_t file_params =
22+
umfFileMemoryProviderParamsDefault(path);
23+
file_params.visibility = UMF_MEM_MAP_SHARED;
24+
return file_params;
25+
}
26+
27+
umf_file_memory_provider_params_t file_params_shared =
28+
get_file_params_shared(FILE_PATH);
29+
30+
HostMemoryAccessor hostAccessor;
31+
32+
static std::vector<ipcTestParams> ipcManyPoolsTestParamsList = {
33+
// TODO: enable it when sizes of allocations in ipcFixtures.hpp are fixed
34+
// {umfProxyPoolOps(), nullptr, umfFileMemoryProviderOps(),
35+
// &file_params_shared, &hostAccessor, true},
36+
#ifdef UMF_POOL_JEMALLOC_ENABLED
37+
{umfJemallocPoolOps(), nullptr, umfFileMemoryProviderOps(),
38+
&file_params_shared, &hostAccessor, false},
39+
#endif
40+
#ifdef UMF_POOL_SCALABLE_ENABLED
41+
{umfScalablePoolOps(), nullptr, umfFileMemoryProviderOps(),
42+
&file_params_shared, &hostAccessor, false},
43+
#endif
44+
};
45+
46+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);
47+
48+
INSTANTIATE_TEST_SUITE_P(FileProviderDifferentPoolsTest, umfIpcTest,
49+
::testing::ValuesIn(ipcManyPoolsTestParamsList));
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
Conditional variable destruction false-positive
3+
drd:CondErr
4+
...
5+
fun:pthread_cond_destroy@*
6+
...
7+
}

0 commit comments

Comments
 (0)