From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 2FBB23B5 for ; Tue, 7 Feb 2017 16:17:33 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 07 Feb 2017 07:17:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="40966957" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga002.jf.intel.com with ESMTP; 07 Feb 2017 07:17:31 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.230]) by IRSMSX154.ger.corp.intel.com ([169.254.12.40]) with mapi id 14.03.0248.002; Tue, 7 Feb 2017 15:17:31 +0000 From: "Van Haaren, Harry" To: Jerin Jacob , "dev@dpdk.org" CC: "Richardson, Bruce" , "hemant.agrawal@nxp.com" , "Eads, Gage" Thread-Topic: [dpdk-dev] [PATCH 4/4] app/test: unit test case to exercise eventdev vdev uninit Thread-Index: AQHSgDlf9m9W0IrE90y65APNTIy21KFdqJUw Date: Tue, 7 Feb 2017 15:17:30 +0000 Message-ID: References: <1486358620-4075-1-git-send-email-jerin.jacob@caviumnetworks.com> <1486358620-4075-5-git-send-email-jerin.jacob@caviumnetworks.com> In-Reply-To: <1486358620-4075-5-git-send-email-jerin.jacob@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmIwYTk4MGItMjIyOS00ZmI2LTllNjAtOTEwMWVhYjI3ODg2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IktEbUdGcVZZRGRnVXZNcFd0Qk5vU1hQREVjK25nMjZWYXA5eElHQWxGOGM9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 4/4] app/test: unit test case to exercise eventdev vdev uninit 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, 07 Feb 2017 15:17:34 -0000 > -----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 ; hemant.agrawal@nxp.co= m; Eads, Gage > ; Van Haaren, Harry ; Je= rin Jacob > > Subject: [dpdk-dev] [PATCH 4/4] app/test: unit test case to exercise even= tdev vdev uninit >=20 > Signed-off-by: Jerin Jacob > --- Comments inline, > app/test/test_eventdev.c | 60 ++++++++++++++++++++++++++++++++++++++++++= +++++- > 1 file changed, 59 insertions(+), 1 deletion(-) >=20 > 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 > } > return TEST_SUCCESS; > } > @@ -720,6 +720,62 @@ test_eventdev_close(void) > return rte_event_dev_close(TEST_DEV_ID); > } >=20 > +#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 fl= exible 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= :) > + int i, ret; > + uint8_t curr_count; > + char name[RTE_EVENTDEV_NAME_MAX_LEN]; > + > + curr_count =3D rte_event_dev_count(); > + > + /* Start from one to avoid overlap with active event_skeleton0 dev */ > + for (i =3D 1; i <=3D TEST_EVENTDEV_COUNT; i++) { > + ret =3D snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN, > + "%s%u", "event_skeleton", i); > + TEST_ASSERT(ret >=3D 0, "Expected >0, %d", ret); > + ret =3D rte_eal_vdev_init(name, NULL); > + TEST_ASSERT_SUCCESS(ret, "Failed to init event_skeleton dev %s", > + name); > + } > + for (i =3D 1; i <=3D TEST_EVENTDEV_COUNT; i++) { > + ret =3D snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN, > + "%s%u", "event_skeleton", i); > + TEST_ASSERT(ret >=3D 0, "Expected >0, %d", ret); > + ret =3D rte_eal_vdev_uninit(name); > + TEST_ASSERT_SUCCESS(ret, "Failed to uninit skeleton dev %s", > + name); > + } > + TEST_ASSERT(curr_count =3D=3D rte_event_dev_count(), > + "init/uninit pairs count mismatch"); > + > + /* Test in reverse order */ > + for (i =3D 1; i <=3D TEST_EVENTDEV_COUNT; i++) { > + ret =3D snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN, > + "%s%u", "event_skeleton", i); > + TEST_ASSERT(ret >=3D 0, "Expected >0, %d", ret); > + ret =3D rte_eal_vdev_init(name, NULL); > + TEST_ASSERT_SUCCESS(ret, "Failed to init event_skeleton dev %s", > + name); > + } > + for (i =3D TEST_EVENTDEV_COUNT; i > 0; i--) { > + ret =3D snprintf(name, RTE_EVENTDEV_NAME_MAX_LEN, > + "%s%u", "event_skeleton", i); > + TEST_ASSERT(ret >=3D 0, "Expected >0, %d", ret); > + ret =3D rte_eal_vdev_uninit(name); > + TEST_ASSERT_SUCCESS(ret, "Failed to uninit skeleton dev %s", > + name); > + } > + TEST_ASSERT(curr_count =3D=3D 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 =3D { > .suite_name =3D "eventdev common code unit test suite", > .setup =3D testsuite_setup, > @@ -765,6 +821,8 @@ static struct unit_test_suite eventdev_common_testsui= te =3D { > 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