Skip to content

Commit 8cd056a

Browse files
committed
Extract IPC tests from devdax tests
Extract the IPC tests from the devdax tests to a separate file, because the IPC tests do not work with the proxy library yet and they should be run separately. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent efc2b01 commit 8cd056a

File tree

3 files changed

+63
-45
lines changed

3 files changed

+63
-45
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
274274
add_umf_test(
275275
NAME provider_devdax_memory
276276
SRCS provider_devdax_memory.cpp
277+
LIBS ${UMF_UTILS_FOR_TEST})
278+
add_umf_test(
279+
NAME provider_devdax_memory_ipc
280+
SRCS provider_devdax_memory_ipc.cpp
277281
LIBS ${UMF_UTILS_FOR_TEST} ${LIB_JEMALLOC_POOL})
278282
add_umf_test(
279283
NAME provider_file_memory

test/provider_devdax_memory.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@
1212
#include "base.hpp"
1313

1414
#include "cpp_helpers.hpp"
15-
#include "ipcFixtures.hpp"
1615
#include "test_helpers.h"
1716

1817
#include <umf/memory_provider.h>
1918
#include <umf/providers/provider_devdax_memory.h>
20-
#ifdef UMF_POOL_JEMALLOC_ENABLED
21-
#include <umf/pools/pool_jemalloc.h>
22-
#endif
23-
#ifdef UMF_POOL_SCALABLE_ENABLED
24-
#include <umf/pools/pool_scalable.h>
25-
#endif
2619

2720
using umf_test::test;
2821

@@ -357,41 +350,3 @@ TEST_F(test, create_wrong_size_0) {
357350
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
358351
EXPECT_EQ(hProvider, nullptr);
359352
}
360-
361-
HostMemoryAccessor hostAccessor;
362-
363-
static std::vector<ipcTestParams> getIpcProxyPoolTestParamsList(void) {
364-
std::vector<ipcTestParams> ipcProxyPoolTestParamsList = {};
365-
366-
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
367-
if (path == nullptr || path[0] == 0) {
368-
// Test skipped, UMF_TESTS_DEVDAX_PATH is not set
369-
return ipcProxyPoolTestParamsList;
370-
}
371-
372-
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
373-
if (size == nullptr || size[0] == 0) {
374-
// Test skipped, UMF_TESTS_DEVDAX_PATH is not set
375-
return ipcProxyPoolTestParamsList;
376-
}
377-
378-
ipcProxyPoolTestParamsList = {
379-
{umfProxyPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
380-
&defaultDevDaxParams, &hostAccessor, true},
381-
#ifdef UMF_POOL_JEMALLOC_ENABLED
382-
{umfJemallocPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
383-
&defaultDevDaxParams, &hostAccessor, false},
384-
#endif
385-
#ifdef UMF_POOL_SCALABLE_ENABLED
386-
{umfScalablePoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
387-
&defaultDevDaxParams, &hostAccessor, false},
388-
#endif
389-
};
390-
391-
return ipcProxyPoolTestParamsList;
392-
}
393-
394-
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);
395-
396-
INSTANTIATE_TEST_SUITE_P(DevDaxProviderDifferentPoolsTest, umfIpcTest,
397-
::testing::ValuesIn(getIpcProxyPoolTestParamsList()));

test/provider_devdax_memory_ipc.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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_devdax_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+
auto defaultDevDaxParams = umfDevDaxMemoryProviderParamsDefault(
19+
getenv("UMF_TESTS_DEVDAX_PATH"),
20+
atol(getenv("UMF_TESTS_DEVDAX_SIZE") ? getenv("UMF_TESTS_DEVDAX_SIZE")
21+
: "0"));
22+
23+
HostMemoryAccessor hostAccessor;
24+
25+
static std::vector<ipcTestParams> getIpcProxyPoolTestParamsList(void) {
26+
std::vector<ipcTestParams> ipcProxyPoolTestParamsList = {};
27+
28+
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
29+
if (path == nullptr || path[0] == 0) {
30+
// Test skipped, UMF_TESTS_DEVDAX_PATH is not set
31+
return ipcProxyPoolTestParamsList;
32+
}
33+
34+
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
35+
if (size == nullptr || size[0] == 0) {
36+
// Test skipped, UMF_TESTS_DEVDAX_PATH is not set
37+
return ipcProxyPoolTestParamsList;
38+
}
39+
40+
ipcProxyPoolTestParamsList = {
41+
{umfProxyPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
42+
&defaultDevDaxParams, &hostAccessor, true},
43+
#ifdef UMF_POOL_JEMALLOC_ENABLED
44+
{umfJemallocPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
45+
&defaultDevDaxParams, &hostAccessor, false},
46+
#endif
47+
#ifdef UMF_POOL_SCALABLE_ENABLED
48+
{umfScalablePoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
49+
&defaultDevDaxParams, &hostAccessor, false},
50+
#endif
51+
};
52+
53+
return ipcProxyPoolTestParamsList;
54+
}
55+
56+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);
57+
58+
INSTANTIATE_TEST_SUITE_P(DevDaxProviderDifferentPoolsTest, umfIpcTest,
59+
::testing::ValuesIn(getIpcProxyPoolTestParamsList()));

0 commit comments

Comments
 (0)