Skip to content

Commit 461be37

Browse files
committed
Add Jemalloc pool to mallocPoolTest suite
Add Jemalloc pool to mallocPoolTest suite. Fixes: #1455 Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 3c015d4 commit 461be37

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/memoryPoolAPI.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#include <umf/pools/pool_disjoint.h>
1515
#include <umf/pools/pool_proxy.h>
1616

17+
#ifdef UMF_POOL_JEMALLOC_ENABLED
18+
#include <umf/pools/pool_jemalloc.h>
19+
#include <umf/providers/provider_os_memory.h>
20+
#endif
21+
1722
#ifdef UMF_PROXY_LIB_ENABLED
1823
#include <umf/proxy_lib_new_delete.h>
1924
#endif
@@ -300,6 +305,31 @@ TEST_F(tagTest, SetAndGetInvalidPool) {
300305
ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
301306
}
302307

308+
#ifdef UMF_POOL_JEMALLOC_ENABLED
309+
static void *createOsMemoryProviderParams() {
310+
umf_os_memory_provider_params_handle_t params = nullptr;
311+
umf_result_t res = umfOsMemoryProviderParamsCreate(&params);
312+
if (res != UMF_RESULT_SUCCESS) {
313+
throw std::runtime_error("Failed to create os memory provider params");
314+
}
315+
316+
return params;
317+
}
318+
319+
static umf_result_t destroyOsMemoryProviderParams(void *params) {
320+
return umfOsMemoryProviderParamsDestroy(
321+
(umf_os_memory_provider_params_handle_t)params);
322+
}
323+
324+
INSTANTIATE_TEST_SUITE_P(
325+
jemallocPoolTest, umfPoolTest,
326+
::testing::Values(poolCreateExtParams{
327+
umfJemallocPoolOps(), nullptr, nullptr, umfOsMemoryProviderOps(),
328+
createOsMemoryProviderParams, destroyOsMemoryProviderParams}),
329+
poolCreateExtParamsNameGen);
330+
331+
#endif /* UMF_POOL_JEMALLOC_ENABLED */
332+
303333
INSTANTIATE_TEST_SUITE_P(
304334
mallocPoolTest, umfPoolTest,
305335
::testing::Values(

0 commit comments

Comments
 (0)