From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH v3 4/7] service cores: add unit tests Date: Tue, 4 Jul 2017 16:44:11 +0530 Message-ID: <20170704111410.GA13340@jerin> References: <1498735421-100164-1-git-send-email-harry.van.haaren@intel.com> <1499031314-7172-1-git-send-email-harry.van.haaren@intel.com> <1499031314-7172-5-git-send-email-harry.van.haaren@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, thomas@monjalon.net, keith.wiles@intel.com, bruce.richardson@intel.com To: Harry van Haaren Return-path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0083.outbound.protection.outlook.com [104.47.38.83]) by dpdk.org (Postfix) with ESMTP id B36D7374F for ; Tue, 4 Jul 2017 13:14:31 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1499031314-7172-5-git-send-email-harry.van.haaren@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" -----Original Message----- > Date: Sun, 2 Jul 2017 22:35:11 +0100 > From: Harry van Haaren > To: dev@dpdk.org > CC: jerin.jacob@caviumnetworks.com, thomas@monjalon.net, > keith.wiles@intel.com, bruce.richardson@intel.com, Harry van Haaren > > Subject: [PATCH v3 4/7] service cores: add unit tests > X-Mailer: git-send-email 2.7.4 > > Add a bunch of unit tests, to ensure that the service > core functions are operating as expected. > > As part of these tests a dummy service is registered which > allows identifying if a service callback has been invoked > by using the CPU tick counter. This allows identifying if > functions to start and stop service lcores are actually having > effect. > > Signed-off-by: Harry van Haaren > > --- > > v2 changes; > - Rename variable to slcore_id (Jerin) > - Rename function to unregister_all() (Jerin) > - Fix typos (Jerin) > - Add unit test for get_by_name() > - Add unit tests (all suggestions by Jerin) > -- get_name() > -- Verify probe_capability API > -- Verify MT_SAFE capability (see code for details) > -- Verify rte_service_dump() API I think now UT is addressing all the APIS. A few comments below. > --- > +testsuite_setup(void) > +{ > + /* assuming lcore 1 is available for service-core testing */ > + slcore_id = 1; Rather than assuming, How about taking enabled lcore for testing using rte_get_next_lcore()? dummy_mt_safe_cb() tests using the second lcore now. So I think, you can the get the enabled lcore for MT_SAFE using rte_get_next_lcore() and exit if two lcores not available. > + return TEST_SUCCESS; > +} > + > + > +static struct unit_test_suite service_tests = { > + .suite_name = "service core test suite", > + .setup = testsuite_setup, > + .teardown = testsuite_teardown, > + .unit_test_cases = { > + TEST_CASE_ST(dummy_register, NULL, unregister_all), > + TEST_CASE_ST(dummy_register, NULL, service_name), > + TEST_CASE_ST(dummy_register, NULL, service_get_by_name), > + TEST_CASE_ST(dummy_register, NULL, service_dump), > + TEST_CASE_ST(dummy_register, NULL, service_probe_capability), > + TEST_CASE_ST(dummy_register, NULL, service_start_stop), > + TEST_CASE_ST(dummy_register, NULL, service_lcore_add_del), > + TEST_CASE_ST(dummy_register, NULL, service_lcore_start_stop), > + TEST_CASE_ST(dummy_register, NULL, service_lcore_en_dis_able), > + TEST_CASE_ST(dummy_register, NULL, service_mt_safe_poll), > + TEST_CASES_END() /**< NULL terminate unit test array */ Regarding "Moving service lcore to/from rte lcore back and forth" test reply in http://dpdk.org/dev/patchwork/patch/25655/ I was thinking to enable the test by, calling service_lcore_del() and then call remote launch on that lcore to check it is properly in ROLE_RTE state. How about adding a test for the same to make sure the "Moving service lcore to/from rte lcore back and forth" is OK. With above comments: Acked-by: Jerin Jacob > + } > +}; > + > +static int > +test_service_common(void) > +{ > + return unit_test_suite_runner(&service_tests); > +} > + > +REGISTER_TEST_COMMAND(service_autotest, test_service_common); > -- > 2.7.4 >