Skip to content

Commit 56819a9

Browse files
committed
add names to test cases
1 parent ac85b70 commit 56819a9

20 files changed

+183
-45
lines changed

test/coarse_lib.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ 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+
const char *names[] = {"UMF_COARSE_MEMORY_STRATEGY_FASTEST",
120+
"UMF_COARSE_MEMORY_STRATEGY_FASTEST_BUT_ONE",
121+
"UMF_COARSE_MEMORY_STRATEGY_CHECK_ALL_SIZE"};
122+
return names[info.index];
123+
}));
118124

119125
TEST_P(CoarseWithMemoryStrategyTest, coarseTest_basic_provider) {
120126
umf_memory_provider_handle_t malloc_memory_provider;

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 names[info.index];
46+
}));
4147

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

test/memoryPoolAPI.cpp

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,22 @@ 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

319-
INSTANTIATE_TEST_SUITE_P(umfPoolWithCreateFlagsTest, umfPoolWithCreateFlagsTest,
320-
::testing::Values(0,
321-
UMF_POOL_CREATE_FLAG_OWN_PROVIDER));
321+
INSTANTIATE_TEST_SUITE_P(
322+
umfPoolWithCreateFlagsTest, umfPoolWithCreateFlagsTest,
323+
::testing::Values(0, UMF_POOL_CREATE_FLAG_OWN_PROVIDER),
324+
([](auto const &info) {
325+
const char *names[] = {"NONE", "UMF_POOL_CREATE_FLAG_OWN_PROVIDER"};
326+
return names[info.index];
327+
}));
322328

323329
////////////////// Negative test cases /////////////////
324330

@@ -382,7 +388,14 @@ INSTANTIATE_TEST_SUITE_P(
382388
::testing::Values(UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY,
383389
UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC,
384390
UMF_RESULT_ERROR_INVALID_ARGUMENT,
385-
UMF_RESULT_ERROR_UNKNOWN));
391+
UMF_RESULT_ERROR_UNKNOWN),
392+
([](auto const &info) {
393+
const char *names[] = {"UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY",
394+
"UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC",
395+
"UMF_RESULT_ERROR_INVALID_ARGUMENT",
396+
"UMF_RESULT_ERROR_UNKNOWN"};
397+
return names[info.index];
398+
}));
386399

387400
TEST_P(poolInitializeTest, errorPropagation) {
388401
auto nullProvider = umf_test::wrapProviderUnique(nullProviderCreate());
@@ -554,4 +567,14 @@ INSTANTIATE_TEST_SUITE_P(
554567
umf_test::withGeneratedArgs(umfPoolCalloc),
555568
umf_test::withGeneratedArgs(umfPoolRealloc),
556569
umf_test::withGeneratedArgs(umfPoolMallocUsableSize),
557-
umf_test::withGeneratedArgs(umfPoolGetLastAllocationError)));
570+
umf_test::withGeneratedArgs(umfPoolGetLastAllocationError)),
571+
([](auto const &info) {
572+
const char *names[] = {"umfPoolMalloc",
573+
"umfPoolAlignedMalloc",
574+
"umfPoolFree",
575+
"umfPoolCalloc",
576+
"umfPoolRealloc",
577+
"umfPoolMallocUsableSize",
578+
"umfPoolGetLastAllocationError"};
579+
return names[info.index];
580+
}));

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+
const char *names[] = {"UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY",
344+
"UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC",
345+
"UMF_RESULT_ERROR_INVALID_ARGUMENT",
346+
"UMF_RESULT_ERROR_UNKNOWN"};
347+
return 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+
const char *names[] = {"umfMemoryProviderAlloc",
402+
"umfMemoryProviderFree",
403+
"umfMemoryProviderGetRecommendedPageSize",
404+
"umfMemoryProviderGetMinPageSize",
405+
"umfMemoryProviderPurgeLazy",
406+
"umfMemoryProviderPurgeForce",
407+
"umfMemoryProviderGetName"};
408+
return 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+
const char *names[] = {"canQueryBandwidth",
49+
"umfMemspaceHighestBandwidthGet"};
50+
return 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+
const char *names[] = {"canQueryBandwidth",
59+
"umfMemspaceHighestBandwidthGet"};
60+
return 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+
const char *names[] = {
47+
"canQueryLatency",
48+
"umfMemspaceLowestLatencyGet"};
49+
return 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+
const char *names[] = {
58+
"canQueryLatency",
59+
"umfMemspaceLowestLatencyGet"};
60+
return names[info.index];
61+
}));

test/poolFixtures.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@ using poolCreateExtParams =
3434
pfnPoolParamsDestroy, const umf_memory_provider_ops_t *,
3535
pfnProviderParamsCreate, pfnProviderParamsDestroy>;
3636

37+
std::string poolCreateExtParamsNameGen(
38+
const testing::TestParamInfo<poolCreateExtParams> param) {
39+
40+
const umf_memory_pool_ops_t *pool_ops = std::get<0>(param.param);
41+
const umf_memory_provider_ops_t *provider_ops = std::get<3>(param.param);
42+
43+
const char *poolName = NULL;
44+
const char *providerName = NULL;
45+
46+
pool_ops->get_name(NULL, &poolName);
47+
provider_ops->get_name(NULL, &providerName);
48+
49+
std::string poolParams =
50+
std::get<1>(param.param)
51+
? std::string("_w_params_") + std::to_string(param.index)
52+
: std::string("");
53+
54+
return std::string(poolName) + poolParams + "_" + providerName;
55+
}
56+
3757
umf_test::pool_unique_handle_t poolCreateExtUnique(poolCreateExtParams params) {
3858
auto [pool_ops, poolParamsCreate, poolParamsDestroy, provider_ops,
3959
providerParamsCreate, providerParamsDestroy] = params;

test/pools/disjoint_pool.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ INSTANTIATE_TEST_SUITE_P(disjointPoolTests, umfPoolTest,
499499
::testing::Values(poolCreateExtParams{
500500
umfDisjointPoolOps(), defaultDisjointPoolConfig,
501501
defaultDisjointPoolConfigDestroy,
502-
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
502+
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
503+
poolCreateExtParamsNameGen);
503504

504505
void *memProviderParams() { return (void *)&DEFAULT_DISJOINT_CAPACITY; }
505506

@@ -516,4 +517,5 @@ INSTANTIATE_TEST_SUITE_P(disjointMultiPoolTests, umfMultiPoolTest,
516517
::testing::Values(poolCreateExtParams{
517518
umfDisjointPoolOps(), defaultDisjointPoolConfig,
518519
defaultDisjointPoolConfigDestroy,
519-
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
520+
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),
521+
poolCreateExtParamsNameGen);

test/pools/jemalloc_coarse_devdax.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ static std::vector<poolCreateExtParams> poolParamsList =
4141
: std::vector<poolCreateExtParams>{};
4242

4343
INSTANTIATE_TEST_SUITE_P(jemallocCoarseDevDaxTest, umfPoolTest,
44-
::testing::ValuesIn(poolParamsList));
44+
::testing::ValuesIn(poolParamsList),
45+
poolCreateExtParamsNameGen);

test/pools/jemalloc_coarse_file.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ INSTANTIATE_TEST_SUITE_P(jemallocCoarseFileTest, umfPoolTest,
2828
::testing::Values(poolCreateExtParams{
2929
umfJemallocPoolOps(), nullptr, nullptr,
3030
umfFileMemoryProviderOps(), getFileParamsDefault,
31-
destroyFileParams}));
31+
destroyFileParams}),
32+
poolCreateExtParamsNameGen);

0 commit comments

Comments
 (0)