From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 9D4153989 for ; Mon, 4 Sep 2017 11:30:58 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2017 02:30:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,474,1498546800"; d="scan'208";a="125360463" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.24]) by orsmga004.jf.intel.com with SMTP; 04 Sep 2017 02:30:55 -0700 Received: by (sSMTP sendmail emulation); Mon, 04 Sep 2017 10:30:54 +0100 Date: Mon, 4 Sep 2017 10:30:54 +0100 From: Bruce Richardson To: Jacek Piasecki Cc: dev@dpdk.org, deepak.k.jain@intel.com, kubax.kozak@intel.com, michalx.k.jastrzebski@intel.com Message-ID: <20170904093054.GA16356@bricha3-MOBL3.ger.corp.intel.com> References: <1498560760-104196-2-git-send-email-jacekx.piasecki@intel.com> <1499690657-81150-1-git-send-email-jacekx.piasecki@intel.com> <1499690657-81150-6-git-send-email-jacekx.piasecki@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1499690657-81150-6-git-send-email-jacekx.piasecki@intel.com> Organization: Intel Research and =?iso-8859-1?Q?De=ACvel?= =?iso-8859-1?Q?opment?= Ireland Ltd. User-Agent: Mutt/1.8.3 (2017-05-23) Subject: Re: [dpdk-dev] [PATCH v4 5/5] test/cfgfile: add new unit test 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: Mon, 04 Sep 2017 09:30:59 -0000 On Mon, Jul 10, 2017 at 02:44:17PM +0200, Jacek Piasecki wrote: > Load huge realloc_sections.ini file to check malloc/realloc > ability of cfgfile library. > > Signed-off-by: Jacek Piasecki > --- > test/test/test_cfgfile.c | 40 +++++++ > test/test/test_cfgfiles/etc/realloc_sections.ini | 128 +++++++++++++++++++++++ > 2 files changed, 168 insertions(+) > create mode 100644 test/test/test_cfgfiles/etc/realloc_sections.ini > > diff --git a/test/test/test_cfgfile.c b/test/test/test_cfgfile.c > index 4cc9b14..2278618 100644 > --- a/test/test/test_cfgfile.c > +++ b/test/test/test_cfgfile.c > @@ -111,6 +111,7 @@ _test_cfgfile_sample(struct rte_cfgfile *cfgfile) > return 0; > } > > + > static int > test_cfgfile_sample1(void) > { > @@ -154,6 +155,42 @@ test_cfgfile_sample2(void) > } > > static int > +test_cfgfile_realloc_sections(void) > +{ > + struct rte_cfgfile *cfgfile; > + int ret; > + const char *value; > + > + cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/realloc_sections.ini", 0); > + TEST_ASSERT_NOT_NULL(cfgfile, "Failed to load config file"); > + > + ret = rte_cfgfile_num_sections(cfgfile, NULL, 0); > + TEST_ASSERT(ret == 9, "Unexpected number of sections: %d", ret); > + > + ret = rte_cfgfile_has_section(cfgfile, "section9"); > + TEST_ASSERT(ret, "section9 missing"); > + > + ret = rte_cfgfile_section_num_entries(cfgfile, "section3"); > + TEST_ASSERT(ret == 21, > + "section3 unexpected number of entries: %d", ret); > + > + ret = rte_cfgfile_section_num_entries(cfgfile, "section9"); > + TEST_ASSERT(ret == 8, "section9 unexpected number of entries: %d", ret); > + > + value = rte_cfgfile_get_entry(cfgfile, "section9", "key8"); > + TEST_ASSERT(strcmp("value8_section9", value) == 0, > + "key unexpected value: %s", value); > + > + ret = rte_cfgfile_save(cfgfile, "cfgfile_save.ini"); > + TEST_ASSERT_SUCCESS(ret, "Failed to save *.ini file"); This file is a temporary one, so: a) should be placed in /tmp b) should be removed at the end of the test.