Signed-off-by: David Hunt <david.hunt at intel.com>
---
 app/test/test_mempool.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 31582d8..6cb2b14 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -573,6 +573,7 @@ test_mempool(void)
        struct rte_mempool *mp_cache = NULL;
        struct rte_mempool *mp_nocache = NULL;
        struct rte_mempool *mp_ext = NULL;
+       struct rte_mempool *mp_stack = NULL;

        rte_atomic32_init(&synchro);

@@ -622,6 +623,27 @@ test_mempool(void)
        }
        rte_mempool_obj_iter(mp_ext, my_obj_init, NULL);

+       /* create a mempool with an external handler */
+       mp_stack = rte_mempool_create_empty("test_stack",
+               MEMPOOL_SIZE,
+               MEMPOOL_ELT_SIZE,
+               RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
+               SOCKET_ID_ANY, 0);
+
+       if (mp_stack == NULL) {
+               printf("cannot allocate mp_stack mempool\n");
+               goto err;
+       }
+       if (rte_mempool_set_ops_byname(mp_stack, "stack", NULL) < 0) {
+               printf("cannot set stack handler\n");
+               goto err;
+       }
+       if (rte_mempool_populate_default(mp_stack) < 0) {
+               printf("cannot populate mp_stack mempool\n");
+               goto err;
+       }
+       rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
+
        /* retrieve the mempool from its name */
        if (rte_mempool_lookup("test_nocache") != mp_nocache) {
                printf("Cannot lookup mempool from its name\n");
@@ -655,6 +677,10 @@ test_mempool(void)
        if (test_mempool_xmem_misc() < 0)
                goto err;

+       /* test the stack handler */
+       if (test_mempool_basic(mp_stack) < 0)
+               goto err;
+
        rte_mempool_list_dump(stdout);

        return 0;
-- 
2.5.5

Reply via email to