Skip to content

Commit f27926a

Browse files
committed
add names to test cases
1 parent 9d00875 commit f27926a

33 files changed

+300
-77
lines changed

test/coarse_lib.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,14 @@ INSTANTIATE_TEST_SUITE_P(
114114
CoarseWithMemoryStrategyTest, CoarseWithMemoryStrategyTest,
115115
::testing::Values(UMF_COARSE_MEMORY_STRATEGY_FASTEST,
116116
UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE,
117-
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE));
117+
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE),
118+
([](auto const &info) {
119+
static const char *names[] = {
120+
"UMF_COARSE_MEMORY_STRATEGY_FASTEST",
121+
"UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE",
122+
"UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE"};
123+
return std::string(names[info.index]);
124+
}));
118125

119126
TEST_P(CoarseWithMemoryStrategyTest, coarseTest_basic_provider) {
120127
umf_memory_provider_handle_t malloc_memory_provider;

test/common/pool.hpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,37 @@
2525
#include "provider.hpp"
2626
#include "utils/cpp_helpers.hpp"
2727

28+
typedef void *(*pfnPoolParamsCreate)();
29+
typedef umf_result_t (*pfnPoolParamsDestroy)(void *);
30+
31+
typedef void *(*pfnProviderParamsCreate)();
32+
typedef umf_result_t (*pfnProviderParamsDestroy)(void *);
33+
34+
using poolCreateExtParams =
35+
std::tuple<const umf_memory_pool_ops_t *, pfnPoolParamsCreate,
36+
pfnPoolParamsDestroy, const umf_memory_provider_ops_t *,
37+
pfnProviderParamsCreate, pfnProviderParamsDestroy>;
38+
39+
std::string poolCreateExtParamsNameGen(
40+
const testing::TestParamInfo<poolCreateExtParams> &info) {
41+
42+
const umf_memory_pool_ops_t *pool_ops = std::get<0>(info.param);
43+
const umf_memory_provider_ops_t *provider_ops = std::get<3>(info.param);
44+
45+
const char *poolName = NULL;
46+
const char *providerName = NULL;
47+
48+
pool_ops->get_name(NULL, &poolName);
49+
provider_ops->get_name(NULL, &providerName);
50+
51+
std::string poolParams =
52+
std::get<1>(info.param)
53+
? std::string("_w_params_") + std::to_string(info.index)
54+
: std::string("");
55+
56+
return std::string(poolName) + poolParams + "_" + providerName;
57+
}
58+
2859
namespace umf_test {
2960

3061
umf_memory_pool_handle_t

test/common/provider.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ typedef umf_result_t (*pfnProviderParamsDestroy)(void *);
2424
using providerCreateExtParams =
2525
std::tuple<const umf_memory_provider_ops_t *, void *>;
2626

27+
std::string providerCreateExtParamsNameGen(
28+
const testing::TestParamInfo<providerCreateExtParams> param) {
29+
const umf_memory_provider_ops_t *provider_ops = std::get<0>(param.param);
30+
31+
const char *providerName = NULL;
32+
provider_ops->get_name(NULL, &providerName);
33+
34+
return providerName;
35+
}
2736

2837
void providerCreateExt(providerCreateExtParams params,
2938
umf_test::provider_unique_handle_t *handle) {

test/disjoint_pool_file_prov.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ INSTANTIATE_TEST_SUITE_P(
3737
FileWithMemoryStrategyTest, FileWithMemoryStrategyTest,
3838
::testing::Values(UMF_COARSE_MEMORY_STRATEGY_FASTEST,
3939
UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE,
40-
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE));
40+
UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE),
41+
([](auto const &info) {
42+
const char *names[] = {"UMF_COARSE_MEMORY_STRATEGY_FASTEST",
43+
"UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE",
44+
"UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE"};
45+
return std::string(names[info.index]);
46+
}));
4147

4248
TEST_P(FileWithMemoryStrategyTest, disjointFileMallocPool_simple1) {
4349
umf_memory_provider_handle_t malloc_memory_provider = nullptr;

test/ipcAPI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,5 @@ INSTANTIATE_TEST_SUITE_P(umfIpcTestSuite, umfIpcTest,
128128
::testing::Values(ipcTestParams{
129129
umfProxyPoolOps(), nullptr, nullptr,
130130
&IPC_MOCK_PROVIDER_OPS, nullptr, nullptr,
131-
&hostMemoryAccessor}));
131+
&hostMemoryAccessor}),
132+
ipcTestParamsNameGen);

