Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/memoryPoolAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,9 @@ INSTANTIATE_TEST_SUITE_P(
umf_test::withGeneratedArgs(umfPoolCalloc),
umf_test::withGeneratedArgs(umfPoolRealloc),
umf_test::withGeneratedArgs(umfPoolMallocUsableSize),
umf_test::withGeneratedArgs(umfPoolGetLastAllocationError)));
umf_test::withGeneratedArgs(umfPoolGetLastAllocationError),
umf_test::withGeneratedArgs(umfPoolGetName),
umf_test::withGeneratedArgs(umfPoolGetMemoryProvider),
umf_test::withGeneratedArgs(umfPoolByPtr),
umf_test::withGeneratedArgs(umfPoolSetTag),
umf_test::withGeneratedArgs(umfPoolGetTag)));
9 changes: 9 additions & 0 deletions test/poolFixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,15 @@ TEST_P(umfPoolTest, umfPoolAlignedMalloc) {
#endif /* !_WIN32 */
}

TEST_P(umfPoolTest, umfPoolGetName) {
umf_memory_pool_handle_t pool_get = pool.get();
const char *name = nullptr;
umf_result_t ret = umfPoolGetName(pool_get, &name);
ASSERT_EQ(ret, UMF_RESULT_SUCCESS);
ASSERT_NE(name, nullptr);
ASSERT_GT(strlen(name), (size_t)0);
}

TEST_P(umfPoolTest, pool_from_ptr_whole_size_success) {
#ifdef _WIN32
// TODO: implement support for windows
Expand Down
26 changes: 26 additions & 0 deletions test/pools/jemalloc_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,29 @@ TEST_F(test, jemallocPoolParamsInvalid) {
ret = umfOsMemoryProviderParamsDestroy(provider_params);
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
}

TEST_F(test, jemallocPoolName) {
umf_jemalloc_pool_params_handle_t params = nullptr;
umf_result_t res = umfJemallocPoolParamsCreate(&params);
EXPECT_EQ(res, UMF_RESULT_SUCCESS);
umf_memory_provider_handle_t provider_handle = nullptr;
umf_memory_pool_handle_t pool = NULL;

struct memory_provider : public umf_test::provider_base_t {};
umf_memory_provider_ops_t provider_ops =
umf_test::providerMakeCOps<memory_provider, void>();
auto providerUnique =
wrapProviderUnique(createProviderChecked(&provider_ops, nullptr));
provider_handle = providerUnique.get();

res =
umfPoolCreate(umfJemallocPoolOps(), provider_handle, params, 0, &pool);
EXPECT_EQ(res, UMF_RESULT_SUCCESS);
const char *name = nullptr;
res = umfPoolGetName(pool, &name);
EXPECT_EQ(res, UMF_RESULT_SUCCESS);
EXPECT_STREQ(name, "jemalloc");

umfPoolDestroy(pool);
umfJemallocPoolParamsDestroy(params);
}
Loading