* [dpdk-stable] [PATCH] test: fix incorrect return types
@ 2018-07-16 16:58 Reshma Pattan
2018-07-17 9:28 ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2018-07-17 12:39 ` [dpdk-stable] [PATCH v2] " Reshma Pattan
0 siblings, 2 replies; 7+ messages in thread
From: Reshma Pattan @ 2018-07-16 16:58 UTC (permalink / raw)
To: dev; +Cc: jasvinder.singh, bernard.iremonger, stable, Reshma Pattan
UTs should return either TEST_SUCCESS or TEST_FAILED only.
They should not return 0, -1 and any other value.
Fixes: 9c9befea4f ("test: add flow classify unit tests")
CC: jasvinder.singh@intel.com
CC: bernard.iremonger@intel.com
CC: stable@dpdk.org
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
test/test/test_flow_classify.c | 110 ++++++++++++++++++++---------------------
1 file changed, 55 insertions(+), 55 deletions(-)
diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c
index fc83b69ae..2ff1ca831 100644
--- a/test/test/test_flow_classify.c
+++ b/test/test/test_flow_classify.c
@@ -231,7 +231,7 @@ test_invalid_parameters(void)
printf("Line %i: rte_flow_classify_validate",
__LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(NULL, NULL, NULL, NULL,
@@ -239,7 +239,7 @@ test_invalid_parameters(void)
if (rule) {
printf("Line %i: flow_classifier_table_entry_add", __LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(NULL, NULL);
@@ -247,14 +247,14 @@ test_invalid_parameters(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(NULL, NULL, 0, NULL, NULL);
if (!ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(NULL, NULL, NULL, NULL,
@@ -262,7 +262,7 @@ test_invalid_parameters(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add ", __LINE__);
printf("with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(NULL, NULL);
@@ -270,16 +270,16 @@ test_invalid_parameters(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf("with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(NULL, NULL, 0, NULL, NULL);
if (!ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -310,7 +310,7 @@ test_valid_parameters(void)
printf("Line %i: rte_flow_classify_validate",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
actions, &key_found, &error);
@@ -318,7 +318,7 @@ test_valid_parameters(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -326,9 +326,9 @@ test_valid_parameters(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -361,7 +361,7 @@ test_invalid_patterns(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -369,7 +369,7 @@ test_invalid_patterns(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -377,7 +377,7 @@ test_invalid_patterns(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
pattern[1] = ipv4_udp_item_1;
@@ -389,7 +389,7 @@ test_invalid_patterns(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -397,7 +397,7 @@ test_invalid_patterns(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -405,9 +405,9 @@ test_invalid_patterns(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -437,7 +437,7 @@ test_invalid_actions(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -445,7 +445,7 @@ test_invalid_actions(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -453,7 +453,7 @@ test_invalid_actions(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
actions[0] = count_action;
@@ -464,7 +464,7 @@ test_invalid_actions(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -472,7 +472,7 @@ test_invalid_actions(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -480,9 +480,9 @@ test_invalid_actions(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf("should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -628,7 +628,7 @@ init_mbufpool(void)
} else {
printf("Cannot init mbuf pool on socket %d\n",
socketid);
- ret = -ENOMEM;
+ ret = TEST_FAILED;
break;
}
}
@@ -649,7 +649,7 @@ test_query_udp(void)
if (ret != MAX_PKT_BURST) {
printf("Line %i: init_udp_ipv4_traffic has failed!\n",
__LINE__);
- return -1;
+ return TEST_FAILED;
}
for (i = 0; i < MAX_PKT_BURST; i++)
@@ -675,7 +675,7 @@ test_query_udp(void)
if (ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -683,7 +683,7 @@ test_query_udp(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST,
@@ -691,7 +691,7 @@ test_query_udp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -699,9 +699,9 @@ test_query_udp(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -716,7 +716,7 @@ test_query_tcp(void)
if (ret != MAX_PKT_BURST) {
printf("Line %i: init_ipv4_tcp_traffic has failed!\n",
__LINE__);
- return -1;
+ return TEST_FAILED;
}
for (i = 0; i < MAX_PKT_BURST; i++)
@@ -742,7 +742,7 @@ test_query_tcp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -750,7 +750,7 @@ test_query_tcp(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST,
@@ -758,7 +758,7 @@ test_query_tcp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -766,9 +766,9 @@ test_query_tcp(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -783,7 +783,7 @@ test_query_sctp(void)
if (ret != MAX_PKT_BURST) {
printf("Line %i: init_ipv4_tcp_traffic has failed!\n",
__LINE__);
- return -1;
+ return TEST_FAILED;
}
for (i = 0; i < MAX_PKT_BURST; i++)
@@ -809,7 +809,7 @@ test_query_sctp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -817,7 +817,7 @@ test_query_sctp(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST,
@@ -825,7 +825,7 @@ test_query_sctp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -833,9 +833,9 @@ test_query_sctp(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -871,32 +871,32 @@ test_flow_classify(void)
printf("Line %i: f_create has failed!\n", __LINE__);
rte_flow_classifier_free(cls->cls);
rte_free(cls);
- return -1;
+ return TEST_FAILED;
}
printf("Created table_acl for for IPv4 five tuple packets\n");
ret = init_mbufpool();
if (ret) {
printf("Line %i: init_mbufpool has failed!\n", __LINE__);
- return -1;
+ return TEST_FAILED;
}
if (test_invalid_parameters() < 0)
- return -1;
+ return TEST_FAILED;
if (test_valid_parameters() < 0)
- return -1;
+ return TEST_FAILED;
if (test_invalid_patterns() < 0)
- return -1;
+ return TEST_FAILED;
if (test_invalid_actions() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_udp() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_tcp() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_sctp() < 0)
- return -1;
+ return TEST_FAILED;
- return 0;
+ return TEST_SUCCESS;
}
REGISTER_TEST_COMMAND(flow_classify_autotest, test_flow_classify);
--
2.14.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] test: fix incorrect return types
2018-07-16 16:58 [dpdk-stable] [PATCH] test: fix incorrect return types Reshma Pattan
@ 2018-07-17 9:28 ` Burakov, Anatoly
2018-07-17 12:39 ` [dpdk-stable] [PATCH v2] " Reshma Pattan
1 sibling, 0 replies; 7+ messages in thread
From: Burakov, Anatoly @ 2018-07-17 9:28 UTC (permalink / raw)
To: Reshma Pattan, dev; +Cc: jasvinder.singh, bernard.iremonger, stable
On 16-Jul-18 5:58 PM, Reshma Pattan wrote:
> UTs should return either TEST_SUCCESS or TEST_FAILED only.
> They should not return 0, -1 and any other value.
>
> Fixes: 9c9befea4f ("test: add flow classify unit tests")
> CC: jasvinder.singh@intel.com
> CC: bernard.iremonger@intel.com
> CC: stable@dpdk.org
>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
Perhaps it should be highlighted that along with making them return
TEST_SUCCESS/FAILURE, you're also fixing the -ENOMEM return in one of
the code paths.
Otherwise,
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-stable] [PATCH v2] test: fix incorrect return types
2018-07-16 16:58 [dpdk-stable] [PATCH] test: fix incorrect return types Reshma Pattan
2018-07-17 9:28 ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
@ 2018-07-17 12:39 ` Reshma Pattan
2018-07-17 12:58 ` Burakov, Anatoly
2018-07-17 16:44 ` [dpdk-stable] [PATCH v3] " Reshma Pattan
1 sibling, 2 replies; 7+ messages in thread
From: Reshma Pattan @ 2018-07-17 12:39 UTC (permalink / raw)
To: dev
Cc: anatoly.burakov, jasvinder.singh, bernard.iremonger, stable,
Reshma Pattan
UTs should return either TEST_SUCCESS or TEST_FAILED only.
They should not return 0, -1 and any other value.
Also replace one instance of setting the ret value
from -ENOMEM to TEST_FAILED, in order to return
correct value to autotest.
Fixes: 9c9befea4f ("test: add flow classify unit tests")
CC: jasvinder.singh@intel.com
CC: bernard.iremonger@intel.com
CC: stable@dpdk.org
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
v2: update commit message
---
test/test/test_flow_classify.c | 110 ++++++++++++++++++++---------------------
1 file changed, 55 insertions(+), 55 deletions(-)
diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c
index fc83b69ae..2ff1ca831 100644
--- a/test/test/test_flow_classify.c
+++ b/test/test/test_flow_classify.c
@@ -231,7 +231,7 @@ test_invalid_parameters(void)
printf("Line %i: rte_flow_classify_validate",
__LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(NULL, NULL, NULL, NULL,
@@ -239,7 +239,7 @@ test_invalid_parameters(void)
if (rule) {
printf("Line %i: flow_classifier_table_entry_add", __LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(NULL, NULL);
@@ -247,14 +247,14 @@ test_invalid_parameters(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(NULL, NULL, 0, NULL, NULL);
if (!ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(NULL, NULL, NULL, NULL,
@@ -262,7 +262,7 @@ test_invalid_parameters(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add ", __LINE__);
printf("with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(NULL, NULL);
@@ -270,16 +270,16 @@ test_invalid_parameters(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf("with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(NULL, NULL, 0, NULL, NULL);
if (!ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" with NULL param should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -310,7 +310,7 @@ test_valid_parameters(void)
printf("Line %i: rte_flow_classify_validate",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
actions, &key_found, &error);
@@ -318,7 +318,7 @@ test_valid_parameters(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -326,9 +326,9 @@ test_valid_parameters(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -361,7 +361,7 @@ test_invalid_patterns(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -369,7 +369,7 @@ test_invalid_patterns(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -377,7 +377,7 @@ test_invalid_patterns(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
pattern[1] = ipv4_udp_item_1;
@@ -389,7 +389,7 @@ test_invalid_patterns(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -397,7 +397,7 @@ test_invalid_patterns(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -405,9 +405,9 @@ test_invalid_patterns(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -437,7 +437,7 @@ test_invalid_actions(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -445,7 +445,7 @@ test_invalid_actions(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -453,7 +453,7 @@ test_invalid_actions(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
actions[0] = count_action;
@@ -464,7 +464,7 @@ test_invalid_actions(void)
if (!ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -472,7 +472,7 @@ test_invalid_actions(void)
if (rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -480,9 +480,9 @@ test_invalid_actions(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf("should have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -628,7 +628,7 @@ init_mbufpool(void)
} else {
printf("Cannot init mbuf pool on socket %d\n",
socketid);
- ret = -ENOMEM;
+ ret = TEST_FAILED;
break;
}
}
@@ -649,7 +649,7 @@ test_query_udp(void)
if (ret != MAX_PKT_BURST) {
printf("Line %i: init_udp_ipv4_traffic has failed!\n",
__LINE__);
- return -1;
+ return TEST_FAILED;
}
for (i = 0; i < MAX_PKT_BURST; i++)
@@ -675,7 +675,7 @@ test_query_udp(void)
if (ret) {
printf("Line %i: rte_flow_classify_validate", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -683,7 +683,7 @@ test_query_udp(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST,
@@ -691,7 +691,7 @@ test_query_udp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -699,9 +699,9 @@ test_query_udp(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -716,7 +716,7 @@ test_query_tcp(void)
if (ret != MAX_PKT_BURST) {
printf("Line %i: init_ipv4_tcp_traffic has failed!\n",
__LINE__);
- return -1;
+ return TEST_FAILED;
}
for (i = 0; i < MAX_PKT_BURST; i++)
@@ -742,7 +742,7 @@ test_query_tcp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -750,7 +750,7 @@ test_query_tcp(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST,
@@ -758,7 +758,7 @@ test_query_tcp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -766,9 +766,9 @@ test_query_tcp(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -783,7 +783,7 @@ test_query_sctp(void)
if (ret != MAX_PKT_BURST) {
printf("Line %i: init_ipv4_tcp_traffic has failed!\n",
__LINE__);
- return -1;
+ return TEST_FAILED;
}
for (i = 0; i < MAX_PKT_BURST; i++)
@@ -809,7 +809,7 @@ test_query_sctp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
rule = rte_flow_classify_table_entry_add(cls->cls, &attr, pattern,
@@ -817,7 +817,7 @@ test_query_sctp(void)
if (!rule) {
printf("Line %i: flow_classify_table_entry_add", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classifier_query(cls->cls, bufs, MAX_PKT_BURST,
@@ -825,7 +825,7 @@ test_query_sctp(void)
if (ret) {
printf("Line %i: flow_classifier_query", __LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
ret = rte_flow_classify_table_entry_delete(cls->cls, rule);
@@ -833,9 +833,9 @@ test_query_sctp(void)
printf("Line %i: rte_flow_classify_table_entry_delete",
__LINE__);
printf(" should not have failed!\n");
- return -1;
+ return TEST_FAILED;
}
- return 0;
+ return TEST_SUCCESS;
}
static int
@@ -871,32 +871,32 @@ test_flow_classify(void)
printf("Line %i: f_create has failed!\n", __LINE__);
rte_flow_classifier_free(cls->cls);
rte_free(cls);
- return -1;
+ return TEST_FAILED;
}
printf("Created table_acl for for IPv4 five tuple packets\n");
ret = init_mbufpool();
if (ret) {
printf("Line %i: init_mbufpool has failed!\n", __LINE__);
- return -1;
+ return TEST_FAILED;
}
if (test_invalid_parameters() < 0)
- return -1;
+ return TEST_FAILED;
if (test_valid_parameters() < 0)
- return -1;
+ return TEST_FAILED;
if (test_invalid_patterns() < 0)
- return -1;
+ return TEST_FAILED;
if (test_invalid_actions() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_udp() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_tcp() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_sctp() < 0)
- return -1;
+ return TEST_FAILED;
- return 0;
+ return TEST_SUCCESS;
}
REGISTER_TEST_COMMAND(flow_classify_autotest, test_flow_classify);
--
2.14.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH v2] test: fix incorrect return types
2018-07-17 12:39 ` [dpdk-stable] [PATCH v2] " Reshma Pattan
@ 2018-07-17 12:58 ` Burakov, Anatoly
2018-07-17 13:51 ` Pattan, Reshma
2018-07-17 16:44 ` [dpdk-stable] [PATCH v3] " Reshma Pattan
1 sibling, 1 reply; 7+ messages in thread
From: Burakov, Anatoly @ 2018-07-17 12:58 UTC (permalink / raw)
To: Reshma Pattan, dev; +Cc: jasvinder.singh, bernard.iremonger, stable
On 17-Jul-18 1:39 PM, Reshma Pattan wrote:
> UTs should return either TEST_SUCCESS or TEST_FAILED only.
> They should not return 0, -1 and any other value.
>
> Also replace one instance of setting the ret value
> from -ENOMEM to TEST_FAILED, in order to return
> correct value to autotest.
>
> Fixes: 9c9befea4f ("test: add flow classify unit tests")
> CC: jasvinder.singh@intel.com
> CC: bernard.iremonger@intel.com
> CC: stable@dpdk.org
>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> v2: update commit message
> ---
<snip>
> @@ -871,32 +871,32 @@ test_flow_classify(void)
> printf("Line %i: f_create has failed!\n", __LINE__);
> rte_flow_classifier_free(cls->cls);
> rte_free(cls);
> - return -1;
> + return TEST_FAILED;
> }
> printf("Created table_acl for for IPv4 five tuple packets\n");
>
> ret = init_mbufpool();
> if (ret) {
> printf("Line %i: init_mbufpool has failed!\n", __LINE__);
> - return -1;
> + return TEST_FAILED;
> }
>
> if (test_invalid_parameters() < 0)
> - return -1;
> + return TEST_FAILED;
> if (test_valid_parameters() < 0)
> - return -1;
> + return TEST_FAILED;
> if (test_invalid_patterns() < 0)
> - return -1;
> + return TEST_FAILED;
> if (test_invalid_actions() < 0)
> - return -1;
> + return TEST_FAILED;
> if (test_query_udp() < 0)
> - return -1;
> + return TEST_FAILED;
> if (test_query_tcp() < 0)
> - return -1;
> + return TEST_FAILED;
> if (test_query_sctp() < 0)
> - return -1;
> + return TEST_FAILED;
>
> - return 0;
> + return TEST_SUCCESS;
> }
>
> REGISTER_TEST_COMMAND(flow_classify_autotest, test_flow_classify);
>
I'm nitpicking now, but technically, we could've foregone large part of
this patch and just kept the part above. We don't actually care if
individual test functions return -1 or TEST_FAILED - we just need the
return from test app to be that :)
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH v2] test: fix incorrect return types
2018-07-17 12:58 ` Burakov, Anatoly
@ 2018-07-17 13:51 ` Pattan, Reshma
0 siblings, 0 replies; 7+ messages in thread
From: Pattan, Reshma @ 2018-07-17 13:51 UTC (permalink / raw)
To: Burakov, Anatoly, dev; +Cc: Singh, Jasvinder, Iremonger, Bernard, stable
Hi,
> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Tuesday, July 17, 2018 1:58 PM
> To: Pattan, Reshma <reshma.pattan@intel.com>; dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; stable@dpdk.org
> Subject: Re: [PATCH v2] test: fix incorrect return types
>
>
> > @@ -871,32 +871,32 @@ test_flow_classify(void)
> > printf("Line %i: f_create has failed!\n", __LINE__);
> > rte_flow_classifier_free(cls->cls);
> > rte_free(cls);
> > - return -1;
> > + return TEST_FAILED;
> > }
> > printf("Created table_acl for for IPv4 five tuple packets\n");
> >
> > ret = init_mbufpool();
> > if (ret) {
> > printf("Line %i: init_mbufpool has failed!\n", __LINE__);
> > - return -1;
> > + return TEST_FAILED;
> > }
> >
> > if (test_invalid_parameters() < 0)
> > - return -1;
> > + return TEST_FAILED;
> > if (test_valid_parameters() < 0)
> > - return -1;
> > + return TEST_FAILED;
> > if (test_invalid_patterns() < 0)
> > - return -1;
> > + return TEST_FAILED;
> > if (test_invalid_actions() < 0)
> > - return -1;
> > + return TEST_FAILED;
> > if (test_query_udp() < 0)
> > - return -1;
> > + return TEST_FAILED;
> > if (test_query_tcp() < 0)
> > - return -1;
> > + return TEST_FAILED;
> > if (test_query_sctp() < 0)
> > - return -1;
> > + return TEST_FAILED;
> >
> > - return 0;
> > + return TEST_SUCCESS;
> > }
> >
> > REGISTER_TEST_COMMAND(flow_classify_autotest, test_flow_classify);
> >
>
> I'm nitpicking now, but technically, we could've foregone large part of this
> patch and just kept the part above. We don't actually care if individual test
> functions return -1 or TEST_FAILED - we just need the return from test app to
> be that :)
>
Make sense. Will do the changes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-stable] [PATCH v3] test: fix incorrect return types
2018-07-17 12:39 ` [dpdk-stable] [PATCH v2] " Reshma Pattan
2018-07-17 12:58 ` Burakov, Anatoly
@ 2018-07-17 16:44 ` Reshma Pattan
2018-07-26 19:41 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
1 sibling, 1 reply; 7+ messages in thread
From: Reshma Pattan @ 2018-07-17 16:44 UTC (permalink / raw)
To: dev
Cc: anatoly.burakov, jasvinder.singh, bernard.iremonger, stable,
Reshma Pattan
UTs should return either TEST_SUCCESS or TEST_FAILED only.
They should not return 0, -1 and any other value.
Fixes: 9c9befea4f ("test: add flow classify unit tests")
CC: jasvinder.singh@intel.com
CC: bernard.iremonger@intel.com
CC: stable@dpdk.org
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
v3: remove return of TEST_SUCESS and TEST_FAILED from
unnecessary places.
---
---
test/test/test_flow_classify.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c
index fc83b69ae..5f5beeee7 100644
--- a/test/test/test_flow_classify.c
+++ b/test/test/test_flow_classify.c
@@ -871,32 +871,32 @@ test_flow_classify(void)
printf("Line %i: f_create has failed!\n", __LINE__);
rte_flow_classifier_free(cls->cls);
rte_free(cls);
- return -1;
+ return TEST_FAILED;
}
printf("Created table_acl for for IPv4 five tuple packets\n");
ret = init_mbufpool();
if (ret) {
printf("Line %i: init_mbufpool has failed!\n", __LINE__);
- return -1;
+ return TEST_FAILED;
}
if (test_invalid_parameters() < 0)
- return -1;
+ return TEST_FAILED;
if (test_valid_parameters() < 0)
- return -1;
+ return TEST_FAILED;
if (test_invalid_patterns() < 0)
- return -1;
+ return TEST_FAILED;
if (test_invalid_actions() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_udp() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_tcp() < 0)
- return -1;
+ return TEST_FAILED;
if (test_query_sctp() < 0)
- return -1;
+ return TEST_FAILED;
- return 0;
+ return TEST_SUCCESS;
}
REGISTER_TEST_COMMAND(flow_classify_autotest, test_flow_classify);
--
2.14.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] test: fix incorrect return types
2018-07-17 16:44 ` [dpdk-stable] [PATCH v3] " Reshma Pattan
@ 2018-07-26 19:41 ` Thomas Monjalon
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-07-26 19:41 UTC (permalink / raw)
To: Reshma Pattan
Cc: dev, anatoly.burakov, jasvinder.singh, bernard.iremonger, stable
17/07/2018 18:44, Reshma Pattan:
> UTs should return either TEST_SUCCESS or TEST_FAILED only.
> They should not return 0, -1 and any other value.
>
> Fixes: 9c9befea4f ("test: add flow classify unit tests")
> CC: jasvinder.singh@intel.com
> CC: bernard.iremonger@intel.com
> CC: stable@dpdk.org
>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-26 19:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 16:58 [dpdk-stable] [PATCH] test: fix incorrect return types Reshma Pattan
2018-07-17 9:28 ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2018-07-17 12:39 ` [dpdk-stable] [PATCH v2] " Reshma Pattan
2018-07-17 12:58 ` Burakov, Anatoly
2018-07-17 13:51 ` Pattan, Reshma
2018-07-17 16:44 ` [dpdk-stable] [PATCH v3] " Reshma Pattan
2018-07-26 19:41 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
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).