test suite reviews and discussions
 help / color / mirror / Atom feed
* Re: [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync with test plan
  2021-02-02 15:23 [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync with test plan Ling Wei
@ 2021-02-02  7:51 ` Ling, WeiX
  2021-02-02 13:47   ` Wang, Yinan
  2021-02-03  6:30 ` Tu, Lijuan
  1 sibling, 1 reply; 4+ messages in thread
From: Ling, WeiX @ 2021-02-02  7:51 UTC (permalink / raw)
  To: Ling, WeiX, dts

[-- Attachment #1: Type: text/plain, Size: 11204 bytes --]

Tested-by: Wei Ling <weix.ling@intel.com>

Regards,
Ling Wei

> -----Original Message-----
> From: Ling Wei <weix.ling@intel.com>
> Sent: Tuesday, February 2, 2021 11:23 PM
> To: dts@dpdk.org
> Cc: Ling, WeiX <weix.ling@intel.com>
> Subject: [dts][PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync
> with test plan
> 
> v1:
> Add virtio smoke test suite sync with test plan.
> 
> v2:
> 1.Modiry Copyrint(c)<2019> to Copyrint(c)<2021>.
> 2.Fix CentOS check hugepagesize return ' 2048' dts issue.
> 3.Add test case run exception handing 'kill dpdk-testpmd'
>   in set_up and tear_down.
> 
> v3:
> Modify patch subject and comments description error.
> 
> v4:
> Modify set_up method,kill testpmd then remove vhost-net*.
> 
> v5:
> Fix patch spelling error.
> 
> v6:
> Fix patch spelling error.
> 
> Signed-off-by: Ling Wei <weix.ling@intel.com>
> ---
>  tests/TestSuite_virtio_smoke.py | 202
> ++++++++++++++++++++++++++++++++
>  1 file changed, 202 insertions(+)
>  create mode 100644 tests/TestSuite_virtio_smoke.py
> 
> diff --git a/tests/TestSuite_virtio_smoke.py
> b/tests/TestSuite_virtio_smoke.py new file mode 100644 index
> 00000000..3c9e96fc
> --- /dev/null
> +++ b/tests/TestSuite_virtio_smoke.py
> @@ -0,0 +1,202 @@
> +# BSD LICENSE+#+# Copyright(c) <2021> 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.+"""++import re+from test_case import TestCase+from pmd_output
> import PmdOutput+DEFAULT_MTU = 1500+TSO_MTU = 9000++class
> TestVirtioSmoke(TestCase):+++    def set_up_all(self):+        """+        Run at
> the start of each test suite.+        """+        self.dst_mac = "00:01:02:03:04:05"+
> self.dut_ports = self.dut.get_ports()+        self.txItf =
> self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))+
> self.socket = self.dut.get_numa_id(self.dut_ports[0])+        self.cores =
> self.dut.get_core_list("all", socket=self.socket)+        self.vhost_cores =
> self.cores[0:3]+        self.virtio1_cores = self.cores[3:6]+        self.base_dir =
> self.dut.base_dir.replace('~', '/root')+        self.path =
> self.dut.apps_name['test-pmd']+        self.testpmd_name =
> self.path.split("/")[-1]+        self.vhost_user =
> self.dut.new_session(suite="vhost-user")+        self.virtio_user1 =
> self.dut.new_session(suite="virtio-user1")+        self.pmdout_vhost_user =
> PmdOutput(self.dut, self.vhost_user)+        self.pmdout_virtio_user1 =
> PmdOutput(self.dut, self.virtio_user1)++    def set_up(self):+        """+
> Run before each test case.+        """+        self.dut.send_expect("killall -s
> INT %s" % self.testpmd_name, "#")+        self.dut.send_expect("rm -
> rf %s/vhost-net*" % self.base_dir, "#")++    @property+    def
> check_2M_env(self):+        out = self.dut.send_expect("cat /proc/meminfo
> |grep Hugepagesize|awk '{print($2)}'", "# ")+        # On CentOS, sometimes
> return ' 2048'+        resp = out.replace(' ', '')+        return True if resp == '2048'
> else False++    def launch_testpmd_as_vhost_user(self, param,
> cores="Default", udev="", ports=[], no_pci=True):+
> self.pmdout_vhost_user.start_testpmd(cores=cores, param=param,
> vdevs=[udev], ports=ports, prefix="vhost",+
> fixed_prefix=True, no_pci=no_pci)+
> self.pmdout_vhost_user.execute_cmd('set fwd mac')++    def
> launch_testpmd_as_virtio_user1(self, param, cores="Default", udev="",
> no_pci=True):+        eal_param = ""+        if self.check_2M_env:+
> eal_param += " --single-file-segments"+        if 'vectorized' in
> self.running_case:+            eal_param += " --force-max-simd-bitwidth=512"+
> self.pmdout_virtio_user1.start_testpmd(cores=cores, param=param,
> vdevs=[udev], ports=[], prefix="virtio1",+
> fixed_prefix=True, eal_param=eal_param, no_pci=no_pci)++    def
> verify_vhost_queue_rx_tx_pkts(self, queue_list):+        out =
> self.pmdout_vhost_user.execute_cmd('stop')+        for queue_index in
> queue_list:+            queue = "Queue= %d" % queue_index+            index =
> out.find(queue)+            rx = re.search("RX-packets:\s*(\d*)", out[index:])+
> tx = re.search("TX-packets:\s*(\d*)", out[index:])+            rx_packets =
> int(rx.group(1))+            tx_packets = int(tx.group(1))+
> self.verify(rx_packets > 0 and tx_packets > 0,+                        "The queue %d rx-
> packets or tx-packets is 0 about " % queue_index ++                        "rx-
> packets:%d, tx-packets:%d" % (rx_packets, tx_packets))++    def
> test_virtio_loopback(self):+        param = " --nb-cores={} --rxq={} --txq={}"+
> other_param = " --tx-offloads=0x0 --enable-hw-vlan-strip --rss-ip"+
> vhost_dev = f"'eth_vhost0,iface=vhost-net,client=1,queues=8'"+
> virtio_dev = f"'net_virtio_user0,mac={self.dst_mac},path=./vhost-
> net,server=1,queues=8,mrg_rxbuf=1,in_order=1'"++
> self.logger.info("Launch vhost as client mode with 2 queues")+        nb_core =
> 2+        vhost_rxq_txq = 2+        virtio_rxq_txq = 8+        vhost_param =
> param.format(nb_core, vhost_rxq_txq, vhost_rxq_txq)+        virtio_param =
> (other_param + param).format(nb_core, virtio_rxq_txq, virtio_rxq_txq)+
> self.launch_testpmd_as_vhost_user(param=vhost_param,
> cores=self.vhost_cores, udev=vhost_dev, no_pci=True)+
> self.pmdout_vhost_user.execute_cmd('start')+        self.logger.info("Launch
> virtio-user as server mode with 8 queues")+
> self.launch_testpmd_as_virtio_user1(param=virtio_param,
> cores=self.virtio1_cores, udev=virtio_dev, no_pci=True)+
> self.pmdout_virtio_user1.execute_cmd('set fwd mac')+
> self.pmdout_virtio_user1.execute_cmd('start tx_first 32')+
> self.verify_vhost_queue_rx_tx_pkts(queue_list=range(vhost_rxq_txq))+
> self.pmdout_vhost_user.execute_cmd('quit', '#')++
> self.logger.info("Relaunch vhost with 8 queues and send packets")+
> vhost_rxq_txq = 8+        vhost_param = param.format(nb_core,
> vhost_rxq_txq, vhost_rxq_txq)+
> self.launch_testpmd_as_vhost_user(param=vhost_param,
> cores=self.cores[0:3], udev=vhost_dev, no_pci=True)+
> self.pmdout_vhost_user.execute_cmd('start tx_first 32')+
> self.pmdout_vhost_user.execute_cmd('stop')+
> self.pmdout_vhost_user.execute_cmd('set burst 1')+
> self.pmdout_vhost_user.execute_cmd('start tx_first 1')+
> self.verify_vhost_queue_rx_tx_pkts(queue_list=range(vhost_rxq_txq))++
> self.pmdout_virtio_user1.execute_cmd('quit', '#')+
> self.pmdout_vhost_user.execute_cmd('quit', '#')++    def send_packets(self,
> frame_size, pkt_count):+        pkt =
> "Ether(dst='%s')/IP()/('x'*%d)" %(self.dst_mac, frame_size)+
> self.tester.scapy_append('sendp([%s], iface="%s", count=%s)' % (pkt,
> self.txItf, pkt_count))+        self.tester.scapy_execute()++    def
> verify_virtio_user_receive_packets(self, pkt_count):+        out =
> self.pmdout_virtio_user1.execute_cmd('show port stats all')+        rx =
> re.search("RX-packets:\s*(\d*)", out)+        tx = re.search("TX-
> packets:\s*(\d*)", out)+        rx_packets = int(rx.group(1))+        tx_packets =
> int(tx.group(1))+        self.verify(rx_packets >= pkt_count and tx_packets >=
> pkt_count,+                    "Virtio-user receive no enough packets, RX-packets:
> {},RX-packets: {}".format(rx_packets, tx_packets))++    def
> test_virtio_pvp(self):+        param = " --nb-cores={} --txd={} --rxd={}"+
> vhost_dev = f"'net_vhost0,iface=vhost-net,queues=1'"+        virtio_dev =
> f"'net_virtio_user0,mac={self.dst_mac},path=./vhost-
> net,packed_vq=1,mrg_rxbuf=0,in_order=1," \+
> f"vectorized=1,queue_size=1024'"+        self.logger.info("Launch vhost")+
> nb_core = 2+        vhost_rxd_txd = 1024+        vhost_param =
> param.format(nb_core, vhost_rxd_txd, vhost_rxd_txd)+        port =
> self.dut.ports_info[self.dut_ports[0]]['pci']+
> self.launch_testpmd_as_vhost_user(param=vhost_param,
> cores=self.vhost_cores, udev=vhost_dev,+                                          ports=[port],
> no_pci=False)+        self.pmdout_vhost_user.execute_cmd('start')++
> self.logger.info("Launch virtio")+        nb_core = 1+        virtio_param =
> param.format(nb_core, vhost_rxd_txd, vhost_rxd_txd)+
> self.launch_testpmd_as_virtio_user1(param=virtio_param,
> cores=self.virtio1_cores, udev=virtio_dev, no_pci=True)+
> self.pmdout_virtio_user1.execute_cmd('set fwd mac')+
> self.pmdout_virtio_user1.execute_cmd('start')++        self.logger.info("Start
> send packets and verify")+        # set tester port MTU=9000 when need to
> send big packets.+        self.tester.send_expect("ifconfig %s mtu %s" %
> (self.txItf, TSO_MTU), "# ")+        # set vhost testpmd port MTU=9000+
> self.pmdout_vhost_user.execute_cmd('stop')+
> self.pmdout_vhost_user.execute_cmd('port stop 0')+
> self.pmdout_vhost_user.execute_cmd('port config mtu 0 %s' % TSO_MTU)+
> self.pmdout_vhost_user.execute_cmd('port start 0')+
> self.pmdout_vhost_user.execute_cmd('start')+
> self.send_packets(frame_size=64, pkt_count=10)+
> self.send_packets(frame_size=1518, pkt_count=10)+
> self.verify_virtio_user_receive_packets(pkt_count=20)++
> self.pmdout_virtio_user1.execute_cmd('quit', '#')+
> self.pmdout_vhost_user.execute_cmd('quit', '#')++    def tear_down(self):+
> """+        Run after each test case.+        """+        self.dut.send_expect("killall -s
> INT %s" % self.testpmd_name, "#")++    def tear_down_all(self):+        """+
> Run after each test suite.+        """+
> self.dut.close_session(self.vhost_user)+
> self.dut.close_session(self.virtio_user1)+
> self.tester.send_expect("ifconfig %s mtu %s" % (self.txItf, DEFAULT_MTU),
> "# ")--
> 2.25.1


[-- Attachment #2: TestVirtioSmoke.log --]
[-- Type: application/octet-stream, Size: 7160 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync with test plan
  2021-02-02  7:51 ` Ling, WeiX
@ 2021-02-02 13:47   ` Wang, Yinan
  0 siblings, 0 replies; 4+ messages in thread
From: Wang, Yinan @ 2021-02-02 13:47 UTC (permalink / raw)
  To: Ling, WeiX, Ling, WeiX, dts

Acked-by: Wang, Yinan <yinan.wang@intel.com>

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Ling, WeiX
> Sent: 2021?2?2? 15:52
> To: Ling, WeiX <weix.ling@intel.com>; dts@dpdk.org
> Subject: Re: [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite
> sync with test plan
> 
> Tested-by: Wei Ling <weix.ling@intel.com>
> 
> Regards,
> Ling Wei
> 
> > -----Original Message-----
> > From: Ling Wei <weix.ling@intel.com>
> > Sent: Tuesday, February 2, 2021 11:23 PM
> > To: dts@dpdk.org
> > Cc: Ling, WeiX <weix.ling@intel.com>
> > Subject: [dts][PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync
> > with test plan
> >
> > v1:
> > Add virtio smoke test suite sync with test plan.
> >
> > v2:
> > 1.Modiry Copyrint(c)<2019> to Copyrint(c)<2021>.
> > 2.Fix CentOS check hugepagesize return ' 2048' dts issue.
> > 3.Add test case run exception handing 'kill dpdk-testpmd'
> >   in set_up and tear_down.
> >
> > v3:
> > Modify patch subject and comments description error.
> >
> > v4:
> > Modify set_up method,kill testpmd then remove vhost-net*.
> >
> > v5:
> > Fix patch spelling error.
> >
> > v6:
> > Fix patch spelling error.
> >
> > Signed-off-by: Ling Wei <weix.ling@intel.com>
> > ---
> >  tests/TestSuite_virtio_smoke.py | 202
> > ++++++++++++++++++++++++++++++++
> >  1 file changed, 202 insertions(+)
> >  create mode 100644 tests/TestSuite_virtio_smoke.py
> >
> > diff --git a/tests/TestSuite_virtio_smoke.py
> > b/tests/TestSuite_virtio_smoke.py new file mode 100644 index
> > 00000000..3c9e96fc
> > --- /dev/null
> > +++ b/tests/TestSuite_virtio_smoke.py
> > @@ -0,0 +1,202 @@
> > +# BSD LICENSE+#+# Copyright(c) <2021> 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.+"""++import re+from test_case import TestCase+from pmd_output
> > import PmdOutput+DEFAULT_MTU = 1500+TSO_MTU = 9000++class
> > TestVirtioSmoke(TestCase):+++    def set_up_all(self):+        """+        Run at
> > the start of each test suite.+        """+        self.dst_mac =
> "00:01:02:03:04:05"+
> > self.dut_ports = self.dut.get_ports()+        self.txItf =
> > self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))+
> > self.socket = self.dut.get_numa_id(self.dut_ports[0])+        self.cores =
> > self.dut.get_core_list("all", socket=self.socket)+        self.vhost_cores =
> > self.cores[0:3]+        self.virtio1_cores = self.cores[3:6]+        self.base_dir =
> > self.dut.base_dir.replace('~', '/root')+        self.path =
> > self.dut.apps_name['test-pmd']+        self.testpmd_name =
> > self.path.split("/")[-1]+        self.vhost_user =
> > self.dut.new_session(suite="vhost-user")+        self.virtio_user1 =
> > self.dut.new_session(suite="virtio-user1")+        self.pmdout_vhost_user =
> > PmdOutput(self.dut, self.vhost_user)+        self.pmdout_virtio_user1 =
> > PmdOutput(self.dut, self.virtio_user1)++    def set_up(self):+        """+
> > Run before each test case.+        """+        self.dut.send_expect("killall -s
> > INT %s" % self.testpmd_name, "#")+        self.dut.send_expect("rm -
> > rf %s/vhost-net*" % self.base_dir, "#")++    @property+    def
> > check_2M_env(self):+        out = self.dut.send_expect("cat /proc/meminfo
> > |grep Hugepagesize|awk '{print($2)}'", "# ")+        # On CentOS, sometimes
> > return ' 2048'+        resp = out.replace(' ', '')+        return True if resp ==
> '2048'
> > else False++    def launch_testpmd_as_vhost_user(self, param,
> > cores="Default", udev="", ports=[], no_pci=True):+
> > self.pmdout_vhost_user.start_testpmd(cores=cores, param=param,
> > vdevs=[udev], ports=ports, prefix="vhost",+
> > fixed_prefix=True, no_pci=no_pci)+
> > self.pmdout_vhost_user.execute_cmd('set fwd mac')++    def
> > launch_testpmd_as_virtio_user1(self, param, cores="Default", udev="",
> > no_pci=True):+        eal_param = ""+        if self.check_2M_env:+
> > eal_param += " --single-file-segments"+        if 'vectorized' in
> > self.running_case:+            eal_param += " --force-max-simd-bitwidth=512"+
> > self.pmdout_virtio_user1.start_testpmd(cores=cores, param=param,
> > vdevs=[udev], ports=[], prefix="virtio1",+
> > fixed_prefix=True, eal_param=eal_param, no_pci=no_pci)++    def
> > verify_vhost_queue_rx_tx_pkts(self, queue_list):+        out =
> > self.pmdout_vhost_user.execute_cmd('stop')+        for queue_index in
> > queue_list:+            queue = "Queue= %d" % queue_index+            index =
> > out.find(queue)+            rx = re.search("RX-packets:\s*(\d*)", out[index:])+
> > tx = re.search("TX-packets:\s*(\d*)", out[index:])+            rx_packets =
> > int(rx.group(1))+            tx_packets = int(tx.group(1))+
> > self.verify(rx_packets > 0 and tx_packets > 0,+                        "The queue %d
> rx-
> > packets or tx-packets is 0 about " % queue_index ++                        "rx-
> > packets:%d, tx-packets:%d" % (rx_packets, tx_packets))++    def
> > test_virtio_loopback(self):+        param = " --nb-cores={} --rxq={} --txq={}"+
> > other_param = " --tx-offloads=0x0 --enable-hw-vlan-strip --rss-ip"+
> > vhost_dev = f"'eth_vhost0,iface=vhost-net,client=1,queues=8'"+
> > virtio_dev = f"'net_virtio_user0,mac={self.dst_mac},path=./vhost-
> > net,server=1,queues=8,mrg_rxbuf=1,in_order=1'"++
> > self.logger.info("Launch vhost as client mode with 2 queues")+        nb_core
> =
> > 2+        vhost_rxq_txq = 2+        virtio_rxq_txq = 8+        vhost_param =
> > param.format(nb_core, vhost_rxq_txq, vhost_rxq_txq)+        virtio_param =
> > (other_param + param).format(nb_core, virtio_rxq_txq, virtio_rxq_txq)+
> > self.launch_testpmd_as_vhost_user(param=vhost_param,
> > cores=self.vhost_cores, udev=vhost_dev, no_pci=True)+
> > self.pmdout_vhost_user.execute_cmd('start')+        self.logger.info("Launch
> > virtio-user as server mode with 8 queues")+
> > self.launch_testpmd_as_virtio_user1(param=virtio_param,
> > cores=self.virtio1_cores, udev=virtio_dev, no_pci=True)+
> > self.pmdout_virtio_user1.execute_cmd('set fwd mac')+
> > self.pmdout_virtio_user1.execute_cmd('start tx_first 32')+
> > self.verify_vhost_queue_rx_tx_pkts(queue_list=range(vhost_rxq_txq))+
> > self.pmdout_vhost_user.execute_cmd('quit', '#')++
> > self.logger.info("Relaunch vhost with 8 queues and send packets")+
> > vhost_rxq_txq = 8+        vhost_param = param.format(nb_core,
> > vhost_rxq_txq, vhost_rxq_txq)+
> > self.launch_testpmd_as_vhost_user(param=vhost_param,
> > cores=self.cores[0:3], udev=vhost_dev, no_pci=True)+
> > self.pmdout_vhost_user.execute_cmd('start tx_first 32')+
> > self.pmdout_vhost_user.execute_cmd('stop')+
> > self.pmdout_vhost_user.execute_cmd('set burst 1')+
> > self.pmdout_vhost_user.execute_cmd('start tx_first 1')+
> > self.verify_vhost_queue_rx_tx_pkts(queue_list=range(vhost_rxq_txq))++
> > self.pmdout_virtio_user1.execute_cmd('quit', '#')+
> > self.pmdout_vhost_user.execute_cmd('quit', '#')++    def send_packets(self,
> > frame_size, pkt_count):+        pkt =
> > "Ether(dst='%s')/IP()/('x'*%d)" %(self.dst_mac, frame_size)+
> > self.tester.scapy_append('sendp([%s], iface="%s", count=%s)' % (pkt,
> > self.txItf, pkt_count))+        self.tester.scapy_execute()++    def
> > verify_virtio_user_receive_packets(self, pkt_count):+        out =
> > self.pmdout_virtio_user1.execute_cmd('show port stats all')+        rx =
> > re.search("RX-packets:\s*(\d*)", out)+        tx = re.search("TX-
> > packets:\s*(\d*)", out)+        rx_packets = int(rx.group(1))+        tx_packets =
> > int(tx.group(1))+        self.verify(rx_packets >= pkt_count and tx_packets >=
> > pkt_count,+                    "Virtio-user receive no enough packets, RX-packets:
> > {},RX-packets: {}".format(rx_packets, tx_packets))++    def
> > test_virtio_pvp(self):+        param = " --nb-cores={} --txd={} --rxd={}"+
> > vhost_dev = f"'net_vhost0,iface=vhost-net,queues=1'"+        virtio_dev =
> > f"'net_virtio_user0,mac={self.dst_mac},path=./vhost-
> > net,packed_vq=1,mrg_rxbuf=0,in_order=1," \+
> > f"vectorized=1,queue_size=1024'"+        self.logger.info("Launch vhost")+
> > nb_core = 2+        vhost_rxd_txd = 1024+        vhost_param =
> > param.format(nb_core, vhost_rxd_txd, vhost_rxd_txd)+        port =
> > self.dut.ports_info[self.dut_ports[0]]['pci']+
> > self.launch_testpmd_as_vhost_user(param=vhost_param,
> > cores=self.vhost_cores, udev=vhost_dev,+
> ports=[port],
> > no_pci=False)+        self.pmdout_vhost_user.execute_cmd('start')++
> > self.logger.info("Launch virtio")+        nb_core = 1+        virtio_param =
> > param.format(nb_core, vhost_rxd_txd, vhost_rxd_txd)+
> > self.launch_testpmd_as_virtio_user1(param=virtio_param,
> > cores=self.virtio1_cores, udev=virtio_dev, no_pci=True)+
> > self.pmdout_virtio_user1.execute_cmd('set fwd mac')+
> > self.pmdout_virtio_user1.execute_cmd('start')++        self.logger.info("Start
> > send packets and verify")+        # set tester port MTU=9000 when need to
> > send big packets.+        self.tester.send_expect("ifconfig %s mtu %s" %
> > (self.txItf, TSO_MTU), "# ")+        # set vhost testpmd port MTU=9000+
> > self.pmdout_vhost_user.execute_cmd('stop')+
> > self.pmdout_vhost_user.execute_cmd('port stop 0')+
> > self.pmdout_vhost_user.execute_cmd('port config mtu 0 %s' % TSO_MTU)+
> > self.pmdout_vhost_user.execute_cmd('port start 0')+
> > self.pmdout_vhost_user.execute_cmd('start')+
> > self.send_packets(frame_size=64, pkt_count=10)+
> > self.send_packets(frame_size=1518, pkt_count=10)+
> > self.verify_virtio_user_receive_packets(pkt_count=20)++
> > self.pmdout_virtio_user1.execute_cmd('quit', '#')+
> > self.pmdout_vhost_user.execute_cmd('quit', '#')++    def tear_down(self):+
> > """+        Run after each test case.+        """+        self.dut.send_expect("killall -
> s
> > INT %s" % self.testpmd_name, "#")++    def tear_down_all(self):+        """+
> > Run after each test suite.+        """+
> > self.dut.close_session(self.vhost_user)+
> > self.dut.close_session(self.virtio_user1)+
> > self.tester.send_expect("ifconfig %s mtu %s" % (self.txItf, DEFAULT_MTU),
> > "# ")--
> > 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync with test plan
@ 2021-02-02 15:23 Ling Wei
  2021-02-02  7:51 ` Ling, WeiX
  2021-02-03  6:30 ` Tu, Lijuan
  0 siblings, 2 replies; 4+ messages in thread
From: Ling Wei @ 2021-02-02 15:23 UTC (permalink / raw)
  To: dts; +Cc: Ling Wei

v1:
Add virtio smoke test suite sync with test plan.

v2:
1.Modiry Copyrint(c)<2019> to Copyrint(c)<2021>.
2.Fix CentOS check hugepagesize return ' 2048' dts issue.
3.Add test case run exception handing 'kill dpdk-testpmd'
  in set_up and tear_down.

v3:
Modify patch subject and comments description error.

v4:
Modify set_up method,kill testpmd then remove vhost-net*.

v5:
Fix patch spelling error.

v6:
Fix patch spelling error.

Signed-off-by: Ling Wei <weix.ling@intel.com>
---
 tests/TestSuite_virtio_smoke.py | 202 ++++++++++++++++++++++++++++++++
 1 file changed, 202 insertions(+)
 create mode 100644 tests/TestSuite_virtio_smoke.py

diff --git a/tests/TestSuite_virtio_smoke.py b/tests/TestSuite_virtio_smoke.py
new file mode 100644
index 00000000..3c9e96fc
--- /dev/null
+++ b/tests/TestSuite_virtio_smoke.py
@@ -0,0 +1,202 @@
+# BSD LICENSE\r
+#\r
+# Copyright(c) <2021> Intel Corporation. All rights reserved.\r
+# All rights reserved.\r
+#\r
+# Redistribution and use in source and binary forms, with or without\r
+# modification, are permitted provided that the following conditions\r
+# are met:\r
+#\r
+#   * Redistributions of source code must retain the above copyright\r
+#     notice, this list of conditions and the following disclaimer.\r
+#   * Redistributions in binary form must reproduce the above copyright\r
+#     notice, this list of conditions and the following disclaimer in\r
+#     the documentation and/or other materials provided with the\r
+#     distribution.\r
+#   * Neither the name of Intel Corporation nor the names of its\r
+#     contributors may be used to endorse or promote products derived\r
+#     from this software without specific prior written permission.\r
+#\r
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+"""\r
+DPDK Test suite.\r
+"""\r
+\r
+import re\r
+from test_case import TestCase\r
+from pmd_output import PmdOutput\r
+DEFAULT_MTU = 1500\r
+TSO_MTU = 9000\r
+\r
+class TestVirtioSmoke(TestCase):\r
+\r
+\r
+    def set_up_all(self):\r
+        """\r
+        Run at the start of each test suite.\r
+        """\r
+        self.dst_mac = "00:01:02:03:04:05"\r
+        self.dut_ports = self.dut.get_ports()\r
+        self.txItf = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))\r
+        self.socket = self.dut.get_numa_id(self.dut_ports[0])\r
+        self.cores = self.dut.get_core_list("all", socket=self.socket)\r
+        self.vhost_cores = self.cores[0:3]\r
+        self.virtio1_cores = self.cores[3:6]\r
+        self.base_dir = self.dut.base_dir.replace('~', '/root')\r
+        self.path = self.dut.apps_name['test-pmd']\r
+        self.testpmd_name = self.path.split("/")[-1]\r
+        self.vhost_user = self.dut.new_session(suite="vhost-user")\r
+        self.virtio_user1 = self.dut.new_session(suite="virtio-user1")\r
+        self.pmdout_vhost_user = PmdOutput(self.dut, self.vhost_user)\r
+        self.pmdout_virtio_user1 = PmdOutput(self.dut, self.virtio_user1)\r
+\r
+    def set_up(self):\r
+        """\r
+        Run before each test case.\r
+        """\r
+        self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#")\r
+        self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "#")\r
+\r
+    @property\r
+    def check_2M_env(self):\r
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")\r
+        # On CentOS, sometimes return ' 2048'\r
+        resp = out.replace(' ', '')\r
+        return True if resp == '2048' else False\r
+\r
+    def launch_testpmd_as_vhost_user(self, param, cores="Default", udev="", ports=[], no_pci=True):\r
+        self.pmdout_vhost_user.start_testpmd(cores=cores, param=param, vdevs=[udev], ports=ports, prefix="vhost",\r
+                                             fixed_prefix=True, no_pci=no_pci)\r
+        self.pmdout_vhost_user.execute_cmd('set fwd mac')\r
+\r
+    def launch_testpmd_as_virtio_user1(self, param, cores="Default", udev="", no_pci=True):\r
+        eal_param = ""\r
+        if self.check_2M_env:\r
+            eal_param += " --single-file-segments"\r
+        if 'vectorized' in self.running_case:\r
+            eal_param += " --force-max-simd-bitwidth=512"\r
+        self.pmdout_virtio_user1.start_testpmd(cores=cores, param=param, vdevs=[udev], ports=[], prefix="virtio1",\r
+                                               fixed_prefix=True, eal_param=eal_param, no_pci=no_pci)\r
+\r
+    def verify_vhost_queue_rx_tx_pkts(self, queue_list):\r
+        out = self.pmdout_vhost_user.execute_cmd('stop')\r
+        for queue_index in queue_list:\r
+            queue = "Queue= %d" % queue_index\r
+            index = out.find(queue)\r
+            rx = re.search("RX-packets:\s*(\d*)", out[index:])\r
+            tx = re.search("TX-packets:\s*(\d*)", out[index:])\r
+            rx_packets = int(rx.group(1))\r
+            tx_packets = int(tx.group(1))\r
+            self.verify(rx_packets > 0 and tx_packets > 0,\r
+                        "The queue %d rx-packets or tx-packets is 0 about " % queue_index +\r
+                        "rx-packets:%d, tx-packets:%d" % (rx_packets, tx_packets))\r
+\r
+    def test_virtio_loopback(self):\r
+        param = " --nb-cores={} --rxq={} --txq={}"\r
+        other_param = " --tx-offloads=0x0 --enable-hw-vlan-strip --rss-ip"\r
+        vhost_dev = f"'eth_vhost0,iface=vhost-net,client=1,queues=8'"\r
+        virtio_dev = f"'net_virtio_user0,mac={self.dst_mac},path=./vhost-net,server=1,queues=8,mrg_rxbuf=1,in_order=1'"\r
+\r
+        self.logger.info("Launch vhost as client mode with 2 queues")\r
+        nb_core = 2\r
+        vhost_rxq_txq = 2\r
+        virtio_rxq_txq = 8\r
+        vhost_param = param.format(nb_core, vhost_rxq_txq, vhost_rxq_txq)\r
+        virtio_param = (other_param + param).format(nb_core, virtio_rxq_txq, virtio_rxq_txq)\r
+        self.launch_testpmd_as_vhost_user(param=vhost_param, cores=self.vhost_cores, udev=vhost_dev, no_pci=True)\r
+        self.pmdout_vhost_user.execute_cmd('start')\r
+        self.logger.info("Launch virtio-user as server mode with 8 queues")\r
+        self.launch_testpmd_as_virtio_user1(param=virtio_param, cores=self.virtio1_cores, udev=virtio_dev, no_pci=True)\r
+        self.pmdout_virtio_user1.execute_cmd('set fwd mac')\r
+        self.pmdout_virtio_user1.execute_cmd('start tx_first 32')\r
+        self.verify_vhost_queue_rx_tx_pkts(queue_list=range(vhost_rxq_txq))\r
+        self.pmdout_vhost_user.execute_cmd('quit', '#')\r
+\r
+        self.logger.info("Relaunch vhost with 8 queues and send packets")\r
+        vhost_rxq_txq = 8\r
+        vhost_param = param.format(nb_core, vhost_rxq_txq, vhost_rxq_txq)\r
+        self.launch_testpmd_as_vhost_user(param=vhost_param, cores=self.cores[0:3], udev=vhost_dev, no_pci=True)\r
+        self.pmdout_vhost_user.execute_cmd('start tx_first 32')\r
+        self.pmdout_vhost_user.execute_cmd('stop')\r
+        self.pmdout_vhost_user.execute_cmd('set burst 1')\r
+        self.pmdout_vhost_user.execute_cmd('start tx_first 1')\r
+        self.verify_vhost_queue_rx_tx_pkts(queue_list=range(vhost_rxq_txq))\r
+\r
+        self.pmdout_virtio_user1.execute_cmd('quit', '#')\r
+        self.pmdout_vhost_user.execute_cmd('quit', '#')\r
+\r
+    def send_packets(self, frame_size, pkt_count):\r
+        pkt = "Ether(dst='%s')/IP()/('x'*%d)" %(self.dst_mac, frame_size)\r
+        self.tester.scapy_append('sendp([%s], iface="%s", count=%s)' % (pkt, self.txItf, pkt_count))\r
+        self.tester.scapy_execute()\r
+\r
+    def verify_virtio_user_receive_packets(self, pkt_count):\r
+        out = self.pmdout_virtio_user1.execute_cmd('show port stats all')\r
+        rx = re.search("RX-packets:\s*(\d*)", out)\r
+        tx = re.search("TX-packets:\s*(\d*)", out)\r
+        rx_packets = int(rx.group(1))\r
+        tx_packets = int(tx.group(1))\r
+        self.verify(rx_packets >= pkt_count and tx_packets >= pkt_count,\r
+                    "Virtio-user receive no enough packets, RX-packets: {},RX-packets: {}".format(rx_packets, tx_packets))\r
+\r
+    def test_virtio_pvp(self):\r
+        param = " --nb-cores={} --txd={} --rxd={}"\r
+        vhost_dev = f"'net_vhost0,iface=vhost-net,queues=1'"\r
+        virtio_dev = f"'net_virtio_user0,mac={self.dst_mac},path=./vhost-net,packed_vq=1,mrg_rxbuf=0,in_order=1," \\r
+            f"vectorized=1,queue_size=1024'"\r
+        self.logger.info("Launch vhost")\r
+        nb_core = 2\r
+        vhost_rxd_txd = 1024\r
+        vhost_param = param.format(nb_core, vhost_rxd_txd, vhost_rxd_txd)\r
+        port = self.dut.ports_info[self.dut_ports[0]]['pci']\r
+        self.launch_testpmd_as_vhost_user(param=vhost_param, cores=self.vhost_cores, udev=vhost_dev,\r
+                                          ports=[port], no_pci=False)\r
+        self.pmdout_vhost_user.execute_cmd('start')\r
+\r
+        self.logger.info("Launch virtio")\r
+        nb_core = 1\r
+        virtio_param = param.format(nb_core, vhost_rxd_txd, vhost_rxd_txd)\r
+        self.launch_testpmd_as_virtio_user1(param=virtio_param, cores=self.virtio1_cores, udev=virtio_dev, no_pci=True)\r
+        self.pmdout_virtio_user1.execute_cmd('set fwd mac')\r
+        self.pmdout_virtio_user1.execute_cmd('start')\r
+\r
+        self.logger.info("Start send packets and verify")\r
+        # set tester port MTU=9000 when need to send big packets.\r
+        self.tester.send_expect("ifconfig %s mtu %s" % (self.txItf, TSO_MTU), "# ")\r
+        # set vhost testpmd port MTU=9000\r
+        self.pmdout_vhost_user.execute_cmd('stop')\r
+        self.pmdout_vhost_user.execute_cmd('port stop 0')\r
+        self.pmdout_vhost_user.execute_cmd('port config mtu 0 %s' % TSO_MTU)\r
+        self.pmdout_vhost_user.execute_cmd('port start 0')\r
+        self.pmdout_vhost_user.execute_cmd('start')\r
+        self.send_packets(frame_size=64, pkt_count=10)\r
+        self.send_packets(frame_size=1518, pkt_count=10)\r
+        self.verify_virtio_user_receive_packets(pkt_count=20)\r
+\r
+        self.pmdout_virtio_user1.execute_cmd('quit', '#')\r
+        self.pmdout_vhost_user.execute_cmd('quit', '#')\r
+\r
+    def tear_down(self):\r
+        """\r
+        Run after each test case.\r
+        """\r
+        self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#")\r
+\r
+    def tear_down_all(self):\r
+        """\r
+        Run after each test suite.\r
+        """\r
+        self.dut.close_session(self.vhost_user)\r
+        self.dut.close_session(self.virtio_user1)\r
+        self.tester.send_expect("ifconfig %s mtu %s" % (self.txItf, DEFAULT_MTU), "# ")\r
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync with test plan
  2021-02-02 15:23 [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync with test plan Ling Wei
  2021-02-02  7:51 ` Ling, WeiX
@ 2021-02-03  6:30 ` Tu, Lijuan
  1 sibling, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2021-02-03  6:30 UTC (permalink / raw)
  To: Ling, WeiX, dts; +Cc: Ling, WeiX

> v1:
> Add virtio smoke test suite sync with test plan.
> 
> v2:
> 1.Modiry Copyrint(c)<2019> to Copyrint(c)<2021>.
> 2.Fix CentOS check hugepagesize return ' 2048' dts issue.
> 3.Add test case run exception handing 'kill dpdk-testpmd'
>   in set_up and tear_down.
> 
> v3:
> Modify patch subject and comments description error.
> 
> v4:
> Modify set_up method,kill testpmd then remove vhost-net*.
> 
> v5:
> Fix patch spelling error.
> 
> v6:
> Fix patch spelling error.
> 
> Signed-off-by: Ling Wei <weix.ling@intel.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-03  6:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 15:23 [dts] [PATCH V6] tests/virtio_smoke:add virtio smoke test suite sync with test plan Ling Wei
2021-02-02  7:51 ` Ling, WeiX
2021-02-02 13:47   ` Wang, Yinan
2021-02-03  6:30 ` Tu, Lijuan

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git