From mboxrd@z Thu Jan 1 00:00:00 1970 From: Remy Horton Subject: Re: [PATCH v2] test: add unit tests for metrics library Date: Tue, 24 Jul 2018 15:53:54 +0100 Message-ID: References: <1530776231-17707-1-git-send-email-hari.kumarx.vemula@intel.com> <1532183219-23263-1-git-send-email-hari.kumarx.vemula@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: reshma.pattan@intel.com To: Hari kumar Vemula , dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 9BE9698 for ; Tue, 24 Jul 2018 16:53:59 +0200 (CEST) In-Reply-To: <1532183219-23263-1-git-send-email-hari.kumarx.vemula@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tested using the following patches also applied: http://patches.dpdk.org/patch/42097/ http://patches.dpdk.org/patch/42098/ http://patches.dpdk.org/patch/42510/ http://patches.dpdk.org/patch/42971/ Two test-cases fail, but these in themselves ought not block this patch. Details below. Acked-by: Remy Horton > + /* Test Case to check failures when memzone init is not done */ > +static int > +test_metrics_without_init(void) > +{ > + int err = 0; > + const uint64_t value[REG_METRIC_COUNT] = {0}; > + const char * const mnames[] = { > + "mean_bits_in", "mean_bits_out", > + "peak_bits_in", "peak_bits_out", > + }; > + > + /* Failure Test: Checking for memzone initialization */ > + err = rte_metrics_reg_name(NULL); > + TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__); Returns -EINVAL instead of -EIO due to NULL check coming before memzone check. Suggest using non-NULL value. > +/* Test case to validate update a list of metrics */ > +static int > +test_metrics_update_values(void) > +{ [..] > + /* Failed Test: Invalid count size */ > + err = rte_metrics_update_values(RTE_METRICS_GLOBAL, > + KEY, &value[0], 0); > + TEST_ASSERT(err < 0, "%s, %d", __func__, __LINE__); Test fails, fault with library: Silent handling length of zero. Will send patch.