Skip to content

Commit 79b8d2a

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

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-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>
@@ -60,6 +61,21 @@ struct umfIpcTest : umf_test::test,
6061
test::SetUp();
6162
auto [pool_ops, pool_params, provider_ops, provider_params, accessor,
6263
free_not_supp] = this->GetParam();
64+
65+
if (provider_ops == umfDevDaxMemoryProviderOps()) {
66+
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
67+
if (path == nullptr || path[0] == 0) {
68+
GTEST_SKIP()
69+
<< "Test skipped, UMF_TESTS_DEVDAX_PATH is not set";
70+
}
71+
72+
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
73+
if (size == nullptr || size[0] == 0) {
74+
GTEST_SKIP()
75+
<< "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set";
76+
}
77+
}
78+
6379
poolOps = pool_ops;
6480
poolParams = pool_params;
6581
providerOps = provider_ops;

test/provider_devdax_memory.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "base.hpp"
1313

1414
#include "cpp_helpers.hpp"
15+
#include "ipcFixtures.hpp"
1516
#include "test_helpers.h"
1617

1718
#include <umf/memory_provider.h>
@@ -179,14 +180,15 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) {
179180

180181
// positive tests using test_alloc_free_success
181182

182-
auto defaultParams = umfDevDaxMemoryProviderParamsDefault(
183+
auto defaultDevDaxParams = umfDevDaxMemoryProviderParamsDefault(
183184
getenv("UMF_TESTS_DEVDAX_PATH"),
184185
atol(getenv("UMF_TESTS_DEVDAX_SIZE") ? getenv("UMF_TESTS_DEVDAX_SIZE")
185186
: "0"));
186187

187188
INSTANTIATE_TEST_SUITE_P(devdaxProviderTest, umfProviderTest,
188189
::testing::Values(providerCreateExtParams{
189-
umfDevDaxMemoryProviderOps(), &defaultParams}));
190+
umfDevDaxMemoryProviderOps(),
191+
&defaultDevDaxParams}));
190192

191193
TEST_P(umfProviderTest, create_destroy) {}
192194

@@ -349,3 +351,15 @@ TEST_F(test, create_wrong_size_0) {
349351
EXPECT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
350352
EXPECT_EQ(hProvider, nullptr);
351353
}
354+
355+
HostMemoryAccessor hostAccessor;
356+
357+
static std::vector<ipcTestParams> ipcProxyPoolTestParamsList = {
358+
{umfProxyPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
359+
&defaultDevDaxParams, &hostAccessor, true},
360+
};
361+
362+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfIpcTest);
363+
364+
INSTANTIATE_TEST_SUITE_P(DevDaxProviderProxyPoolTest, umfIpcTest,
365+
::testing::ValuesIn(ipcProxyPoolTestParamsList));

0 commit comments

Comments
 (0)