From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 9BEC41B276 for ; Sat, 22 Dec 2018 12:06:52 +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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Dec 2018 03:06:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,383,1539673200"; d="scan'208";a="285773438" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga005.jf.intel.com with ESMTP; 22 Dec 2018 03:06:51 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sat, 22 Dec 2018 03:06:51 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sat, 22 Dec 2018 03:06:50 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.201]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.203]) with mapi id 14.03.0415.000; Sat, 22 Dec 2018 19:06:49 +0800 From: "Tu, Lijuan" To: "Wu, ChangqingX" , "dts@dpdk.org" CC: "Wu, ChangqingX" Thread-Topic: [dts] [PATCH V1] tests/external_memory_auto_test Thread-Index: AQHUmCOeCxkNQ1zlp06Z5SX20DbQ0aWKlcpw Date: Sat, 22 Dec 2018 11:06:48 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0B9E5B85@SHSMSX101.ccr.corp.intel.com> References: <1545283343-36192-1-git-send-email-changqingx.wu@intel.com> In-Reply-To: <1545283343-36192-1-git-send-email-changqingx.wu@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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODNiZGNkMzAtYzVjYS00YTI1LTk1MzMtMGJkMmE5MjM5YWUxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoib2xyOEs0emJOR3pGZWlFVjFESUU4WXFIYTlqQkg2cDBYV3FiSlZKQnk2cGdWdGFpMDBsME13QU5LbnFrNSs0eSJ9 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 V1] tests/external_memory_auto_test 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: Sat, 22 Dec 2018 11:06:53 -0000 Format error: Applying: tests/external_memory_auto_test .git/rebase-apply/patch:72: trailing whitespace. .git/rebase-apply/patch:151: trailing whitespace. .git/rebase-apply/patch:181: new blank line at EOF. + warning: 3 lines add whitespace errors. More comments inline > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Wu,ChangqingX > Sent: Thursday, December 20, 2018 1:22 PM > To: dts@dpdk.org > Cc: Wu, ChangqingX > Subject: [dts] [PATCH V1] tests/external_memory_auto_test >=20 > add new auto testsuite script >=20 > Signed-off-by: Wu,ChangqingX > --- > tests/TestSuite_external_memory.py | 170 > +++++++++++++++++++++++++++++ > 1 file changed, 170 insertions(+) > create mode 100644 tests/TestSuite_external_memory.py >=20 > diff --git a/tests/TestSuite_external_memory.py > b/tests/TestSuite_external_memory.py > new file mode 100644 > index 0000000..e62e47d > --- /dev/null > +++ b/tests/TestSuite_external_memory.py > @@ -0,0 +1,170 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without # > +modification, are permitted provided that the following conditions # > +are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS # > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT > NOT # > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND > FITNESS FOR # > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > COPYRIGHT # > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, # > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > NOT # > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS > OF USE, # > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND > ON ANY # > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR > TORT # > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF > THE USE # > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH > DAMAGE. > + > + > +""" > +DPDK Test suite. > +Test external memory. > +""" > + > +import string > +import time > +import re > +import utils > +from test_case import TestCase > + > + > +class TestExternalMemory(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 2, "Insufficient ports") > + cores =3D self.dut.get_core_list("1S/4C/1T") > + self.coremask =3D utils.create_mask(cores) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def insmod_modprobe(self,modename=3D''): > + """ > + Insmod modProbe before run test case > + """ > + if modename =3D=3D "igb_uio": > + self.dut.send_expect("modprobe uio", "#", 10) > + out =3D self.dut.send_expect("lsmod | grep igb_uio", "#") > + if "igb_uio" in out: > + self.dut.send_expect("rmmod -f igb_uio", "#", 10) > + self.dut.send_expect("insmod ./" + self.target + > + "/kmod/igb_uio.ko", "#", 10) > + > + out =3D self.dut.send_expect("lsmod | grep igb_uio", "#") > + assert ("igb_uio" in out), "Failed to insmod igb_uio" > + > + self.dut.bind_interfaces_linux(driver=3D"igb_uio") > + > + if modename =3D=3D "vfio-pci": > + self.dut.send_expect("rmmod vfio_pci", "#", 10) > + self.dut.send_expect("rmmod vfio_iommu_type1", "#", 10) > + self.dut.send_expect("rmmod vfio", "#", 10) > + self.dut.send_expect("modprobe vfio", "#", 10) > + self.dut.send_expect("modprobe vfio_pci", "#", 10) > + out =3D self.dut.send_expect("lsmod | grep > vfio_iommu_type1", "#") > + assert ("vfio_pci" in out), "Failed to insmod vfio_pci" > + > + self.dut.bind_interfaces_linux(driver=3D"vfio-pci") > + > + def test_IGB_UIO_xmem(self): > + """ > + Verifier IGB_UIO and anonymous memory allocation > + """ > + self.insmod_modprobe(modename=3D"igb_uio") > + cmd =3D "./%s/app/testpmd -c %s -n 4 -- --mp-alloc=3Dxmem > + -i"%(self.target,self.coremask) > + > + self.dut.send_expect(cmd,"testpmd>",60) > + self.verifier_result() > + > + def test_IGB_UIO_xmemhuage(self): > + """ > + Verifier IGB_UIO and anonymous hugepage memory allocation > + """ > + self.insmod_modprobe(modename=3D"igb_uio") > + > + cmd =3D "./%s/app/testpmd -c %s -n 4 -- --mp-alloc=3Dxmemhuge > + -i"%(self.target,self.coremask) > + > + self.dut.send_expect(cmd,"testpmd>",60) > + self.verifier_result() > + > + def test_VFIO_PCI_xmem(self): > + """ > + Verifier VFIO_PCI and anonymous memory allocation > + """ > + self.insmod_modprobe(modename=3D"vfio-pci") > + > + cmd =3D "./%s/app/testpmd -c %s -n 4 -- --mp-alloc=3Dxmem > -i"%(self.target,self.coremask) > + self.dut.send_expect(cmd,"testpmd>",60) > + > + self.verifier_result() > + > + def test_VFIO_PCI_xmemhuge(self): > + """ > + Verifier VFIO and anonymous hugepage memory allocation > + """ > + self.insmod_modprobe(modename=3D"vfio-pci") > + cmd =3D "./%s/app/testpmd -c %s -n 4 -- --mp-alloc=3Dxmemhuge > -i"%(self.target,self.coremask) > + self.dut.send_expect(cmd,"testpmd>",60) > + > + self.verifier_result() > + > + def verifier_result(self): > + self.dut.send_expect("start", "testpmd>",10) > + self.scapy_send_packet(100) > + out =3D self.dut.send_expect("stop", "testpmd>", 10) > + > + p =3D re.compile(r'\d+') > + result =3D p.findall(out) > + amount =3D 100 * len(self.dut_ports) > + self.verify(str(amount) in result, "Wrong: can't get correct > + package") > + > + self.dut.send_expect("quit", "#", 10) > + > + self.dut.unbind_interfaces_linux(self.dut_ports) [Lijuan] this will cause the dut don't bind to any driver, and destroy the = original status, please keep dut bind to the specific driver as configured = while your test suite done. Furthermore, if verify failed, the unbind code won't be executed.=20 BTW, If your tests changed any original status, please resume them. > + > + def scapy_send_packet(self, nu): > + """ > + Send a packet to port > + """ > + for i in range(len(self.dut_ports)): > + txport =3D self.tester.get_local_port(self.dut_ports[i]) > + mac =3D self.dut.get_mac_address(self.dut_ports[i]) > + txItf =3D self.tester.get_interface(txport) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Raw(\'X\'*18)], > iface=3D"%s",count=3D%s)' % (mac, txItf, nu)) > + self.tester.scapy_execute() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + time.sleep(2) > + pass > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > + > -- > 2.17.2