From: "Burakov, Anatoly" Subject: Re: [PATCH v2] test: fix incorrect return types Date: Tue, 17 Jul 2018 13:58:03 +0100 Message-ID: References: <1531760319-2996-1-git-send-email-reshma.pattan@intel.com> <1531831199-9952-1-git-send-email-reshma.pattan@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: jasvinder.singh@intel.com, bernard.iremonger@intel.com, stable@dpdk.org To: Reshma Pattan , dev@dpdk.org Return-path: In-Reply-To: <1531831199-9952-1-git-send-email-reshma.pattan@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > Reviewed-by: Anatoly Burakov > --- > v2: update commit message > --- > @@ -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