test/ipcFixtures.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,28 @@ using ipcTestParams =
6868
pfnProviderParamsCreate, pfnProviderParamsDestroy,
6969
MemoryAccessor *>;
7070

71+
std::string
72+
ipcTestParamsNameGen(const ::testing::TestParamInfo<ipcTestParams> &info) {
73+
const umf_memory_pool_ops_t *pool_ops = std::get<0>(info.param);
74+
const umf_memory_provider_ops_t *provider_ops = std::get<3>(info.param);
75+
76+
const char *poolName = NULL;
77+
const char *providerName = NULL;
78+
79+
pool_ops->get_name(NULL, &poolName);
80+
provider_ops->get_name(NULL, &providerName);
81+
82+
std::string poolParams =
83+
std::get<1>(info.param)
84+
? std::string("_w_params_") + std::to_string(info.index)
85+
: std::string("");
86+
87+
MemoryAccessor *memAccessor = std::get<6>(info.param);
88+
89+
return std::string(poolName) + poolParams + "_" + providerName + "_" +
90+
memAccessor->getName();
91+
}
92+
7193
struct umfIpcTest : umf_test::test,
7294
::testing::WithParamInterface<ipcTestParams> {
7395
umfIpcTest() {}

test/memoryPoolAPI.cpp

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,23 @@ INSTANTIATE_TEST_SUITE_P(
309309
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr},
310310
poolCreateExtParams{umfDisjointPoolOps(), defaultDisjointPoolConfig,
311311
defaultDisjointPoolConfigDestroy,
312-
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
312+
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
313+
poolCreateExtParamsNameGen);
313314

314315
INSTANTIATE_TEST_SUITE_P(mallocMultiPoolTest, umfMultiPoolTest,
315316
::testing::Values(poolCreateExtParams{
316317
umfProxyPoolOps(), nullptr, nullptr,
317-
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
318+
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
319+
poolCreateExtParamsNameGen);
318320

319321
INSTANTIATE_TEST_SUITE_P(umfPoolWithCreateFlagsTest, umfPoolWithCreateFlagsTest,
320322
::testing::Values(0,
321-
UMF_POOL_CREATE_FLAG_OWN_PROVIDER));
323+
UMF_POOL_CREATE_FLAG_OWN_PROVIDER),
324+
([](auto const &info) {
325+
static const char *names[] = {
326+
"NONE", "UMF_POOL_CREATE_FLAG_OWN_PROVIDER"};
327+
return std::string(names[info.index]);
328+
}));
322329

323330
////////////////// Negative test cases /////////////////
324331

@@ -382,7 +389,14 @@ INSTANTIATE_TEST_SUITE_P(
382389
::testing::Values(UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY,
383390
UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC,
384391
UMF_RESULT_ERROR_INVALID_ARGUMENT,
385-
UMF_RESULT_ERROR_UNKNOWN));
392+
UMF_RESULT_ERROR_UNKNOWN),
393+
([](auto const &info) {
394+
static const char *names[] = {
395+
"UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY",
396+
"UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC",
397+
"UMF_RESULT_ERROR_INVALID_ARGUMENT", "UMF_RESULT_ERROR_UNKNOWN"};
398+
return names[info.index];
399+
}));
386400

387401
TEST_P(poolInitializeTest, errorPropagation) {
388402
auto nullProvider = umf_test::wrapProviderUnique(nullProviderCreate());
@@ -559,4 +573,19 @@ INSTANTIATE_TEST_SUITE_P(
559573
umf_test::withGeneratedArgs(umfPoolGetMemoryProvider),
560574
umf_test::withGeneratedArgs(umfPoolByPtr),
561575
umf_test::withGeneratedArgs(umfPoolSetTag),
562-
umf_test::withGeneratedArgs(umfPoolGetTag)));
576+
umf_test::withGeneratedArgs(umfPoolGetTag)),
577+
([](auto const &info) {
578+
static const char *names[] = {"umfPoolMalloc",
579+
"umfPoolAlignedMalloc",
580+
"umfPoolFree",
581+
"umfPoolCalloc",
582+
"umfPoolRealloc",
583+
"umfPoolMallocUsableSize",
584+
"umfPoolGetLastAllocationError",
585+
"umfPoolGetName",
586+
"umfPoolGetMemoryProvider",
587+
"umfPoolByPtr",
588+
"umfPoolSetTag",
589+
"umfPoolGetTag"};
590+
return std::string(names[info.index]);
591+
}));

