From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 80F682B92; Tue, 17 Jul 2018 14:58:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2018 05:58:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,365,1526367600"; d="scan'208";a="73046045" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.237.220.102]) ([10.237.220.102]) by fmsmga001.fm.intel.com with ESMTP; 17 Jul 2018 05:58:03 -0700 To: Reshma Pattan , dev@dpdk.org Cc: jasvinder.singh@intel.com, bernard.iremonger@intel.com, stable@dpdk.org References: <1531760319-2996-1-git-send-email-reshma.pattan@intel.com> <1531831199-9952-1-git-send-email-reshma.pattan@intel.com> From: "Burakov, Anatoly" Message-ID: Date: Tue, 17 Jul 2018 13:58:03 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1531831199-9952-1-git-send-email-reshma.pattan@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] test: fix incorrect return types X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2018 12:58:07 -0000 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