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 BECA67D42 for ; Mon, 4 Sep 2017 18:06:00 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2017 09:05:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,475,1498546800"; d="scan'208";a="125446754" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.57]) ([10.237.220.57]) by orsmga004.jf.intel.com with ESMTP; 04 Sep 2017 09:05:54 -0700 To: Jan Blunck , dev@dpdk.org References: <20170711232512.54641-1-jblunck@infradead.org> <20170714211213.34436-1-jblunck@infradead.org> <20170714211213.34436-4-jblunck@infradead.org> From: Ferruh Yigit Message-ID: Date: Mon, 4 Sep 2017 17:05:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170714211213.34436-4-jblunck@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v2 03/15] devargs: extend unittest 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 16:06:01 -0000 On 7/14/2017 10:12 PM, Jan Blunck wrote: > This is extending the existing unittest to also cover corner cases of > rte_eal_devargs_parse(). > > Signed-off-by: Jan Blunck > --- > test/test/test_devargs.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/test/test/test_devargs.c b/test/test/test_devargs.c > index 02fec8b1f..178c3b243 100644 > --- a/test/test/test_devargs.c > +++ b/test/test/test_devargs.c > @@ -58,6 +58,7 @@ test_devargs(void) > { > struct rte_devargs_list save_devargs_list; > struct rte_devargs *devargs; > + struct rte_devargs devargs_stack; > > /* save the real devargs_list, it is restored at the end of the test */ > save_devargs_list = devargs_list; > @@ -121,6 +122,25 @@ test_devargs(void) > if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "000f:0:0") == 0) > goto fail; > > + if (rte_eal_devargs_parse("", &devargs_stack) == 0) { > + printf("Error in rte_eal_devargs_parse()\n"); > + goto fail; > + } > + > + if (rte_eal_devargs_parse("08:00.1,foo=bar", &devargs_stack) != 0) { > + printf("Error in rte_eal_devargs_parse(08:00.1,foo=bar)\n"); > + goto fail; > + } > + devargs = TAILQ_FIRST(&devargs_list); > + if (devargs != NULL) > + goto fail; > + devargs = &devargs_stack; > + if (strcmp(devargs->name, "08:00.1") != 0) rte_eal_devargs_parse() does not insert into devargs_list, so this check will fail. rte_eal_devargs_add() both calls rte_eal_devargs_parse() and adds into the list. > + goto fail; > + if (!devargs->args || strcmp(devargs->args, "foo=bar") != 0) > + goto fail; > + > + free_devargs_list(); > devargs_list = save_devargs_list; > return 0; > >