From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2AC30A0471 for ; Tue, 13 Aug 2019 08:41:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D6D31B94A; Tue, 13 Aug 2019 08:41:02 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 413FC5681 for ; Tue, 13 Aug 2019 08:41:00 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 23:40:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,380,1559545200"; d="scan'208";a="178584334" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 12 Aug 2019 23:40:58 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 12 Aug 2019 23:40:48 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 12 Aug 2019 23:40:47 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.15]) with mapi id 14.03.0439.000; Tue, 13 Aug 2019 14:40:45 +0800 From: "Wang, Yinan" To: "Zhu, ShuaiX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] tests/vdev_primary_secondary:add testsuite vdev primary secondary Thread-Index: AQHVUOx+fuYbR+/+rkyZJsfg4nKqF6b4ojDw Date: Tue, 13 Aug 2019 06:40:45 +0000 Message-ID: References: <1565600701-67220-1-git-send-email-shuaix.zhu@intel.com> In-Reply-To: <1565600701-67220-1-git-send-email-shuaix.zhu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDRkNTk2NDktZjdhYS00Mjc5LWI1NGMtNGJiMGQ0NjhlMTZlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicmlXUUFmRjl2aEFBb3hvK2JaMW9nTUl4Z2o2OWNEb1JrbGg5WERicG1EWGlcLzlRUERcL2FYdEpPcnNYNEhPUTU5In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] tests/vdev_primary_secondary:add testsuite vdev primary secondary 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" Acked-by: Wang, Yinan > -----Original Message----- > From: Zhu, ShuaiX > Sent: 2019=1B$BG/=1B(B8=1B$B7n=1B(B12=1B$BF|=1B(B 17:05 > To: dts@dpdk.org > Cc: Wang, Yinan ; Zhu, ShuaiX > Subject: [dts][PATCH V1] tests/vdev_primary_secondary:add testsuite vdev > primary secondary >=20 > Add a new testsuite vdev_primary_secondary. >=20 > Signed-off-by: zhu,shuai > --- > tests/TestSuite_vdev_primary_secondary.py | 183 ++++++++++++++++++++++ > 1 file changed, 183 insertions(+) > create mode 100644 tests/TestSuite_vdev_primary_secondary.py >=20 > diff --git a/tests/TestSuite_vdev_primary_secondary.py > b/tests/TestSuite_vdev_primary_secondary.py > new file mode 100644 > index 0000000..6f8f235 > --- /dev/null > +++ b/tests/TestSuite_vdev_primary_secondary.py > @@ -0,0 +1,183 @@ > +# BSD LICENSE > +# Copyright (c) <2019>, Intel Corporation # 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. > +This test is a multi-process test which demonstrates how multiple > +processes can work together to perform packet I/O and packet processing > +in parallel, much as other example application work by using multiple > +threads. In this example, each process reads packets from all network > +ports being used - though from a different RX queue in each case. Those > +packets are then forwarded by each process which sends them out by writi= ng > them directly to a suitable TX queue. > +""" > + > +import time > +import re > +import utils > +from test_case import TestCase > +from virt_common import VM > + > + > +class TestVdevPrimarySecondary(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.queues =3D 2 > + self.mem_channels =3D self.dut.get_memory_channels() > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + cores =3D self.dut.get_core_list("1S/12C/1T", socket=3Dself.port= s_socket) > + self.coremask =3D utils.create_mask(cores) > + self.verify(len(self.coremask) >=3D 6, "The machine has too few > + cores.") > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + > + > + def setup_vm_env(self): > + """ > + Create testing environment > + """ > + self.virtio_mac =3D "52:54:00:00:00:0" > + self.vm =3D VM(self.dut, 'vm0', 'vhost_sample') > + for i in range(self.queues): > + vm_params =3D {} > + vm_params['driver'] =3D 'vhost-user' > + vm_params['opt_path'] =3D './vhost-net%d' % i > + vm_params['opt_mac'] =3D "%s%d" % (self.virtio_mac, i+2) > + vm_params['opt_queue'] =3D self.queues > + vm_params['opt_server'] =3D 'server' > + vm_params['opt_settings'] =3D 'mrg_rxbuf=3Don,mq=3Don,vector= s=3D%d' % > (2*self.queues+2) > + self.vm.set_vm_device(**vm_params) > + > + try: > + self.vm_dut =3D self.vm.start() > + if self.vm_dut is None: > + raise Exception("Set up VM ENV failed") > + except Exception as e: > + self.logger.error("ERROR: Failure for %s" % str(e)) > + > + return True > + > + > + def launch_testpmd(self): > + """ > + launch testpmd > + """ > + cmd =3D "./%s/app/testpmd -l 1-6 -n %d --socket-mem 2048,2048 > --legacy-mem --file-prefix=3Dvhost" + \ > + " --vdev 'net_vhost0,iface=3Dvhost-net0,queues=3D%d,client= =3D1'" + > \ > + " --vdev 'net_vhost1,iface=3Dvhost-net1,queues=3D%d,client= =3D1'" + > \ > + " -- -i --nb-cores=3D4 --rxq=3D%d --txq=3D%d --txd=3D1024 = --rxd=3D1024" > + start_cmd =3D cmd % (self.target, self.mem_channels, self.queues= , > self.queues, self.queues, self.queues) > + self.dut.send_expect(start_cmd, "testpmd> ", 120) > + self.dut.send_expect("set fwd txonly", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + > + > + def launch_examples(self): > + example_cmd_auto =3D > "./examples/multi_process/symmetric_mp/build/symmetric_mp -l 0 -n %d > --proc-type=3Dauto -- -p 3 --num-procs=3D%d --proc-id=3D0" > + example_cmd_secondary =3D > "./examples/multi_process/symmetric_mp/build/symmetric_mp -l 1 -n %d > --proc-type=3Dsecondary -- -p 3 --num-procs=3D%d --proc-id=3D1" > + final_cmd_first =3D example_cmd_auto % (self.mem_channels, > self.queues) > + final_cmd_secondary =3D example_cmd_secondary % > (self.mem_channels, self.queues) > + self.vhost_first.send_expect(final_cmd_first, " ", 120) > + self.vhost_secondary.send_expect(final_cmd_secondary, " ", 120) > + > + > + def prepare_symmetric_mp(self): > + > self.vm_dut.send_expect("cp ./examples/multi_process/symmetric_mp/main.c > .", "#") > + self.vm_dut.send_expect( > + "sed -i '/.offloads =3D > DEV_RX_OFFLOAD_CHECKSUM,/d' ./examples/multi_process/symmetric_mp/m > ain.c", "#") > + out =3D > self.vm_dut.build_dpdk_apps('./examples/multi_process/symmetric_mp') > + self.verify("Error" not in out, "compilation symmetric_mp > + error") > + > + > + def restore_symmetric_mp_env(self): > + > self.vm_dut.send_expect("\cp ./main.c ./examples/multi_process/symmetric_= m > p/", "#", 15) > + out =3D > self.vm_dut.build_dpdk_apps('./examples/multi_process/symmetric_mp') > + self.verify("Error" not in out, "compilation symmetric_mp > + error") > + > + def close_session(self): > + self.vm_dut.close_session(self.vhost_first) > + self.vm_dut.close_session(self.vhost_secondary) > + > + > + def test_Virtio_primary_and_secondary_process(self): > + # start testpmd > + self.launch_testpmd() > + self.setup_vm_env() > + # Modify code > + self.prepare_symmetric_mp() > + # create 2 new session > + self.vhost_first =3D self.vm_dut.new_session(suite=3D"vhost_firs= t") > + self.vhost_secondary =3D > self.vm_dut.new_session(suite=3D"vhsot_secondary") > + # start symmetric_mp > + self.launch_examples() > + time.sleep(3) > + vhost_first_out =3D self.vhost_first.send_expect("^c", "#", 15) > + print vhost_first_out > + time.sleep(3) > + vhost_secondary_out =3D self.vhost_secondary.send_expect("^c", "= #", > 15) > + print vhost_secondary_out > + result_first =3D re.findall(r'Port \d: RX - (\w+)', vhost_first_= out) > + result_secondary =3D re.findall(r'Port \d: RX - (\w+)', > vhost_secondary_out) > + self.verify(len(result_first[0]) !=3D 0 and len(result_first[1])= !=3D 0 and > len(result_secondary[0]) !=3D 0 and len(result_secondary[1]) !=3D 0, "RX = no data") > + self.dut.send_expect("quit", "#", 15) > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.restore_symmetric_mp_env() > + self.close_session() > + self.vm_dut.kill_all() > + self.dut.kill_all() > + self.vm.stop() > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + time.sleep(2) > + > + > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.17.2