patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Reshma Pattan <reshma.pattan@intel.com>, dev@dpdk.org
Cc: jasvinder.singh@intel.com, bernard.iremonger@intel.com, stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH v2] test: fix incorrect return types
Date: Tue, 17 Jul 2018 13:58:03 +0100	[thread overview]
Message-ID: <e5165c58-d1ce-0b91-7c3b-5a5d8c2fb641@intel.com> (raw)
In-Reply-To: <1531831199-9952-1-git-send-email-reshma.pattan@intel.com>

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

  reply	other threads:[~2018-07-17 12:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 16:58 [dpdk-stable] [PATCH] " 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 [this message]
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

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=e5165c58-d1ce-0b91-7c3b-5a5d8c2fb641@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    --cc=reshma.pattan@intel.com \
    --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).