|
3 | 3 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
4 | 4 | // This file contains tests for UMF pool API
|
5 | 5 |
|
6 |
| -#include "base.hpp" |
7 |
| -#include "pool.hpp" |
8 |
| -#include "poolFixtures.hpp" |
9 |
| -#include "provider.hpp" |
10 |
| -#include "provider_null.h" |
11 |
| -#include "provider_trace.h" |
12 |
| -#include "test_helpers.h" |
| 6 | +#include <array> |
| 7 | +#include <string> |
| 8 | +#include <thread> |
| 9 | +#include <type_traits> |
| 10 | +#include <unordered_map> |
| 11 | +#include <variant> |
13 | 12 |
|
14 | 13 | #include <umf/memory_provider.h>
|
15 | 14 | #include <umf/pools/pool_disjoint.h>
|
|
19 | 18 | #include <umf/proxy_lib_new_delete.h>
|
20 | 19 | #endif
|
21 | 20 |
|
22 |
| -#include <array> |
23 |
| -#include <string> |
24 |
| -#include <thread> |
25 |
| -#include <type_traits> |
26 |
| -#include <unordered_map> |
27 |
| -#include <variant> |
| 21 | +#include "base.hpp" |
| 22 | +#include "pool.hpp" |
| 23 | +#include "poolFixtures.hpp" |
| 24 | +#include "provider.hpp" |
| 25 | +#include "provider_null.h" |
| 26 | +#include "provider_trace.h" |
| 27 | +#include "test_helpers.h" |
28 | 28 |
|
29 | 29 | using umf_test::test;
|
30 | 30 | using namespace umf_test;
|
@@ -309,16 +309,23 @@ INSTANTIATE_TEST_SUITE_P(
|
309 | 309 | &BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr},
|
310 | 310 | poolCreateExtParams{umfDisjointPoolOps(), defaultDisjointPoolConfig,
|
311 | 311 | defaultDisjointPoolConfigDestroy,
|
312 |
| - &BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr})); |
| 312 | + &BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}), |
| 313 | + poolCreateExtParamsNameGen); |
313 | 314 |
|
314 | 315 | INSTANTIATE_TEST_SUITE_P(mallocMultiPoolTest, umfMultiPoolTest,
|
315 | 316 | ::testing::Values(poolCreateExtParams{
|
316 | 317 | umfProxyPoolOps(), nullptr, nullptr,
|
317 |
| - &BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr})); |
| 318 | + &BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}), |
| 319 | + poolCreateExtParamsNameGen); |
318 | 320 |
|
319 | 321 | INSTANTIATE_TEST_SUITE_P(umfPoolWithCreateFlagsTest, umfPoolWithCreateFlagsTest,
|
320 | 322 | ::testing::Values(0,
|
321 |
| - UMF_POOL_CREATE_FLAG_OWN_PROVIDER)); |
| 323 | + UMF_POOL_CREATE_FLAG_OWN_PROVIDER), |
| 324 | + ([](auto const &info) -> std::string { |
| 325 | + static const char *names[] = { |
| 326 | + "NONE", "UMF_POOL_CREATE_FLAG_OWN_PROVIDER"}; |
| 327 | + return names[info.index]; |
| 328 | + })); |
322 | 329 |
|
323 | 330 | ////////////////// Negative test cases /////////////////
|
324 | 331 |
|
@@ -382,7 +389,14 @@ INSTANTIATE_TEST_SUITE_P(
|
382 | 389 | ::testing::Values(UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY,
|
383 | 390 | UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC,
|
384 | 391 | UMF_RESULT_ERROR_INVALID_ARGUMENT,
|
385 |
| - UMF_RESULT_ERROR_UNKNOWN)); |
| 392 | + UMF_RESULT_ERROR_UNKNOWN), |
| 393 | + ([](auto const &info) -> std::string { |
| 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 | + })); |
386 | 400 |
|
387 | 401 | TEST_P(poolInitializeTest, errorPropagation) {
|
388 | 402 | auto nullProvider = umf_test::wrapProviderUnique(nullProviderCreate());
|
@@ -559,4 +573,19 @@ INSTANTIATE_TEST_SUITE_P(
|
559 | 573 | umf_test::withGeneratedArgs(umfPoolGetMemoryProvider),
|
560 | 574 | umf_test::withGeneratedArgs(umfPoolByPtr),
|
561 | 575 | umf_test::withGeneratedArgs(umfPoolSetTag),
|
562 |
| - umf_test::withGeneratedArgs(umfPoolGetTag))); |
| 576 | + umf_test::withGeneratedArgs(umfPoolGetTag)), |
| 577 | + ([](auto const &info) -> std::string { |
| 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 names[info.index]; |
| 591 | + })); |
0 commit comments