DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: "Van Haaren, Harry" <harry.van.haaren@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Richardson, Bruce" <bruce.richardson@intel.com>,
	"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	"Eads, Gage" <gage.eads@intel.com>
Subject: Re: [dpdk-dev] [PATCH 4/4] app/test: unit test case to exercise eventdev vdev uninit
Date: Wed, 8 Feb 2017 18:00:28 +0530	[thread overview]
Message-ID: <20170208123027.GA31813@localhost.localdomain> (raw)
In-Reply-To: <E923DB57A917B54B9182A2E928D00FA6129EEDE7@IRSMSX102.ger.corp.intel.com>

On Tue, Feb 07, 2017 at 03:17:30PM +0000, Van Haaren, Harry wrote:
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > Sent: Monday, February 6, 2017 5:24 AM
> > To: dev@dpdk.org
> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; hemant.agrawal@nxp.com; Eads, Gage
> > <gage.eads@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob
> > <jerin.jacob@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH 4/4] app/test: unit test case to exercise eventdev vdev uninit
> > 
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > ---
> 
> Comments inline,
> 
> >  app/test/test_eventdev.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 59 insertions(+), 1 deletion(-)
> > 
> > diff --git a/app/test/test_eventdev.c b/app/test/test_eventdev.c
> > index 042a446..e817838 100644
> > --- a/app/test/test_eventdev.c
> > +++ b/app/test/test_eventdev.c
> > @@ -51,7 +51,7 @@ testsuite_setup(void)
> >  	if (!count) {
> >  		printf("Failed to find a valid event device,"
> >  			" testing with event_skeleton device\n");
> > -		return rte_eal_vdev_init("event_skeleton", NULL);
> > +		return rte_eal_vdev_init("event_skeleton0", NULL);
> 
> I think these hard-coded eventdev names need to be removed from the testing framework, and we should let the app/test >> propt accept the name of the vdev to use instead. That would allow running tests on each device by:
> 
> RTE>> eventdev_common_autotest event_skeleton0
> 
> RTE>> eventdev_common_autotest event_sw0

It checks for "count = rte_event_dev_count()" before the calling rte_eal_vdev_init.
That's would translate to use any eventdev
driver if it is available in the EAL command line argument.So I think, we
are good here and in case none of the drivers provided in EAL argument
it choose the skeleton driver as default.

sudo ./build/app/test -c 2 --vdev='event_sw0'
sudo ./build/app/test -c 2 --vdev='event_skeleton0'

> 
> 
> >  	}
> >  	return TEST_SUCCESS;
> >  }
> > @@ -720,6 +720,62 @@ test_eventdev_close(void)
> >  	return rte_event_dev_close(TEST_DEV_ID);
> >  }
> > 
> > +#define TEST_EVENTDEV_COUNT 8
> > +
> > +static int
> > +test_eventdev_create_destroy(void)
> > +{
> > +#ifdef RTE_LIBRTE_PMD_SKELETON_EVENTDEV
> 
> Same issue as above, compile-time selection of the tests to be run isn't flexible enough to allow testing multiple eventdevs.
> I think using a parameter to eventdev_common_autotest to pass the "name" to use would work again? I am open to other solutions if there's a better way :)

In general I agree with your comment. But in this specific case,

1) Device can be PCI device too. But,This test case will be applicable only to vdev
device. So does it make sense to generalize.
2) Currently app/test won't accepts the command line arguments for a specific
test case.Is there any other alternatives? If none, I will check for possibility
of adding that change to app/test first.

Another options could be,
1) environment variable
2) new eventdev APIs to get driver name from dev_id.But does not makes much
sense in case PCIe device.

Thoughts?

