From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Cristian Dumitrescu <cristian.dumitrescu@intel.com>, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v3 5/6] test: fix memory leak in table autotest
Date: Wed, 17 Jan 2018 11:15:55 +0000 [thread overview]
Message-ID: <905f1acb7385f76e6624212a1d678cd584232b43.1516178976.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <8ccde502aee6921dd4fc74718309d60b8c82f444.1516178976.git.anatoly.burakov@intel.com>
In-Reply-To: <9d5a3bc7a779b2dddab4256aa3e0631737861f98.1513867589.git.anatoly.burakov@intel.com>
Always deallocate allocated resources after the test is done.
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Fixes: 5205954791cb ("app/test: packet framework unit tests")
Cc: cristian.dumitrescu@intel.com
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
test/test/test_table.c | 44 ++++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/test/test/test_table.c b/test/test/test_table.c
index c9268a3..f01652d 100644
--- a/test/test/test_table.c
+++ b/test/test/test_table.c
@@ -55,6 +55,14 @@ uint64_t pipeline_test_hash(void *key,
}
static void
+app_free_resources(void) {
+ int i;
+ for (i = 0; i < N_PORTS; i++)
+ rte_ring_free(rings_rx[i]);
+ rte_mempool_free(pool);
+}
+
+static void
app_init_mbuf_pools(void)
{
/* Init the buffer pool */
@@ -113,18 +121,20 @@ app_init_rings(void)
static int
test_table(void)
{
- int status, failures;
+ int status, ret;
unsigned i;
- failures = 0;
+ ret = TEST_SUCCESS;
app_init_rings();
app_init_mbuf_pools();
printf("\n\n\n\n************Pipeline tests************\n");
- if (test_table_pipeline() < 0)
- return -1;
+ if (test_table_pipeline() < 0) {
+ ret = TEST_FAILED;
+ goto end;
+ }
printf("\n\n\n\n************Port tests************\n");
for (i = 0; i < n_port_tests; i++) {
@@ -132,8 +142,8 @@ test_table(void)
if (status < 0) {
printf("\nPort test number %d failed (%d).\n", i,
status);
- failures++;
- return -1;
+ ret = TEST_FAILED;
+ goto end;
}
}
@@ -143,8 +153,8 @@ test_table(void)
if (status < 0) {
printf("\nTable test number %d failed (%d).\n", i,
status);
- failures++;
- return -1;
+ ret = TEST_FAILED;
+ goto end;
}
}
@@ -154,21 +164,23 @@ test_table(void)
if (status < 0) {
printf("\nCombined table test number %d failed with "
"reason number %d.\n", i, status);
- failures++;
- return -1;
+ ret = TEST_FAILED;
+ goto end;
}
}
- if (failures)
- return -1;
-
#ifdef RTE_LIBRTE_ACL
printf("\n\n\n\n************ACL tests************\n");
- if (test_table_acl() < 0)
- return -1;
+ if (test_table_acl() < 0) {
+ ret = TEST_FAILED;
+ goto end;
+ }
#endif
- return 0;
+end:
+ app_free_resources();
+
+ return ret;
}
REGISTER_TEST_COMMAND(table_autotest, test_table);
--
2.7.4
next prev parent reply other threads:[~2018-01-17 11:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c46dff058bdbc6fe7c66c551575c410347cd589e.1515845958.git.anatoly.burakov@intel.com>
[not found] ` <9d5a3bc7a779b2dddab4256aa3e0631737861f98.1513867589.git.anatoly.burakov@intel.com>
2017-12-22 10:12 ` [dpdk-stable] [PATCH 2/6] test: fix memory leak in reorder autotest Anatoly Burakov
2017-12-22 10:12 ` [dpdk-stable] [PATCH 3/6] test: fix memory leak in ring autotest Anatoly Burakov
2017-12-22 16:26 ` Olivier MATZ
2017-12-23 11:49 ` Burakov, Anatoly
2017-12-22 10:12 ` [dpdk-stable] [PATCH 4/6] test: fix memory leak in ring perf autotest Anatoly Burakov
2017-12-22 16:28 ` Olivier MATZ
2017-12-22 10:12 ` [dpdk-stable] [PATCH 5/6] test: fix memory leak in table autotest Anatoly Burakov
2018-01-11 14:17 ` Dumitrescu, Cristian
2017-12-22 10:12 ` [dpdk-stable] [PATCH 6/6] test: fix memory leak in timer perf autotest Anatoly Burakov
2018-01-17 8:36 ` [dpdk-stable] [PATCH v2 2/6] test: fix memory leak in reorder autotest Anatoly Burakov
2018-01-17 8:36 ` [dpdk-stable] [PATCH v2 3/6] test: fix memory leak in ring autotest Anatoly Burakov
2018-01-17 8:36 ` [dpdk-stable] [PATCH v2 4/6] test: fix memory leak in ring perf autotest Anatoly Burakov
2018-01-17 8:36 ` [dpdk-stable] [PATCH v2 5/6] test: fix memory leak in table autotest Anatoly Burakov
2018-01-17 8:36 ` [dpdk-stable] [PATCH v2 6/6] test: fix memory leak in timer perf autotest Anatoly Burakov
2018-01-17 11:15 ` [dpdk-stable] [PATCH v3 2/6] test: fix memory leak in reorder autotest Anatoly Burakov
2018-01-17 11:15 ` [dpdk-stable] [PATCH v3 3/6] test: fix memory leak in ring autotest Anatoly Burakov
2018-01-19 8:33 ` Olivier Matz
2018-01-17 11:15 ` [dpdk-stable] [PATCH v3 4/6] test: fix memory leak in ring perf autotest Anatoly Burakov
2018-01-19 8:35 ` Olivier Matz
2018-01-17 11:15 ` Anatoly Burakov [this message]
2018-01-17 11:15 ` [dpdk-stable] [PATCH v3 6/6] test: fix memory leak in timer " Anatoly Burakov
[not found] <662303f9fc36dc3f45ae0f4a6f21eeb91f8f000d.1517917927.git.anatoly.burakov@intel.com>
[not found] ` <409be7970a029d2d2cfffeafee43ea2645244eb2.1517834482.git.anatoly.burakov@intel.com>
[not found] ` <8ccde502aee6921dd4fc74718309d60b8c82f444.1516178976.git.anatoly.burakov@intel.com>
2018-02-05 13:03 ` [dpdk-stable] [PATCH v4 2/6] test: fix memory leak in reorder autotest Anatoly Burakov
2018-02-05 13:03 ` [dpdk-stable] [PATCH v4 3/6] test: fix memory leak in ring autotest Anatoly Burakov
2018-02-06 0:36 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2018-02-05 13:03 ` [dpdk-stable] [PATCH v4 4/6] test: fix memory leak in ring perf autotest Anatoly Burakov
2018-02-05 13:03 ` [dpdk-stable] [PATCH v4 5/6] test: fix memory leak in table autotest Anatoly Burakov
2018-02-05 13:03 ` [dpdk-stable] [PATCH v4 6/6] test: fix memory leak in timer perf autotest Anatoly Burakov
2018-02-06 13:35 ` [dpdk-stable] [PATCH v5 2/6] test: fix memory leak in reorder autotest Anatoly Burakov
2018-02-06 13:35 ` [dpdk-stable] [PATCH v5 3/6] test: fix memory leak in ring autotest Anatoly Burakov
2018-02-06 13:35 ` [dpdk-stable] [PATCH v5 4/6] test: fix memory leak in ring perf autotest Anatoly Burakov
2018-02-06 13:35 ` [dpdk-stable] [PATCH v5 5/6] test: fix memory leak in table autotest Anatoly Burakov
2018-02-06 13:35 ` [dpdk-stable] [PATCH v5 6/6] test: fix memory leak in timer perf autotest Anatoly Burakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=905f1acb7385f76e6624212a1d678cd584232b43.1516178976.git.anatoly.burakov@intel.com \
--to=anatoly.burakov@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).