Skip to content

Commit 72f4caa

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

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

test/ipcFixtures.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ struct umfIpcTest : umf_test::test,
6363
test::SetUp();
6464
auto [pool_ops, pool_params, provider_ops, provider_params, accessor] =
6565
this->GetParam();
66+
67+
if (provider_ops == umfDevDaxMemoryProviderOps()) {
68+
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
69+
if (path == nullptr || path[0] == 0) {
70+
GTEST_SKIP()
71+
<< "Test skipped, UMF_TESTS_DEVDAX_PATH is not set";
72+
}
73+
74+
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
75+
if (size == nullptr || size[0] == 0) {
76+
GTEST_SKIP()
77+
<< "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set";
78+
}
79+
}
80+
6681
poolOps = pool_ops;
6782
poolParams = pool_params;
6883
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

@@ -349,3 +354,15 @@ TEST_F(test, create_wrong_size_0) {
349354
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
350355
EXPECT_EQ(hProvider, nullptr);
351356
}
357+
358+
HostMemoryAccessor hostAccessor;
359+
360+
static std::vector<ipcTestParams> ipcProxyPoolTestParamsList = {
361+
{umfProxyPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
362+
&defaultDevDaxParams, &hostAccessor},
363+
};
364+
365+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);
366+
367+
INSTANTIATE_TEST_SUITE_P(DevDaxProviderProxyPoolTest, umfIpcTest,
368+
::testing::ValuesIn(ipcProxyPoolTestParamsList));

0 commit comments

Comments
 (0)