From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 292A8A00E6 for ; Mon, 13 May 2019 09:31:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DD4D02BC1; Mon, 13 May 2019 09:31:15 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 66E90A49 for ; Mon, 13 May 2019 09:31:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 May 2019 00:31:13 -0700 X-ExtLoop1: 1 Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga008.fm.intel.com with ESMTP; 13 May 2019 00:31:13 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 13 May 2019 00:31:13 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 13 May 2019 00:31:13 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.216]) with mapi id 14.03.0415.000; Mon, 13 May 2019 15:31:10 +0800 From: "Tu, Lijuan" To: "Wu, ChangqingX" , "dts@dpdk.org" CC: "Wu, ChangqingX" Thread-Topic: [dts] [PATCH V3] test:add test suite about l2fwd jobstats Thread-Index: AQHVBtd+pjyGs7oWQEC/VEE7yiBbH6ZorfNQ Date: Mon, 13 May 2019 07:31:10 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA7FC9F@SHSMSX101.ccr.corp.intel.com> References: <1557455280-38424-1-git-send-email-changqingx.wu@intel.com> In-Reply-To: <1557455280-38424-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.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2Y4NjgzNDEtYzViOS00NWFjLThjNjctMWEwMmExNzUyMzkzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWXljM09ENlwvVWppUWdQMnBWWFE1S1ZBM2tVV0N2bmpyNjcrRWVtQ0F5OFlpZTRxRlpQNmtJemlzdHZmNUNRZ1MifQ== 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 V3] test:add test suite about l2fwd jobstats 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of changqingxwu > Sent: Friday, May 10, 2019 10:28 AM > To: dts@dpdk.org > Cc: Wu, ChangqingX > Subject: [dts] [PATCH V3] test:add test suite about l2fwd jobstats >=20 > Signed-off-by: changqingxwu > --- > tests/TestSuite_l2fwd_jobstats.py | 112 ++++++++++++++++++++++++++++++ > 1 file changed, 112 insertions(+) > create mode 100644 tests/TestSuite_l2fwd_jobstats.py >=20 > diff --git a/tests/TestSuite_l2fwd_jobstats.py > b/tests/TestSuite_l2fwd_jobstats.py > new file mode 100644 > index 0000000..70ddee2 > --- /dev/null > +++ b/tests/TestSuite_l2fwd_jobstats.py > @@ -0,0 +1,112 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2019 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 L2fwd Jobstats > +""" > + > +import time > +import re > +import utils > +from test_case import TestCase > + > + > +class TestL2fwdJobstats(TestCase): > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + > + self.verify(self.nic not in ["fortville_eagle", "fortville_spiri= t", > + "fortville_spirit_single", "fortville_2= 5g", "fortpark_TLV"], > + "NIC Unsupported: " + str(self.nic)) > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports") > + self.verify(len(self.dut.cores) >=3D 4, "Insufficient cores for = testing") > + cores =3D self.dut.get_core_list("1S/4C/1T") > + self.coremask =3D utils.create_mask(cores) > + > + dut_port0 =3D self.dut_ports[0] > + dut_port1 =3D self.dut_ports[1] > + self.tx_ports =3D [dut_port0, dut_port1] > + > + # build sample app > + out =3D self.dut.build_dpdk_apps("./examples/l2fwd-jobstats") > + self.verify("Error" not in out, "compilation error 1") > + self.verify("No such file" not in out, "compilation error 2") > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def test_l2fwd_jobstats_check(self): > + """ > + Verify l2fwd jobstats is correct > + """ > + path =3D "./examples/l2fwd-jobstats/build/l2fwd-jobstats" > + cmd =3D path + " -c %s -n 4 -- -q 2 -p 0x03 -l" % (self.coremask= ) > + self.dut.send_expect(cmd, "Port statistics", 60) > + > + self.scapy_send_packet(100000) > + out =3D self.dut.get_session_output(timeout=3D10) > + > + print out > + send_packets =3D re.findall(r"Total packets sent:\s+?(\d+?)\r", = out)[-1] > + receive_packets =3D re.findall(r"Total packets received:\s+?(\d+= ?)\r", > out)[-1] > + self.verify(send_packets =3D=3D receive_packets =3D=3D > + str(100000*len(self.tx_ports)), "Wrong: can't receive enough > + packages") > + > + def scapy_send_packet(self, count): > + """ > + Send a packet to port > + """ > + for i in range(len(self.tx_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"02:00:00:00:00", > src=3D"%s")/IP()/UDP()/Raw(\'X\'*18)], iface=3D"%s",count=3D%s)' % (mac, = txItf, > count)) > + self.tester.scapy_execute(timeout=3D90) > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + pass > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.dut.kill_all() > -- > 2.17.2