All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/test: fix failing packet-framework table unit-tests
@ 2016-09-12 11:05 Jasvinder Singh
  2016-09-15 14:18 ` Dumitrescu, Cristian
  0 siblings, 1 reply; 3+ messages in thread
From: Jasvinder Singh @ 2016-09-12 11:05 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu

The pipeline object is not freed when a particular test-case of the unit-test
finishes. Using rte_pipeline_free() before returning the outcome for each
test-case fixes the issue.

Fixes: 5205954791cb ("app/test: packet framework unit tests")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 app/test/test_table_combined.c | 45 +++++++++++++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/app/test/test_table_combined.c b/app/test/test_table_combined.c
index acb4f4d..8724afa 100644
--- a/app/test/test_table_combined.c
+++ b/app/test/test_table_combined.c
@@ -110,8 +110,10 @@ test_table_type(struct rte_table_ops *table_ops, void *table_args,
 	};
 
 	if (rte_pipeline_port_in_create(pipeline, &ring_in_params,
-		&ring_in_id) != 0)
+		&ring_in_id) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_PORT_CONFIG;
+	}
 
 	/* Create table */
 	struct rte_pipeline_table_params table_params = {
@@ -123,8 +125,11 @@ test_table_type(struct rte_table_ops *table_ops, void *table_args,
 		.action_data_size = 0,
 	};
 
-	if (rte_pipeline_table_create(pipeline, &table_params, &table_id) != 0)
+	if (rte_pipeline_table_create(pipeline, &table_params,
+		&table_id) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_TABLE_CONFIG;
+	}
 
 	/* Create output ports */
 	ring_params_tx.ring = RING_TX;
@@ -136,14 +141,18 @@ test_table_type(struct rte_table_ops *table_ops, void *table_args,
 	};
 
 	if (rte_pipeline_port_out_create(pipeline, &ring_out_params,
-		&ring_out_id) != 0)
+		&ring_out_id) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_PORT_CONFIG;
+	}
 
 	ring_params_tx.ring = RING_TX_2;
 
 	if (rte_pipeline_port_out_create(pipeline, &ring_out_params,
-		&ring_out_2_id) != 0)
+		&ring_out_2_id) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_PORT_CONFIG;
+	}
 
 	/* Add entry to the table */
 	struct rte_pipeline_table_entry default_entry = {
@@ -161,24 +170,34 @@ test_table_type(struct rte_table_ops *table_ops, void *table_args,
 	int key_found;
 
 	if (rte_pipeline_table_default_entry_add(pipeline, table_id,
-		&default_entry, &default_entry_ptr) != 0)
+		&default_entry, &default_entry_ptr) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_DEFAULT_ENTRY_ADD;
+	}
 
 	if (rte_pipeline_table_entry_add(pipeline, table_id,
 		key ? key : &table_entry, &table_entry, &key_found,
-			&entry_ptr) != 0)
+			&entry_ptr) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_ENTRY_ADD;
+	}
 
 	/* Create connections and check consistency */
 	if (rte_pipeline_port_in_connect_to_table(pipeline, ring_in_id,
-		table_id) != 0)
+		table_id) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_CONNECT;
+	}
 
-	if (rte_pipeline_port_in_enable(pipeline, ring_in_id) != 0)
+	if (rte_pipeline_port_in_enable(pipeline, ring_in_id) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_PORT_ENABLE;
+	}
 
-	if (rte_pipeline_check(pipeline) != 0)
+	if (rte_pipeline_check(pipeline) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_CONSISTENCY;
+	}
 
 
 
@@ -234,13 +253,17 @@ test_table_type(struct rte_table_ops *table_ops, void *table_args,
 	table_entry.table_id = ring_out_2_id;
 
 	if (rte_pipeline_table_default_entry_add(pipeline, table_id,
-		&default_entry, &default_entry_ptr) != 0)
+		&default_entry, &default_entry_ptr) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_ENTRY_ADD;
+	}
 
 	if (rte_pipeline_table_entry_add(pipeline, table_id,
 		key ? key : &table_entry, &table_entry, &key_found,
-			&entry_ptr) != 0)
+			&entry_ptr) != 0) {
+		rte_pipeline_free(pipeline);
 		return -CHECK_TABLE_ENTRY_ADD;
+	}
 
 	/* Check that traffic destination has changed */
 	if (table_packets->n_hit_packets) {
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] app/test: fix failing packet-framework table unit-tests
  2016-09-12 11:05 [PATCH] app/test: fix failing packet-framework table unit-tests Jasvinder Singh
@ 2016-09-15 14:18 ` Dumitrescu, Cristian
  2016-09-23 16:49   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Dumitrescu, Cristian @ 2016-09-15 14:18 UTC (permalink / raw)
  To: Singh, Jasvinder, dev



> -----Original Message-----
> From: Singh, Jasvinder
> Sent: Monday, September 12, 2016 12:06 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: [PATCH] app/test: fix failing packet-framework table unit-tests
> 
> The pipeline object is not freed when a particular test-case of the unit-test
> finishes. Using rte_pipeline_free() before returning the outcome for each
> test-case fixes the issue.
> 
> Fixes: 5205954791cb ("app/test: packet framework unit tests")
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> ---

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] app/test: fix failing packet-framework table unit-tests
  2016-09-15 14:18 ` Dumitrescu, Cristian
@ 2016-09-23 16:49   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2016-09-23 16:49 UTC (permalink / raw)
  To: Singh, Jasvinder; +Cc: dev, Dumitrescu, Cristian

> > The pipeline object is not freed when a particular test-case of the unit-test
> > finishes. Using rte_pipeline_free() before returning the outcome for each
> > test-case fixes the issue.
> > 
> > Fixes: 5205954791cb ("app/test: packet framework unit tests")
> > 
> > Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> 
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-23 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12 11:05 [PATCH] app/test: fix failing packet-framework table unit-tests Jasvinder Singh
2016-09-15 14:18 ` Dumitrescu, Cristian
2016-09-23 16:49   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.