test/memoryProviderAPI.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,14 @@ INSTANTIATE_TEST_SUITE_P(
338338
::testing::Values(UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY,
339339
UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC,
340340
UMF_RESULT_ERROR_INVALID_ARGUMENT,
341-
UMF_RESULT_ERROR_UNKNOWN));
341+
UMF_RESULT_ERROR_UNKNOWN),
342+
([](auto const &info) {
343+
static const char *names[] = {
344+
"UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY",
345+
"UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC",
346+
"UMF_RESULT_ERROR_INVALID_ARGUMENT", "UMF_RESULT_ERROR_UNKNOWN"};
347+
return std::string(names[info.index]);
348+
}));
342349

343350
TEST_P(providerInitializeTest, errorPropagation) {
344351
struct provider : public umf_test::provider_base_t {
@@ -389,4 +396,14 @@ INSTANTIATE_TEST_SUITE_P(
389396
umf_test::withGeneratedArgs(umfMemoryProviderGetMinPageSize),
390397
umf_test::withGeneratedArgs(umfMemoryProviderPurgeLazy),
391398
umf_test::withGeneratedArgs(umfMemoryProviderPurgeForce),
392-
umf_test::withGeneratedArgs(umfMemoryProviderGetName)));
399+
umf_test::withGeneratedArgs(umfMemoryProviderGetName)),
400+
([](auto const &info) {
401+
static const char *names[] = {"umfMemoryProviderAlloc",
402+
"umfMemoryProviderFree",
403+
"umfMemoryProviderGetRecommendedPageSize",
404+
"umfMemoryProviderGetMinPageSize",
405+
"umfMemoryProviderPurgeLazy",
406+
"umfMemoryProviderPurgeForce",
407+
"umfMemoryProviderGetName"};
408+
return std::string(names[info.index]);
409+
}));

test/memspaces/memspace_highest_bandwidth.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,25 @@ static void canQueryBandwidth(size_t nodeId) {
4040
}
4141
}
4242

43-
INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyTest, memspaceGetTest,
44-
::testing::Values(memspaceGetParams{
45-
canQueryBandwidth,
46-
umfMemspaceHighestBandwidthGet}));
47-
48-
INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyProviderTest,
49-
memspaceProviderTest,
50-
::testing::Values(memspaceGetParams{
51-
canQueryBandwidth,
52-
umfMemspaceHighestBandwidthGet}));
43+
INSTANTIATE_TEST_SUITE_P(
44+
memspaceLowestLatencyTest, memspaceGetTest,
45+
::testing::Values(memspaceGetParams{canQueryBandwidth,
46+
umfMemspaceHighestBandwidthGet}),
47+
([](auto const &info) {
48+
static const char *names[] = {"canQueryBandwidth",
49+
"umfMemspaceHighestBandwidthGet"};
50+
return std::string(names[info.index]);
51+
}));
52+
53+
INSTANTIATE_TEST_SUITE_P(
54+
memspaceLowestLatencyProviderTest, memspaceProviderTest,
55+
::testing::Values(memspaceGetParams{canQueryBandwidth,
56+
umfMemspaceHighestBandwidthGet}),
57+
([](auto const &info) {
58+
static const char *names[] = {"canQueryBandwidth",
59+
"umfMemspaceHighestBandwidthGet"};
60+
return std::string(names[info.index]);
61+
}));
5362

5463
TEST_F(numaNodesTest, PerCoreBandwidthPlacement) {
5564
const size_t allocSize = 4096;

test/memspaces/memspace_lowest_latency.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,21 @@ static void canQueryLatency(size_t nodeId) {
4141

4242
INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyTest, memspaceGetTest,
4343
::testing::Values(memspaceGetParams{
44-
canQueryLatency, umfMemspaceLowestLatencyGet}));
44+
canQueryLatency, umfMemspaceLowestLatencyGet}),
45+
([](auto const &info) {
46+
static const char *names[] = {
47+
"canQueryLatency",
48+
"umfMemspaceLowestLatencyGet"};
49+
return std::string(names[info.index]);
50+
}));
4551

4652
INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyProviderTest,
4753
memspaceProviderTest,
4854
::testing::Values(memspaceGetParams{
49-
canQueryLatency, umfMemspaceLowestLatencyGet}));
55+
canQueryLatency, umfMemspaceLowestLatencyGet}),
56+
([](auto const &info) {
57+
static const char *names[] = {
58+
"canQueryLatency",
59+
"umfMemspaceLowestLatencyGet"};
60+
return std::string(names[info.index]);
61+
}));

0 commit comments

Comments
 (0)