Skip to content

Commit 085e4ba

Browse files
authored
Merge pull request #228 from igchor/extend_multi_pool
Add scalable_pool to multi-pool test
2 parents 7966bcb + 43b6abd commit 085e4ba

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

.github/workflows/basic.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ jobs:
101101
compiler: {c: gcc, cxx: g++}
102102
shared_library: 'ON'
103103
os_provider: 'ON'
104+
- os: 'ubuntu-22.04'
105+
build_type: Debug
106+
compiler: {c: gcc, cxx: g++}
107+
shared_library: 'ON'
108+
os_provider: 'ON'
104109
# test os_provider='OFF' with shared_library='ON'
105110
- os: 'ubuntu-22.04'
106111
build_type: Release

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ endif()
7979

8080
if(UMF_BUILD_LIBUMF_POOL_DISJOINT
8181
AND UMF_BUILD_LIBUMF_POOL_JEMALLOC
82+
AND UMF_BUILD_LIBUMF_POOL_SCALABLE
8283
AND UMF_BUILD_OS_MEMORY_PROVIDER
8384
AND UMF_ENABLE_POOL_TRACKING)
8485
add_umf_test(NAME c_api_multi_pool
8586
SRCS c_api/multi_pool.c
86-
LIBS disjoint_pool jemalloc_pool)
87+
LIBS disjoint_pool jemalloc_pool scalable_pool)
8788
endif()
8889

8990
if(UMF_BUILD_OS_MEMORY_PROVIDER)

test/c_api/multi_pool.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <umf/pools/pool_disjoint.h>
99
#include <umf/pools/pool_jemalloc.h>
1010
#include <umf/pools/pool_proxy.h>
11+
#include <umf/pools/pool_scalable.h>
1112
#include <umf/providers/provider_os_memory.h>
1213

1314
#include "test_helpers.h"
@@ -40,6 +41,15 @@ createJemallocPool(umf_memory_provider_handle_t provider) {
4041
return pool;
4142
}
4243

44+
umf_memory_pool_handle_t
45+
createScalablePool(umf_memory_provider_handle_t provider) {
46+
umf_memory_pool_handle_t pool = NULL;
47+
umf_result_t ret =
48+
umfPoolCreate(umfScalablePoolOps(), provider, NULL, 0, &pool);
49+
UT_ASSERTeq(ret, UMF_RESULT_SUCCESS);
50+
return pool;
51+
}
52+
4353
#define ALLOC_SIZE 64
4454

4555
int main(void) {
@@ -50,29 +60,30 @@ int main(void) {
5060
umfMemoryProviderCreate(umfOsMemoryProviderOps(), &params, &hProvider);
5161
UT_ASSERTeq(ret, UMF_RESULT_SUCCESS);
5262

53-
umf_memory_pool_handle_t pools[3];
63+
umf_memory_pool_handle_t pools[4];
5464

5565
pools[0] = createDisjointPool(hProvider);
5666
pools[1] = createProxyPool(hProvider);
5767
pools[2] = createJemallocPool(hProvider);
68+
pools[3] = createScalablePool(hProvider);
5869

59-
void *ptrs[3];
70+
void *ptrs[4];
6071

61-
for (int i = 0; i < 3; i++) {
72+
for (int i = 0; i < 4; i++) {
6273
UT_ASSERTne(pools[i], NULL);
6374
ptrs[i] = umfPoolMalloc(pools[i], ALLOC_SIZE);
6475
UT_ASSERTne(ptrs[i], NULL);
6576
}
6677

67-
for (int i = 0; i < 3; i++) {
78+
for (int i = 0; i < 4; i++) {
6879
UT_ASSERTeq(umfPoolByPtr(ptrs[i]), pools[i]);
6980
}
7081

71-
for (int i = 0; i < 3; i++) {
82+
for (int i = 0; i < 4; i++) {
7283
umfFree(ptrs[i]);
7384
}
7485

75-
for (int i = 0; i < 3; i++) {
86+
for (int i = 0; i < 4; i++) {
7687
umfPoolDestroy(pools[i]);
7788
}
7889

0 commit comments

Comments
 (0)