From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id A6FEC1B76E for ; Wed, 31 Jan 2018 15:17:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 06:17:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,440,1511856000"; d="scan'208";a="14843550" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga006.jf.intel.com with ESMTP; 31 Jan 2018 06:17:33 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w0VEHW0M011403; Wed, 31 Jan 2018 14:17:32 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w0VEHWee018617; Wed, 31 Jan 2018 14:17:32 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w0VEHWpR018613; Wed, 31 Jan 2018 14:17:32 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: Olivier Matz , Bruce Richardson , Pablo de Lara Date: Wed, 31 Jan 2018 14:17:32 +0000 Message-Id: <9cdb33a6cce1c7c7107dd63f73fbab9c168c6c92.1517405600.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test/test: clean up memory for func reentrancy test X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:17:36 -0000 Function reentrancy test limits maximum number of iterations based on the number of memzones and cores, however it doesn't free the memzones after the fact, so on a machine with big amount of cores the tests will fail due to running out of memzones. Fix this by introducing cleanup functions for ring and mempool reentrancy tests. Signed-off-by: Anatoly Burakov --- test/test/test_func_reentrancy.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/test/test/test_func_reentrancy.c b/test/test/test_func_reentrancy.c index f43ec2e..a0ed19d 100644 --- a/test/test/test_func_reentrancy.c +++ b/test/test/test_func_reentrancy.c @@ -81,6 +81,22 @@ test_eal_init_once(__attribute__((unused)) void *arg) /* * ring create/lookup reentrancy test */ +static void +ring_clean(unsigned int lcore_id) +{ + struct rte_ring *rp; + char ring_name[MAX_STRING_SIZE]; + int i; + + for (i = 0; i < MAX_ITER_TIMES; i++) { + snprintf(ring_name, sizeof(ring_name), + "fr_test_%d_%d", lcore_id, i); + rp = rte_ring_lookup(ring_name); + if (rp != NULL) + rte_ring_free(rp); + } +} + static int ring_create_lookup(__attribute__((unused)) void *arg) { @@ -127,6 +143,23 @@ my_obj_init(struct rte_mempool *mp, __attribute__((unused)) void *arg, *objnum = i; } +static void +mempool_clean(unsigned int lcore_id) +{ + struct rte_mempool *mp; + char mempool_name[MAX_STRING_SIZE]; + int i; + + /* verify all ring created successful */ + for (i = 0; i < MAX_ITER_TIMES; i++) { + snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", + lcore_id, i); + mp = rte_mempool_lookup(mempool_name); + if (mp != NULL) + rte_mempool_free(mp); + } +} + static int mempool_create_lookup(__attribute__((unused)) void *arg) { @@ -312,7 +345,7 @@ fbk_create_free(__attribute__((unused)) void *arg) #ifdef RTE_LIBRTE_LPM static void -lpm_clean(unsigned lcore_id) +lpm_clean(unsigned int lcore_id) { char lpm_name[MAX_STRING_SIZE]; struct rte_lpm *lpm; @@ -383,8 +416,9 @@ struct test_case{ /* All test cases in the test suite */ struct test_case test_cases[] = { { test_eal_init_once, NULL, NULL, "eal init once" }, - { ring_create_lookup, NULL, NULL, "ring create/lookup" }, - { mempool_create_lookup, NULL, NULL, "mempool create/lookup" }, + { ring_create_lookup, NULL, ring_clean, "ring create/lookup" }, + { mempool_create_lookup, NULL, mempool_clean, + "mempool create/lookup" }, #ifdef RTE_LIBRTE_HASH { hash_create_free, NULL, hash_clean, "hash create/free" }, { fbk_create_free, NULL, fbk_clean, "fbk create/free" }, -- 2.7.4