test/mempool: fix autotest retry
authorAndrew Rybchenko <arybchenko@solarflare.com>
Wed, 25 Apr 2018 17:00:37 +0000 (18:00 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 26 Apr 2018 16:16:12 +0000 (18:16 +0200)
Single producer / single consumer mempool handle is stored in static
variable and the mempool allocated if stored value is NULL.
If the mempool is freed, NULL should be restored to make sure that
the mempool is allocated once again next time when the test is run.

Fixes: 8ef772aee072 ("app/test: rework mempool test")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
test/test/test_mempool.c

index 8d29af21ee2f4304d3ded569db124aac2c0ad5ab..eebb1f24d338d3c5119ed0a7aa91492f335b0401 100644 (file)
@@ -327,17 +327,17 @@ test_mempool_sp_sc(void)
        }
        if (rte_mempool_lookup("test_mempool_sp_sc") != mp_spsc) {
                printf("Cannot lookup mempool from its name\n");
-               rte_mempool_free(mp_spsc);
-               RET_ERR();
+               ret = -1;
+               goto err;
        }
        lcore_next = rte_get_next_lcore(lcore_id, 0, 1);
        if (lcore_next >= RTE_MAX_LCORE) {
-               rte_mempool_free(mp_spsc);
-               RET_ERR();
+               ret = -1;
+               goto err;
        }
        if (rte_eal_lcore_role(lcore_next) != ROLE_RTE) {
-               rte_mempool_free(mp_spsc);
-               RET_ERR();
+               ret = -1;
+               goto err;
        }
        rte_spinlock_init(&scsp_spinlock);
        memset(scsp_obj_table, 0, sizeof(scsp_obj_table));
@@ -348,7 +348,10 @@ test_mempool_sp_sc(void)
 
        if (rte_eal_wait_lcore(lcore_next) < 0)
                ret = -1;
+
+err:
        rte_mempool_free(mp_spsc);
+       mp_spsc = NULL;
 
        return ret;
 }