Skip to content

Commit 7ad3d15

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

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

test/ipcFixtures.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "pool.hpp"
1111
#include "test_helpers.h"
1212

13+
#include "umf/providers/provider_devdax_memory.h"
1314
#include <umf/ipc.h>
1415
#include <umf/memory_pool.h>
1516
#include <umf/memory_provider.h>
@@ -63,6 +64,21 @@ struct umfIpcTest : umf_test::test,
6364
test::SetUp();
6465
auto [pool_ops, pool_params, provider_ops, provider_params, accessor] =
6566
this->GetParam();
67+
68+
if (provider_ops == umfDevDaxMemoryProviderOps()) {
69+
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
70+
if (path == nullptr || path[0] == 0) {
71+
GTEST_SKIP()
72+
<< "Test skipped, UMF_TESTS_DEVDAX_PATH is not set";
73+
}
74+
75+
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
76+
if (size == nullptr || size[0] == 0) {
77+
GTEST_SKIP()
78+
<< "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set";
79+
}
80+
}
81+
6682
poolOps = pool_ops;
6783
poolParams = pool_params;
6884
providerOps = provider_ops;

test/provider_devdax_memory.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#include "cpp_helpers.hpp"
1515
#include "test_helpers.h"
1616

17+
#define UMF_TEST_PROVIDER_FREE_NOT_SUPPORTED 1
18+
#include "ipcFixtures.hpp"
19+
#undef UMF_TEST_PROVIDER_FREE_NOT_SUPPORTED
20+
1721
#include <umf/memory_provider.h>
1822
#include <umf/providers/provider_devdax_memory.h>
1923

@@ -179,14 +183,15 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) {
179183

180184
// positive tests using test_alloc_free_success
181185

182-
auto defaultParams = umfDevDaxMemoryProviderParamsDefault(
186+
auto defaultDevDaxParams = umfDevDaxMemoryProviderParamsDefault(
183187
getenv("UMF_TESTS_DEVDAX_PATH"),
184188
atol(getenv("UMF_TESTS_DEVDAX_SIZE") ? getenv("UMF_TESTS_DEVDAX_SIZE")
185189
: "0"));
186190

187191
INSTANTIATE_TEST_SUITE_P(devdaxProviderTest, umfProviderTest,
188192
::testing::Values(providerCreateExtParams{
189-
umfDevDaxMemoryProviderOps(), &defaultParams}));
193+
umfDevDaxMemoryProviderOps(),
194+
&defaultDevDaxParams}));
190195

191196
TEST_P(umfProviderTest, create_destroy) {}
192197

@@ -343,3 +348,15 @@ TEST_F(test, create_wrong_size_0) {
343348
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
344349
EXPECT_EQ(hProvider, nullptr);
345350
}
351+
352+
HostMemoryAccessor hostAccessor;
353+
354+
static std::vector<ipcTestParams> ipcProxyPoolTestParamsList = {
355+
{umfProxyPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
356+
&defaultDevDaxParams, &hostAccessor},
357+
};
358+
359+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);
360+
361+
INSTANTIATE_TEST_SUITE_P(DevDaxProviderProxyPoolTest, umfIpcTest,
362+
::testing::ValuesIn(ipcProxyPoolTestParamsList));

0 commit comments

Comments
 (0)