> 
> 
> > +	int i, ret;
> > +	uint8_t curr_count;
> > +	char name[RTE_EVENTDEV_NAME_MAX_LEN];
> > +
> > +	curr_count = rte_event_dev_count();
> > +
> > +	/* Start from one to avoid overlap with active event_skeleton0 dev */
> > +	for (i = 1; i <= TEST_EVENTDEV_COUNT; i++) {
> > +		ret = snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN,
> > +				 "%s%u", "event_skeleton", i);
> > +		TEST_ASSERT(ret >= 0, "Expected >0, %d", ret);
> > +		ret = rte_eal_vdev_init(name, NULL);
> > +		TEST_ASSERT_SUCCESS(ret, "Failed to init event_skeleton dev %s",
> > +					name);
> > +	}
> > +	for (i = 1; i <= TEST_EVENTDEV_COUNT; i++) {
> > +		ret = snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN,
> > +				 "%s%u", "event_skeleton", i);
> > +		TEST_ASSERT(ret >= 0, "Expected >0, %d", ret);
> > +		ret = rte_eal_vdev_uninit(name);
> > +		TEST_ASSERT_SUCCESS(ret, "Failed to uninit skeleton dev %s",
> > +					name);
> > +	}
> > +	TEST_ASSERT(curr_count == rte_event_dev_count(),
> > +			 "init/uninit pairs count mismatch");
> > +
> > +	/* Test in reverse order */
> > +	for (i = 1; i <= TEST_EVENTDEV_COUNT; i++) {
> > +		ret = snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN,
> > +				 "%s%u", "event_skeleton", i);
> > +		TEST_ASSERT(ret >= 0, "Expected >0, %d", ret);
> > +		ret = rte_eal_vdev_init(name, NULL);
> > +		TEST_ASSERT_SUCCESS(ret, "Failed to init event_skeleton dev %s",
> > +					name);
> > +	}
> > +	for (i = TEST_EVENTDEV_COUNT; i > 0; i--) {
> > +		ret = snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN,
> > +				 "%s%u", "event_skeleton", i);
> > +		TEST_ASSERT(ret >= 0, "Expected >0, %d", ret);
> > +		ret = rte_eal_vdev_uninit(name);
> > +		TEST_ASSERT_SUCCESS(ret, "Failed to uninit skeleton dev %s",
> > +					name);
> > +	}
> > +	TEST_ASSERT(curr_count == rte_event_dev_count(),
> > +			 "init/uninit pairs count mismatch");
> > +#else
> > +	printf("Skipping eventdev_create_destroy test due to unavailability of event skeleton
> > device\n");
> > +#endif
> > +	return TEST_SUCCESS;
> > +}
> >  static struct unit_test_suite eventdev_common_testsuite  = {
> >  	.suite_name = "eventdev common code unit test suite",
> >  	.setup = testsuite_setup,
> > @@ -765,6 +821,8 @@ static struct unit_test_suite eventdev_common_testsuite  = {
> >  			test_eventdev_link_get),
> >  		TEST_CASE_ST(eventdev_setup_device, NULL,
> >  			test_eventdev_close),
> > +		TEST_CASE_ST(NULL, NULL,
> > +			test_eventdev_create_destroy),
> >  		TEST_CASES_END() /**< NULL terminate unit test array */
> >  	}
> >  };
> > --
> > 2.5.5
> 

      reply	other threads:[~2017-02-08 12:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06  5:23 [dpdk-dev] [PATCH 0/4] add eventdev vdev uninit support Jerin Jacob
2017-02-06  5:23 ` [dpdk-dev] [PATCH 1/4] eventdev: fix event driver name to eventdev lookup Jerin Jacob
2017-02-07 15:04   ` Van Haaren, Harry
2017-02-08 14:38     ` Jerin Jacob
2017-02-06  5:23 ` [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support Jerin Jacob
2017-02-07 15:11   ` Van Haaren, Harry
2017-02-08 14:39     ` Jerin Jacob
2017-02-06  5:23 ` [dpdk-dev] [PATCH 3/4] event/skeleton: " Jerin Jacob
2017-02-07 15:11   ` Van Haaren, Harry
2017-02-08 14:40     ` Jerin Jacob
2017-02-06  5:23 ` [dpdk-dev] [PATCH 4/4] app/test: unit test case to exercise eventdev vdev uninit Jerin Jacob
2017-02-07 15:17   ` Van Haaren, Harry
2017-02-08 12:30     ` Jerin Jacob [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170208123027.GA31813@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).