Skip to content

Commit 96a335c

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

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
@@ -14,6 +14,7 @@
1414
#include <umf/memory_pool.h>
1515
#include <umf/memory_provider.h>
1616
#include <umf/pools/pool_proxy.h>
17+
#include <umf/providers/provider_devdax_memory.h>
1718

1819
#include <cstring>
1920
#include <numeric>
@@ -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

@@ -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)