From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 315A55F72 for ; Thu, 6 Dec 2018 09:56:16 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2018 00:56:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,321,1539673200"; d="scan'208";a="281397359" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 06 Dec 2018 00:56:15 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 6 Dec 2018 00:56:15 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.201]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.46]) with mapi id 14.03.0415.000; Thu, 6 Dec 2018 16:56:13 +0800 From: "Tu, Lijuan" To: "Lin, Xueqin" , "dts@dpdk.org" CC: "Lin, Xueqin" Thread-Topic: [dts] [PATCH] tests: add hotplug on multi-processes test suite Thread-Index: AQHUhkTIolk8dZXN7UaNTbq84TnIcqVxdmXw Date: Thu, 6 Dec 2018 08:56:12 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0B9DCB01@SHSMSX101.ccr.corp.intel.com> References: <1543296621-36447-1-git-send-email-xueqin.lin@intel.com> In-Reply-To: <1543296621-36447-1-git-send-email-xueqin.lin@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTc3MmFkMzYtNTlmYi00MWFjLWJiZDEtMmY0NGNkZTE3NDAyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUzdvTVwvMnJIT0tyTEJmeU9kVllkU0w0K3dnbDQrTkxYS0hGQ2JSdWF3QU9pUUZ3UWdybHdJYTcrZHJZQnBUcDYifQ== x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH] tests: add hotplug on multi-processes test suite X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 08:56:18 -0000 Hi xueqin, This patch was applied on Nov 27th, thanks. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xueqin Lin > Sent: Tuesday, November 27, 2018 1:30 PM > To: dts@dpdk.org > Cc: Lin, Xueqin > Subject: [dts] [PATCH] tests: add hotplug on multi-processes test suite >=20 > From: "xueqin.lin" >=20 > Signed-off-by: Xueqin Lin >=20 > --- > tests/TestSuite_hotplug_mp.py | 310 > ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 310 insertions(+) > create mode 100644 tests/TestSuite_hotplug_mp.py >=20 > diff --git a/tests/TestSuite_hotplug_mp.py b/tests/TestSuite_hotplug_mp.p= y > new file mode 100644 index 0000000..20f914a > --- /dev/null > +++ b/tests/TestSuite_hotplug_mp.py > @@ -0,0 +1,310 @@ > +# > + > +""" > +DPDK Test suite. > +Hotplug Multi-process Test. > +""" > + > +import utils > +import time > +from test_case import TestCase > + > +test_loop =3D 2 > + > + > +class TestHotplugMp(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > + self.intf0 =3D self.dut.ports_info[0]['intf'] > + self.pci0 =3D self.dut.ports_info[0]['pci'] > + out =3D > self.dut.build_dpdk_apps("./examples/multi_process/hotplug_mp") > + self.verify('Error' not in out, "Compilation failed") > + # Start one new session to run primary process > + self.session_pri =3D self.dut.new_session() > + # Start two new sessions to run secondary process > + self.session_sec_1 =3D self.dut.new_session() > + self.session_sec_2 =3D self.dut.new_session() > + if self.drivername !=3D "": > + self.dut.bind_interfaces_linux(self.kdriver) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def multi_process_setup(self): > + """ > + Setup primary process and two secondary processes. > + """ > + out =3D self.session_pri.send_expect( > + "./examples/multi_process/hotplug_mp/%s/hotplug_mp > --proc-type=3Dauto" > + % self.target, "example>") > + self.verify("Auto-detected process type: PRIMARY" in out, > + "Failed to setup primary process!") > + for out in [self.session_sec_1.send_expect( > + > "./examples/multi_process/hotplug_mp/%s/hotplug_mp --proc-type=3Dauto" > + % self.target, "example>"), > + self.session_sec_2.send_expect( > + > "./examples/multi_process/hotplug_mp/%s/hotplug_mp --proc-type=3Dauto" > + % self.target, "example>")]: > + self.verify("Auto-detected process type: SECONDARY" in out, > + "Failed to setup secondary process!") > + > + def multi_process_quit(self): > + """ > + Quit primary process and two secondary processes. > + """ > + self.session_sec_1.send_expect("quit", "#") > + self.session_sec_2.send_expect("quit", "#") > + self.session_pri.send_expect("quit", "#") > + > + def verify_devlist(self, dev=3D"0000:00:00.0", flg_exist=3D1): > + """ > + Check device list to verify if exist the device. > + """ > + for out in [self.session_pri.send_expect("list", "example>", 100= ), > + self.session_sec_1.send_expect("list", "example>", > 100), > + self.session_sec_2.send_expect("list", "example>", > 100)]: > + self.verify("list all etherdev" in out, > + "Failed to list device on multi-process!") > + if flg_exist =3D=3D 1: > + self.verify(dev in out, "Fail that don't have the device= !") > + if flg_exist =3D=3D 0: > + self.verify(dev not in out, "Fail that have the > + device!") > + > + def attach_detach(self, process=3D"pri", is_dev=3D1, opt_plug=3D"plu= gin", > flg_loop=3D0, dev=3D"0000:00:00.0"): > + """ > + Attach or detach physical/virtual device from primary/secondary > + process. > + process: define primary or secondary process. > + is_dev: define physical device as 1, virtual device as 0. > + opt_plug: define plug options as below > + plugin: plug in device > + plugout: plug out device > + hotplug: plug in then plug out device from primary or > + secondary process > + crossplug: plug in from primary process then plug out > from > + secondary process, or plug in from > secondary > + process then plug out from primary > + flg_loop: define loop test flag > + dev: define physical device PCI "0000:00:00.0" or virtual device > + "net_af_packet" > + """ > + > + if opt_plug =3D=3D "plugin": > + self.verify_devlist(dev, flg_exist=3D0) > + for i in range(test_loop): > + if process =3D=3D "pri": > + if is_dev =3D=3D 0: > + self.session_pri.send_expect( > + "attach %s,iface=3D%s" > + % (dev, self.intf0), "example>", 100) > + else: > + self.session_pri.send_expect( > + "attach %s" % dev, "example>", 100) > + if process =3D=3D "sec": > + if is_dev =3D=3D 0: > + self.session_sec_1.send_expect( > + "attach %s,iface=3D%s" > + % (dev, self.intf0), "example>", 100) > + else: > + self.session_sec_1.send_expect( > + "attach %s" % dev, "example>", 100) > + if flg_loop =3D=3D 0: > + break > + > + self.verify_devlist(dev, flg_exist=3D1) > + > + if opt_plug =3D=3D "plugout": > + self.verify_devlist(dev, flg_exist=3D1) > + for i in range(test_loop): > + if process =3D=3D "pri": > + self.session_pri.send_expect( > + "detach %s" % dev, "example>", 100) > + if process =3D=3D "sec": > + self.session_sec_1.send_expect( > + "detach %s" % dev, "example>", 100) > + if flg_loop =3D=3D 0: > + break > + > + self.verify_devlist(dev, flg_exist=3D0) > + > + def attach_detach_dev(self, process=3D"pri", opt_plug=3D"plugin", > flg_loop=3D0, dev=3D"0000:00:00.0"): > + """ > + Attach or detach physical device from primary/secondary > process. > + """ > + # Scan port status when example setup, list ports that have been > + # bound to pmd > + if opt_plug in ["plugin", "hotplug", "crossplug"]: > + self.multi_process_setup() > + self.dut.bind_interfaces_linux(self.drivername) > + elif opt_plug =3D=3D "plugout": > + self.dut.bind_interfaces_linux(self.drivername) > + self.multi_process_setup() > + > + if opt_plug in ["plugin", "plugout"]: > + self.attach_detach(process, 1, opt_plug, flg_loop, dev) > + elif opt_plug in ["hotplug", "crossplug"]: > + for i in range(test_loop): > + self.attach_detach(process, 1, "plugin", flg_loop, dev) > + if opt_plug =3D=3D "crossplug": > + if process =3D=3D "pri": > + cross_proc =3D "sec" > + elif process =3D=3D "sec": > + cross_proc =3D "pri" > + self.attach_detach(cross_proc, 1, "plugout", > flg_loop, dev) > + else: > + self.attach_detach(process, 1, "plugout", flg_loop, > + dev) > + > + self.multi_process_quit() > + self.dut.bind_interfaces_linux(self.kdriver) > + > + def attach_detach_vdev(self, process=3D"pri", opt_plug=3D"plugin", > flg_loop=3D0, dev=3D"net_af_packet"): > + """ > + Attach or detach virtual device from primary/secondary process. > + Check port interface is at link up status before hotplug test. > + If link not up, may have below error: > + rte_pmd_init_internals(): net_af_packet: ioctl failed > (SIOCGIFINDEX) > + EAL: Driver cannot attach the device (net_af_packet) > + """ > + self.dut.send_expect("ifconfig %s up" % self.intf0, "#") > + time.sleep(5) > + out =3D self.dut.send_expect("ethtool %s" % self.intf0, "#") > + self.verify("Link detected: yes" in out, "Wrong link status") > + > + self.multi_process_setup() > + for i in range(test_loop): > + self.attach_detach(process, 0, "plugin", flg_loop, dev) > + if opt_plug in ["plugout", "hotplug", "crossplug"]: > + if opt_plug =3D=3D "crossplug": > + if process =3D=3D "pri": > + cross_proc =3D "sec" > + elif process =3D=3D "sec": > + cross_proc =3D "pri" > + self.attach_detach(cross_proc, 0, "plugout", > flg_loop, dev) > + else: > + self.attach_detach(process, 0, "plugout", flg_loop, > + dev) > + > + if opt_plug =3D=3D "plugin" or opt_plug =3D=3D "plugout": > + break > + > + self.multi_process_quit() > + > + def test_attach_dev_primary(self): > + """ > + Attach physical device from primary. > + """ > + self.attach_detach_dev("pri", "plugin", 0, self.pci0) > + > + def test_attach_dev_secondary(self): > + """ > + Attach physical device from secondary. > + """ > + self.attach_detach_dev("sec", "plugin", 0, self.pci0) > + > + def test_detach_dev_primary(self): > + """ > + Detach physical device from primary. > + """ > + self.attach_detach_dev("pri", "plugout", 0, self.pci0) > + > + def test_detach_dev_secondary(self): > + """ > + Detach physical device from secondary. > + """ > + self.attach_detach_dev("sec", "plugout", 0, self.pci0) > + > + def test_attach_detach_dev_primary_loop(self): > + """ > + Repeat to attach then detach physical device from primary. > + """ > + self.attach_detach_dev("pri", "hotplug", 1, self.pci0) > + > + def test_attach_detach_dev_secondary_loop(self): > + """ > + Repeat to attach then detach physical device from secondary. > + """ > + self.attach_detach_dev("sec", "hotplug", 1, self.pci0) > + > + def test_attach_detach_dev_primary_cross_loop(self): > + """ > + Repeat to attach physical device from primary then detach device > + from secondary. > + """ > + self.attach_detach_dev("pri", "crossplug", 1, self.pci0) > + > + def test_attach_detach_dev_secondary_cross_loop(self): > + """ > + Repeat to attach physical device from secondary then detach > device > + from primary. > + """ > + self.attach_detach_dev("sec", "crossplug", 1, self.pci0) > + > + def test_attach_vdev_primary(self): > + """ > + Attach virtual device from primary. > + """ > + self.attach_detach_vdev("pri", "plugin", 0, "net_af_packet") > + > + def test_attach_vdev_secondary(self): > + """ > + Attach virtual device from secondary. > + """ > + self.attach_detach_vdev("sec", "plugin", 0, "net_af_packet") > + > + def test_detach_vdev_primary(self): > + """ > + Detach virtual device from primary. > + """ > + self.attach_detach_vdev("pri", "plugout", 0, "net_af_packet") > + > + def test_detach_vdev_secondary(self): > + """ > + Detach virtual device from secondary. > + """ > + self.attach_detach_vdev("sec", "plugout", 0, "net_af_packet") > + > + def test_attach_detach_vdev_primary_loop(self): > + """ > + Repeat to attach then detach virtual device from primary. > + """ > + self.attach_detach_vdev("pri", "hotplug", 1, "net_af_packet") > + > + def test_attach_detach_vdev_secondary_loop(self): > + """ > + Repeat to attach then detach virtual device from secondary. > + """ > + self.attach_detach_vdev("sec", "hotplug", 1, "net_af_packet") > + > + def test_attach_detach_vdev_primary_cross_loop(self): > + """ > + Repeat to attach virtual device from primary then detach device > + from secondary. > + """ > + self.attach_detach_vdev("pri", "crossplug", 1, "net_af_packet") > + > + def test_attach_detach_vdev_secondary_cross_loop(self): > + """ > + Repeat to attach virtual device from secondary then detach > device > + from primary. > + """ > + self.attach_detach_vdev("sec", "crossplug", 1, "net_af_packet") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + pass > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.dut.close_session(self.dut) > + self.dut.kill_all() > -- > 2.7.5