test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] tests: delete useless testsuite of virtio
@ 2019-06-17 19:37 Yinan
  2019-06-26  7:21 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Yinan @ 2019-06-17 19:37 UTC (permalink / raw)
  To: dts; +Cc: Wang Yinan

From: Wang Yinan <yinan.wang@intel.com>

Signed-off-by: Wang Yinan <yinan.wang@intel.com>
---
 ..._vhost_loopback_performance_virtio_user.py | 272 ----------------
 tests/TestSuite_vhost_qemu_pvp_performance.py | 307 ------------------
 2 files changed, 579 deletions(-)
 delete mode 100644 tests/TestSuite_vhost_loopback_performance_virtio_user.py
 delete mode 100644 tests/TestSuite_vhost_qemu_pvp_performance.py

diff --git a/tests/TestSuite_vhost_loopback_performance_virtio_user.py b/tests/TestSuite_vhost_loopback_performance_virtio_user.py
deleted file mode 100644
index 016f06a..0000000
--- a/tests/TestSuite_vhost_loopback_performance_virtio_user.py
+++ /dev/null
@@ -1,272 +0,0 @@
-#
-# 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 Vhost loopback performance for Mergeable, normal , vector Path
-"""
-import os
-import string
-import utils
-import time
-import re
-from test_case import TestCase
-
-
-class TestVhostLoopback(TestCase):
-
-    def set_up_all(self):
-        """
-        Run at the start of each test suite.
-        """
-        # Clean the execution environment
-        self.dut.send_expect("rm -rf ./vhost.out", "#")
-        self.dut.send_expect("rm -rf ./vhost-net*", "#")
-        self.header_row = ["FrameSize(B)", "Mode", "Throughput(Mpps)", "Virtio Version"]
-        self.frame_sizes = [64, 128, 260, 520, 1024, 1500]
-        self.test_cycles = {'Mpps': {}, 'pct': {}}
-        # Don't use any NIC in this test case
-        port_list = self.dut.get_ports()
-        for i in port_list:
-            port = self.dut.ports_info[i]['port']
-            port.bind_driver()
-        # Get the default TX packet size of the testpmd
-        out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
-        try:
-            search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", out)
-            self.packet_length = search_result.group(1)
-        except:
-            self.logger.error("Failed to capture default testpmd txonly packet length")
-
-    def set_up(self):
-        """
-        Run before each test case.
-        """
-        pass
-
-    def test_perf_vhost_mergeable_loopback(self):
-        """
-        Benchmark performance for frame_sizes.
-        """
-        self.result_table_create(self.header_row)
-        # Modify the driver file to disable the Mergeable, then re-compile the DPDK and back up the original driver file
-        for frame_size in self.frame_sizes:
-            # Back up the original driver file
-            self.dut.send_expect("cp ./drivers/net/virtio/virtio_ethdev.h ./", "#", 30)
-            # Change the packet size sent by the testpmd
-            self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN.*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
-            self.dut.send_expect(self.change_testpmd_size, "#", 30)
-            self.dut.build_install_dpdk(self.dut.target)
-
-            # Start the vhost user side
-            cmd = self.target + "/app/testpmd -n 4 -c 0x03 " + \
-                  "-m 2048 --file-prefix=vhost --vdev 'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i"
-            self.dut.send_expect(cmd, "testpmd>", 120)
-            # Start the virtio_user side
-            vhost_user = self.dut.new_session()
-            command_line_user = self.target + "/app/testpmd -n 4 -c 0x0c " + \
-                                " -m 2048 --no-pci --file-prefix=virtio " + \
-                                " --vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net" + \
-                                " -- -i --tx-offloads=0 --disable-hw-vlan-filter"
-
-            vhost_user.send_expect(command_line_user, "testpmd>", 120)
-
-            self.dut.send_expect("set fwd mac retry", "testpmd>", 60)
-            self.dut.send_expect("start tx_first 32", "testpmd>", 60)
-            vhost_user.send_expect("start tx_first 32", "testpmd> ", 120)
-            results = 0.0
-            out = self.dut.send_expect("show port stats all", "testpmd>", 60)
-            time.sleep(5)
-            # Get throughput 10 times and calculate the average throughput
-            for i in range(10):
-                out = self.dut.send_expect("show port stats all", "testpmd>", 60)
-                time.sleep(5)
-                lines = re.search("Rx-pps:\s*(\d*)", out)
-                result = lines.group(1)
-                results += float(result)
-            Mpps = results / (1000000 * 10)
-
-            self.dut.send_expect("quit", "#", 60)
-            vhost_user.send_expect("quit", "#", 60)
-            # Restore the driver file
-            self.dut.send_expect("rm -rf ./drivers/net/virtio/virtio_ethdev.h", "#", 30)
-            self.dut.send_expect("mv ./virtio_ethdev.h ./drivers/net/virtio/", "#", 30)
-            self.test_cycles['Mpps'][frame_size] = Mpps
-            self.test_cycles['pct'][frame_size] = "Virtio 0.95"
-
-        for frame_size in self.frame_sizes:
-            results_row = [frame_size]
-            results_row.append("Mergeable on")
-            results_row.append(self.test_cycles['Mpps'][frame_size])
-            results_row.append(self.test_cycles['pct'][frame_size])
-            self.result_table_add(results_row)
-
-        self.result_table_print()
-        # Change the packet size of testpmd to default number 64
-
-    def test_perf_vhost_vector_loopback(self):
-        """
-        Benchmark performance for frame_sizes.
-        """
-        self.result_table_create(self.header_row)
-        for frame_size in self.frame_sizes:
-            # Modify the driver file to disable the Mergeable, then re-compile the DPDK and back up the original driver file
-            self.dut.send_expect("cp ./drivers/net/virtio/virtio_ethdev.h ./", "#", 30)
-            self.dut.send_expect("sed -i '/VIRTIO_NET_F_MRG_RXBUF/d' ./drivers/net/virtio/virtio_ethdev.h", "#", 30)
-            self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
-            self.dut.send_expect(self.change_testpmd_size, "#", 30)
-            self.dut.build_install_dpdk(self.dut.target)
-
-            # Start the vhost user side
-            cmd = self.target + "/app/testpmd -n 4 -c 0x03 " + \
-                  "-m 2048 --file-prefix=vhost --vdev 'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i"
-            self.dut.send_expect(cmd, "testpmd>", 120)
-            # Start the virtio_user side
-            vhost_user = self.dut.new_session()
-            command_line_user = self.target + "/app/testpmd -n 4 -c 0x0c " + \
-                                " -m 2048 --no-pci --file-prefix=virtio " + \
-                                " --vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net " + \
-                                " -- -i --tx-offloads=0 --disable-hw-vlan-filter"
-
-            vhost_user.send_expect(command_line_user, "testpmd>", 120)
-
-            self.dut.send_expect("set fwd mac retry", "testpmd>", 60)
-            self.dut.send_expect("start tx_first 32", "testpmd>", 60)
-            vhost_user.send_expect("start tx_first 32", "testpmd> ", 120)
-            results = 0.0
-            out = self.dut.send_expect("show port stats all", "testpmd>", 60)
-            time.sleep(5)
-            # Get throughput 10 times and calculate the average throughput
-            for i in range(10):
-                out = self.dut.send_expect("show port stats all", "testpmd>", 60)
-                time.sleep(5)
-                lines = re.search("Rx-pps:\s*(\d*)", out)
-                result = lines.group(1)
-                results += float(result)
-            Mpps = results / (1000000 * 10)
-
-            self.dut.send_expect("quit", "#", 60)
-            vhost_user.send_expect("quit", "#", 60)
-            # Restore the driver file
-            self.dut.send_expect("rm -rf ./drivers/net/virtio/virtio_ethdev.h", "#", 30)
-            self.dut.send_expect("mv ./virtio_ethdev.h ./drivers/net/virtio/", "#", 30)
-            self.test_cycles['Mpps'][frame_size] = Mpps
-            self.test_cycles['pct'][frame_size] = "Virtio 0.95"
-
-        for frame_size in self.frame_sizes:
-            results_row = [frame_size]
-            results_row.append("Vector on")
-            results_row.append(self.test_cycles['Mpps'][frame_size])
-            results_row.append(self.test_cycles['pct'][frame_size])
-            self.result_table_add(results_row)
-
-        self.result_table_print()
-
-    def test_perf_vhost_normal_loopback(self):
-        """
-        Benchmark performance for frame_sizes.
-        """
-
-        self.result_table_create(self.header_row)
-        for frame_size in self.frame_sizes:
-            # Modify the driver file to disable the Mergeable, then re-compile the DPDK and back up the original driver file
-            self.dut.send_expect("cp ./drivers/net/virtio/virtio_ethdev.h ./", "#", 30)
-            self.dut.send_expect("sed -i '/VIRTIO_NET_F_MRG_RXBUF/d' ./drivers/net/virtio/virtio_ethdev.h", "#", 30)
-            self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
-            self.dut.send_expect(self.change_testpmd_size, "#", 30)
-            self.dut.build_install_dpdk(self.dut.target)
-
-            # Start the vhost user side
-            cmd = self.target + "/app/testpmd -n 4 -c 0x03 " + \
-                  "-m 2048 --file-prefix=vhost --vdev 'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i"
-            self.dut.send_expect(cmd, "testpmd>", 120)
-            # Start the virtio_user side
-            vhost_user = self.dut.new_session()
-            command_line_user = self.target + "/app/testpmd -n 4 -c 0x0c " + \
-                                " -m 2048 --no-pci --file-prefix=virtio " + \
-                                " --vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net" + \
-                                " -- -i --tx-offloads=0x8000 --disable-hw-vlan-filter"
-
-            vhost_user.send_expect(command_line_user, "testpmd>", 120)
-
-            self.dut.send_expect("set fwd mac retry", "testpmd>", 60)
-            self.dut.send_expect("start tx_first 32", "testpmd>", 60)
-            vhost_user.send_expect("start tx_first 32", "testpmd> ", 120)
-            results = 0.0
-            out = self.dut.send_expect("show port stats all", "testpmd>", 60)
-            time.sleep(5)
-            # Get throughput 10 times and calculate the average throughput
-            for i in range(10):
-                out = self.dut.send_expect("show port stats all", "testpmd>", 60)
-                time.sleep(5)
-                lines = re.search("Rx-pps:\s*(\d*)", out)
-                result = lines.group(1)
-                results += float(result)
-            Mpps = results / (1000000 * 10)
-
-            self.dut.send_expect("quit", "#", 60)
-            vhost_user.send_expect("quit", "#", 60)
-            # Restore the driver file
-            self.dut.send_expect("rm -rf ./drivers/net/virtio/virtio_ethdev.h", "#", 30)
-            self.dut.send_expect("mv ./virtio_ethdev.h ./drivers/net/virtio/", "#", 30)
-            self.test_cycles['Mpps'][frame_size] = Mpps
-            self.test_cycles['pct'][frame_size] = "Virtio 0.95"
-
-        for frame_size in self.frame_sizes:
-            results_row = [frame_size]
-            results_row.append("Normal")
-            results_row.append(self.test_cycles['Mpps'][frame_size])
-            results_row.append(self.test_cycles['pct'][frame_size])
-            self.result_table_add(results_row)
-
-        self.result_table_print()
-
-    def tear_down(self):
-        """
-        Run after each test case.
-        """
-        time.sleep(2)
-
-    def tear_down_all(self):
-        """
-        Run after each test suite.
-        """
-        # Recompile the dpdk because we change the source code during the test
-        self.dut.build_install_dpdk(self.dut.target)
-        # Re-bind the port to config driver
-        port_list = self.dut.get_ports()
-        for i in port_list:
-            port = self.dut.ports_info[i]['port']
-            port.bind_driver(self.drivername)
-        # Set the tx packet size of testpmd to default size
-        self.dut.send_expect("sed -i -e 's/#define TXONLY_DEF_PACKET_LEN.*$/#define TXONLY_DEF_PACKET_LEN %s/' ./app/test-pmd/testpmd.h" % self.packet_length, "#", 30)
diff --git a/tests/TestSuite_vhost_qemu_pvp_performance.py b/tests/TestSuite_vhost_qemu_pvp_performance.py
deleted file mode 100644
index 051c9a2..0000000
--- a/tests/TestSuite_vhost_qemu_pvp_performance.py
+++ /dev/null
@@ -1,307 +0,0 @@
-# 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.
-
-Vhost PVP performance using Qemu test suite.
-"""
-import os
-import re
-import time
-import utils
-from scapy.utils import wrpcap, rdpcap
-from test_case import TestCase
-from exception import VerifyFailure
-from settings import HEADER_SIZE
-from etgen import IxiaPacketGenerator
-from qemu_kvm import QEMUKvm
-
-
-class TestVhostUserOneCopyOneVm(TestCase):
-
-    def set_up_all(self):
-        # Get and verify the ports
-        self.dut_ports = self.dut.get_ports()
-        self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
-
-        # Get the port's socket
-        self.pf = self.dut_ports[0]
-        netdev = self.dut.ports_info[self.pf]['port']
-        self.socket = netdev.get_nic_socket()
-        self.cores = self.dut.get_core_list("1S/3C/1T", socket=self.socket)
-
-        # Set the params of vhost sample
-        self.vhost_app = "./examples/vhost/build/vhost-switch"
-        self.vm2vm = 0
-        # This parameter is used to define mergeable on/off
-        self.jumbo = 0
-
-        # Using file to save the vhost sample output since in jumboframe case,
-        # there will be lots of output
-        self.vhost_test = self.vhost_app + \
-            " -c %s -n %d --socket-mem 2048,2048  -- -p 0x1 --mergeable %d" + \
-            " --vm2vm %d --socket-file ./vhost-net  > ./vhost.out &"
-        # build the vhost sample in vhost-user mode.
-        if self.nic in ['niantic']:
-            self.dut.send_expect(
-                "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 128/' "
-                "./examples/vhost/main.c",
-                "#", 10)
-        elif self.nic.startswith('fortville'):
-            self.dut.send_expect(
-                "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 512/' "
-                "./examples/vhost/main.c",
-                "#", 10)
-        out = self.dut.send_expect("make -C examples/vhost", "#")
-        self.verify("Error" not in out, "compilation error")
-        self.verify("No such file" not in out, "Not found file error")
-
-        self.virtio1 = "eth1"
-        self.virtio1_mac = "52:54:00:00:00:01"
-        self.src1 = "192.168.4.1"
-        self.dst1 = "192.168.3.1"
-        self.vm_dut = None
-
-        self.number_of_ports = 1
-        self.header_row = ["FrameSize(B)", "Throughput(Mpps)", "LineRate(%)", "Cycle"]
-        self.memory_channel = 4
-
-    def set_up(self):
-        #
-        # Run before each test case.
-        #
-        # Launch vhost sample using default params
-        #
-        self.dut.send_expect("rm -rf ./vhost.out", "#")
-        self.dut.send_expect("rm -rf ./vhost-net*", "#")
-        self.dut.send_expect("killall -s INT vhost-switch", "#")
-
-        self.frame_sizes = [64, 128, 256, 512, 1024, 1500]
-        self.vm_testpmd_vector = self.target + "/app/testpmd -c 0x3 -n 3" \
-                                 + " -- -i --tx-offloads=0 --disable-hw-vlan-filter"
-        self.vm_testpmd_normal = self.target + "/app/testpmd -c 0x3 -n 3" \
-                                 + " -- -i --tx-offloads=0x8000 --disable-hw-vlan-filter"
-
-    def launch_vhost_sample(self):
-        #
-        # Launch the vhost sample with different parameters
-        #
-        self.coremask = utils.create_mask(self.cores)
-        self.vhostapp_testcmd = self.vhost_test % (
-            self.coremask, self.memory_channel, self.jumbo, self.vm2vm)
-        self.dut.send_expect(self.vhostapp_testcmd, "# ", 40)
-        time.sleep(30)
-        try:
-            self.logger.info("Launch vhost sample:")
-            self.dut.session.copy_file_from(self.dut.base_dir + "vhost.out")
-            fp = open('./vhost.out', 'r')
-            out = fp.read()
-            fp.close()
-            if "Error" in out:
-                raise Exception("Launch vhost sample failed")
-            else:
-                self.logger.info("Launch vhost sample finished")
-        except Exception as e:
-            self.logger.error("ERROR: Failed to launch vhost sample: %s" % str(e))
-
-    def start_onevm(self, path="", modem=0):
-        #
-        # Start One VM with one virtio device
-        #
-
-        self.vm = QEMUKvm(self.dut, 'vm0', 'vhost_sample')
-        if(path != ""):
-            self.vm.set_qemu_emulator(path)
-        vm_params = {}
-        vm_params['driver'] = 'vhost-user'
-        vm_params['opt_path'] = './vhost-net'
-        vm_params['opt_mac'] = self.virtio1_mac
-        if(modem == 1):
-            vm_params['opt_settings'] = 'disable-modern=false'
-        self.vm.set_vm_device(**vm_params)
-
-        try:
-            self.vm_dut = 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 vm_testpmd_start(self):
-        #
-        # Start testpmd in vm
-        #
-        if self.vm_dut is not None:
-            self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
-            self.vm_dut.send_expect("set fwd mac", "testpmd>", 20)
-            self.vm_dut.send_expect("start tx_first", "testpmd>")
-
-    def send_verify(self, case, frame_sizes, vlan_id1=0, tag="Performance"):
-        self.result_table_create(self.header_row)
-        for frame_size in frame_sizes:
-            info = "Running test %s, and %d frame size." % (case, frame_size)
-            self.logger.info(info)
-            payload = frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
-            flow1 = '[Ether(dst="%s")/Dot1Q(vlan=%s)/IP(src="%s",dst="%s")/("X"*%d)]' % (
-                self.virtio1_mac, vlan_id1, self.src1, self.dst1, payload)
-            self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1)
-            self.tester.scapy_execute()
-
-            tgenInput = []
-            port = self.tester.get_local_port(self.pf)
-            tgenInput.append((port, port, "flow1.pcap"))
-
-            _, pps = self.tester.traffic_generator_throughput(tgenInput, delay=30)
-            Mpps = pps / 1000000.0
-            pct = Mpps * 100 / float(self.wirespeed(self.nic, frame_size,
-                                     self.number_of_ports))
-            data_row = [frame_size, str(Mpps), str(pct), tag]
-            self.result_table_add(data_row)
-        self.result_table_print()
-
-    def test_perf_pvp_qemu_vector_pmd(self):
-        #
-        # Test the pvp performance for vector path
-        #
-        # start testpmd on VM
-        self.jumbo = 0
-        self.launch_vhost_sample()
-        self.start_onevm()
-
-        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
-        self.vm_dut.send_expect("start tx_first", "testpmd>")
-        time.sleep(5)
-        vlan_id1 = 1000
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "Virtio 0.95 Vector Performance")
-        self.vm_dut.kill_all()
-
-    def test_perf_pvp_qemu_normal_pmd(self):
-        #
-        # Test the performance for normal path
-        #
-        # start testpmd on VM
-        self.jumbo = 0
-        self.launch_vhost_sample()
-        self.start_onevm()
-        # Start testpmd with user
-        self.vm_dut.send_expect(self.vm_testpmd_normal, "testpmd>", 20)
-        self.vm_dut.send_expect("start tx_first", "testpmd>")
-
-        time.sleep(5)
-        vlan_id1 = 1000
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "Virtio 0.95 Normal Performance")
-        self.vm_dut.kill_all()
-
-    def test_perf_pvp_qemu_mergeable_pmd(self):
-        #
-        # Test the performance for mergeable path
-        #
-        # start testpmd on VM
-        self.jumbo = 1
-        self.launch_vhost_sample()
-        self.start_onevm()
-        # Start testpmd with user
-        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
-        self.vm_dut.send_expect("start tx_first", "testpmd>")
-
-        time.sleep(5)
-        vlan_id1 = 1000
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "Virtio 0.95 Mergeable Performance")
-        self.vm_dut.kill_all()
-
-    def test_perf_virtio_modern_qemu_vector_pmd(self):
-        #
-        # Test the vhost/virtio pvp performance for virtio1.0
-        #
-        #
-        # start testpmd on VM
-        self.jumbo = 0
-        self.launch_vhost_sample()
-        self.start_onevm("", 1)
-        # Start testpmd with user
-        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
-        self.vm_dut.send_expect("start tx_first", "testpmd>")
-
-        time.sleep(5)
-        vlan_id1 = 1000
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "virtio1.0, Vector")
-        self.vm_dut.kill_all()
-
-    def test_perf_virtio_modern_qemu_normal_pmd(self):
-        #
-        # Test the performance of one vm with 2virtio devices in legacy fwd
-        #
-        # start testpmd on VM
-        self.jumbo = 0
-        self.launch_vhost_sample()
-        self.start_onevm("", 1)
-        # Start testpmd with user
-        self.vm_dut.send_expect(self.vm_testpmd_normal, "testpmd>", 20)
-        self.vm_dut.send_expect("start tx_first", "testpmd>")
-
-        time.sleep(5)
-        vlan_id1 = 1000
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "virtio1.0, Normal")
-        self.vm_dut.kill_all()
-
-    def test_perf_virtio_modern_qemu_mergeable_pmd(self):
-        #
-        # Test the performance of one vm with 2virtio devices in legacy fwd
-        #
-        # start testpmd on VM
-        self.jumbo = 1
-        self.launch_vhost_sample()
-        self.start_onevm("", 1)
-        # Start testpmd with user
-        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
-        self.vm_dut.send_expect("start tx_first", "testpmd>")
-
-        time.sleep(5)
-        vlan_id1 = 1000
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "virtio1.0, Mergeable")
-        self.vm_dut.kill_all()
-
-    def tear_down(self):
-        #
-        # Run after each test case.
-        # Clear vhost-switch and qemu to avoid blocking the following TCs
-        #
-        self.vm.stop()
-        time.sleep(2)
-
-    def tear_down_all(self):
-        """
-        Run after each test suite.
-        """
-        pass
-- 
2.17.1


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

* Re: [dts] [PATCH] tests: delete useless testsuite of virtio
  2019-06-17 19:37 [dts] [PATCH] tests: delete useless testsuite of virtio Yinan
@ 2019-06-26  7:21 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2019-06-26  7:21 UTC (permalink / raw)
  To: Wang, Yinan, dts; +Cc: Wang, Yinan

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yinan
> Sent: Tuesday, June 18, 2019 3:37 AM
> To: dts@dpdk.org
> Cc: Wang, Yinan <yinan.wang@intel.com>
> Subject: [dts] [PATCH] tests: delete useless testsuite of virtio
> 
> From: Wang Yinan <yinan.wang@intel.com>
> 
> Signed-off-by: Wang Yinan <yinan.wang@intel.com>
> ---
>  ..._vhost_loopback_performance_virtio_user.py | 272 ----------------
> tests/TestSuite_vhost_qemu_pvp_performance.py | 307 ------------------
>  2 files changed, 579 deletions(-)
>  delete mode 100644
> tests/TestSuite_vhost_loopback_performance_virtio_user.py
>  delete mode 100644 tests/TestSuite_vhost_qemu_pvp_performance.py
> 
> diff --git a/tests/TestSuite_vhost_loopback_performance_virtio_user.py
> b/tests/TestSuite_vhost_loopback_performance_virtio_user.py
> deleted file mode 100644
> index 016f06a..0000000
> --- a/tests/TestSuite_vhost_loopback_performance_virtio_user.py
> +++ /dev/null
> @@ -1,272 +0,0 @@
> -#
> -# 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 Vhost loopback performance for Mergeable, normal , vector Path -"""
> -import os
> -import string
> -import utils
> -import time
> -import re
> -from test_case import TestCase
> -
> -
> -class TestVhostLoopback(TestCase):
> -
> -    def set_up_all(self):
> -        """
> -        Run at the start of each test suite.
> -        """
> -        # Clean the execution environment
> -        self.dut.send_expect("rm -rf ./vhost.out", "#")
> -        self.dut.send_expect("rm -rf ./vhost-net*", "#")
> -        self.header_row = ["FrameSize(B)", "Mode", "Throughput(Mpps)",
> "Virtio Version"]
> -        self.frame_sizes = [64, 128, 260, 520, 1024, 1500]
> -        self.test_cycles = {'Mpps': {}, 'pct': {}}
> -        # Don't use any NIC in this test case
> -        port_list = self.dut.get_ports()
> -        for i in port_list:
> -            port = self.dut.ports_info[i]['port']
> -            port.bind_driver()
> -        # Get the default TX packet size of the testpmd
> -        out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep
> TXONLY_DEF_PACKET_LEN", "# ")
> -        try:
> -            search_result = re.search("#define
> TXONLY_DEF_PACKET_LEN\s*(\d*)", out)
> -            self.packet_length = search_result.group(1)
> -        except:
> -            self.logger.error("Failed to capture default testpmd txonly packet
> length")
> -
> -    def set_up(self):
> -        """
> -        Run before each test case.
> -        """
> -        pass
> -
> -    def test_perf_vhost_mergeable_loopback(self):
> -        """
> -        Benchmark performance for frame_sizes.
> -        """
> -        self.result_table_create(self.header_row)
> -        # Modify the driver file to disable the Mergeable, then re-compile the
> DPDK and back up the original driver file
> -        for frame_size in self.frame_sizes:
> -            # Back up the original driver file
> -            self.dut.send_expect("cp ./drivers/net/virtio/virtio_ethdev.h ./", "#",
> 30)
> -            # Change the packet size sent by the testpmd
> -            self.change_testpmd_size = "sed -i -e 's/#define
> TXONLY_DEF_PACKET_LEN.*$/#define
> TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
> -            self.dut.send_expect(self.change_testpmd_size, "#", 30)
> -            self.dut.build_install_dpdk(self.dut.target)
> -
> -            # Start the vhost user side
> -            cmd = self.target + "/app/testpmd -n 4 -c 0x03 " + \
> -                  "-m 2048 --file-prefix=vhost --vdev 'net_vhost0,iface=vhost-
> net,queues=1,client=0' -- -i"
> -            self.dut.send_expect(cmd, "testpmd>", 120)
> -            # Start the virtio_user side
> -            vhost_user = self.dut.new_session()
> -            command_line_user = self.target + "/app/testpmd -n 4 -c 0x0c " + \
> -                                " -m 2048 --no-pci --file-prefix=virtio " + \
> -                                " --
> vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net" + \
> -                                " -- -i --tx-offloads=0 --disable-hw-vlan-filter"
> -
> -            vhost_user.send_expect(command_line_user, "testpmd>", 120)
> -
> -            self.dut.send_expect("set fwd mac retry", "testpmd>", 60)
> -            self.dut.send_expect("start tx_first 32", "testpmd>", 60)
> -            vhost_user.send_expect("start tx_first 32", "testpmd> ", 120)
> -            results = 0.0
> -            out = self.dut.send_expect("show port stats all", "testpmd>", 60)
> -            time.sleep(5)
> -            # Get throughput 10 times and calculate the average throughput
> -            for i in range(10):
> -                out = self.dut.send_expect("show port stats all", "testpmd>", 60)
> -                time.sleep(5)
> -                lines = re.search("Rx-pps:\s*(\d*)", out)
> -                result = lines.group(1)
> -                results += float(result)
> -            Mpps = results / (1000000 * 10)
> -
> -            self.dut.send_expect("quit", "#", 60)
> -            vhost_user.send_expect("quit", "#", 60)
> -            # Restore the driver file
> -            self.dut.send_expect("rm -rf ./drivers/net/virtio/virtio_ethdev.h", "#",
> 30)
> -            self.dut.send_expect("mv ./virtio_ethdev.h ./drivers/net/virtio/", "#",
> 30)
> -            self.test_cycles['Mpps'][frame_size] = Mpps
> -            self.test_cycles['pct'][frame_size] = "Virtio 0.95"
> -
> -        for frame_size in self.frame_sizes:
> -            results_row = [frame_size]
> -            results_row.append("Mergeable on")
> -            results_row.append(self.test_cycles['Mpps'][frame_size])
> -            results_row.append(self.test_cycles['pct'][frame_size])
> -            self.result_table_add(results_row)
> -
> -        self.result_table_print()
> -        # Change the packet size of testpmd to default number 64
> -
> -    def test_perf_vhost_vector_loopback(self):
> -        """
> -        Benchmark performance for frame_sizes.
> -        """
> -        self.result_table_create(self.header_row)
> -        for frame_size in self.frame_sizes:
> -            # Modify the driver file to disable the Mergeable, then re-compile
> the DPDK and back up the original driver file
> -            self.dut.send_expect("cp ./drivers/net/virtio/virtio_ethdev.h ./", "#",
> 30)
> -            self.dut.send_expect("sed -i
> '/VIRTIO_NET_F_MRG_RXBUF/d' ./drivers/net/virtio/virtio_ethdev.h", "#", 30)
> -            self.change_testpmd_size = "sed -i -e 's/#define
> TXONLY_DEF_PACKET_LEN .*$/#define
> TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
> -            self.dut.send_expect(self.change_testpmd_size, "#", 30)
> -            self.dut.build_install_dpdk(self.dut.target)
> -
> -            # Start the vhost user side
> -            cmd = self.target + "/app/testpmd -n 4 -c 0x03 " + \
> -                  "-m 2048 --file-prefix=vhost --vdev 'net_vhost0,iface=vhost-
> net,queues=1,client=0' -- -i"
> -            self.dut.send_expect(cmd, "testpmd>", 120)
> -            # Start the virtio_user side
> -            vhost_user = self.dut.new_session()
> -            command_line_user = self.target + "/app/testpmd -n 4 -c 0x0c " + \
> -                                " -m 2048 --no-pci --file-prefix=virtio " + \
> -                                " --
> vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net " + \
> -                                " -- -i --tx-offloads=0 --disable-hw-vlan-filter"
> -
> -            vhost_user.send_expect(command_line_user, "testpmd>", 120)
> -
> -            self.dut.send_expect("set fwd mac retry", "testpmd>", 60)
> -            self.dut.send_expect("start tx_first 32", "testpmd>", 60)
> -            vhost_user.send_expect("start tx_first 32", "testpmd> ", 120)
> -            results = 0.0
> -            out = self.dut.send_expect("show port stats all", "testpmd>", 60)
> -            time.sleep(5)
> -            # Get throughput 10 times and calculate the average throughput
> -            for i in range(10):
> -                out = self.dut.send_expect("show port stats all", "testpmd>", 60)
> -                time.sleep(5)
> -                lines = re.search("Rx-pps:\s*(\d*)", out)
> -                result = lines.group(1)
> -                results += float(result)
> -            Mpps = results / (1000000 * 10)
> -
> -            self.dut.send_expect("quit", "#", 60)
> -            vhost_user.send_expect("quit", "#", 60)
> -            # Restore the driver file
> -            self.dut.send_expect("rm -rf ./drivers/net/virtio/virtio_ethdev.h", "#",
> 30)
> -            self.dut.send_expect("mv ./virtio_ethdev.h ./drivers/net/virtio/", "#",
> 30)
> -            self.test_cycles['Mpps'][frame_size] = Mpps
> -            self.test_cycles['pct'][frame_size] = "Virtio 0.95"
> -
> -        for frame_size in self.frame_sizes:
> -            results_row = [frame_size]
> -            results_row.append("Vector on")
> -            results_row.append(self.test_cycles['Mpps'][frame_size])
> -            results_row.append(self.test_cycles['pct'][frame_size])
> -            self.result_table_add(results_row)
> -
> -        self.result_table_print()
> -
> -    def test_perf_vhost_normal_loopback(self):
> -        """
> -        Benchmark performance for frame_sizes.
> -        """
> -
> -        self.result_table_create(self.header_row)
> -        for frame_size in self.frame_sizes:
> -            # Modify the driver file to disable the Mergeable, then re-compile
> the DPDK and back up the original driver file
> -            self.dut.send_expect("cp ./drivers/net/virtio/virtio_ethdev.h ./", "#",
> 30)
> -            self.dut.send_expect("sed -i
> '/VIRTIO_NET_F_MRG_RXBUF/d' ./drivers/net/virtio/virtio_ethdev.h", "#", 30)
> -            self.change_testpmd_size = "sed -i -e 's/#define
> TXONLY_DEF_PACKET_LEN .*$/#define
> TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
> -            self.dut.send_expect(self.change_testpmd_size, "#", 30)
> -            self.dut.build_install_dpdk(self.dut.target)
> -
> -            # Start the vhost user side
> -            cmd = self.target + "/app/testpmd -n 4 -c 0x03 " + \
> -                  "-m 2048 --file-prefix=vhost --vdev 'net_vhost0,iface=vhost-
> net,queues=1,client=0' -- -i"
> -            self.dut.send_expect(cmd, "testpmd>", 120)
> -            # Start the virtio_user side
> -            vhost_user = self.dut.new_session()
> -            command_line_user = self.target + "/app/testpmd -n 4 -c 0x0c " + \
> -                                " -m 2048 --no-pci --file-prefix=virtio " + \
> -                                " --
> vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net" + \
> -                                " -- -i --tx-offloads=0x8000 --disable-hw-vlan-filter"
> -
> -            vhost_user.send_expect(command_line_user, "testpmd>", 120)
> -
> -            self.dut.send_expect("set fwd mac retry", "testpmd>", 60)
> -            self.dut.send_expect("start tx_first 32", "testpmd>", 60)
> -            vhost_user.send_expect("start tx_first 32", "testpmd> ", 120)
> -            results = 0.0
> -            out = self.dut.send_expect("show port stats all", "testpmd>", 60)
> -            time.sleep(5)
> -            # Get throughput 10 times and calculate the average throughput
> -            for i in range(10):
> -                out = self.dut.send_expect("show port stats all", "testpmd>", 60)
> -                time.sleep(5)
> -                lines = re.search("Rx-pps:\s*(\d*)", out)
> -                result = lines.group(1)
> -                results += float(result)
> -            Mpps = results / (1000000 * 10)
> -
> -            self.dut.send_expect("quit", "#", 60)
> -            vhost_user.send_expect("quit", "#", 60)
> -            # Restore the driver file
> -            self.dut.send_expect("rm -rf ./drivers/net/virtio/virtio_ethdev.h", "#",
> 30)
> -            self.dut.send_expect("mv ./virtio_ethdev.h ./drivers/net/virtio/", "#",
> 30)
> -            self.test_cycles['Mpps'][frame_size] = Mpps
> -            self.test_cycles['pct'][frame_size] = "Virtio 0.95"
> -
> -        for frame_size in self.frame_sizes:
> -            results_row = [frame_size]
> -            results_row.append("Normal")
> -            results_row.append(self.test_cycles['Mpps'][frame_size])
> -            results_row.append(self.test_cycles['pct'][frame_size])
> -            self.result_table_add(results_row)
> -
> -        self.result_table_print()
> -
> -    def tear_down(self):
> -        """
> -        Run after each test case.
> -        """
> -        time.sleep(2)
> -
> -    def tear_down_all(self):
> -        """
> -        Run after each test suite.
> -        """
> -        # Recompile the dpdk because we change the source code during the
> test
> -        self.dut.build_install_dpdk(self.dut.target)
> -        # Re-bind the port to config driver
> -        port_list = self.dut.get_ports()
> -        for i in port_list:
> -            port = self.dut.ports_info[i]['port']
> -            port.bind_driver(self.drivername)
> -        # Set the tx packet size of testpmd to default size
> -        self.dut.send_expect("sed -i -e 's/#define
> TXONLY_DEF_PACKET_LEN.*$/#define
> TXONLY_DEF_PACKET_LEN %s/' ./app/test-pmd/testpmd.h" %
> self.packet_length, "#", 30)
> diff --git a/tests/TestSuite_vhost_qemu_pvp_performance.py
> b/tests/TestSuite_vhost_qemu_pvp_performance.py
> deleted file mode 100644
> index 051c9a2..0000000
> --- a/tests/TestSuite_vhost_qemu_pvp_performance.py
> +++ /dev/null
> @@ -1,307 +0,0 @@
> -# 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.
> -
> -Vhost PVP performance using Qemu test suite.
> -"""
> -import os
> -import re
> -import time
> -import utils
> -from scapy.utils import wrpcap, rdpcap
> -from test_case import TestCase
> -from exception import VerifyFailure
> -from settings import HEADER_SIZE
> -from etgen import IxiaPacketGenerator
> -from qemu_kvm import QEMUKvm
> -
> -
> -class TestVhostUserOneCopyOneVm(TestCase):
> -
> -    def set_up_all(self):
> -        # Get and verify the ports
> -        self.dut_ports = self.dut.get_ports()
> -        self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
> -
> -        # Get the port's socket
> -        self.pf = self.dut_ports[0]
> -        netdev = self.dut.ports_info[self.pf]['port']
> -        self.socket = netdev.get_nic_socket()
> -        self.cores = self.dut.get_core_list("1S/3C/1T", socket=self.socket)
> -
> -        # Set the params of vhost sample
> -        self.vhost_app = "./examples/vhost/build/vhost-switch"
> -        self.vm2vm = 0
> -        # This parameter is used to define mergeable on/off
> -        self.jumbo = 0
> -
> -        # Using file to save the vhost sample output since in jumboframe case,
> -        # there will be lots of output
> -        self.vhost_test = self.vhost_app + \
> -            " -c %s -n %d --socket-mem 2048,2048  -- -p 0x1 --mergeable %d" + \
> -            " --vm2vm %d --socket-file ./vhost-net  > ./vhost.out &"
> -        # build the vhost sample in vhost-user mode.
> -        if self.nic in ['niantic']:
> -            self.dut.send_expect(
> -                "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 128/'
> "
> -                "./examples/vhost/main.c",
> -                "#", 10)
> -        elif self.nic.startswith('fortville'):
> -            self.dut.send_expect(
> -                "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 512/'
> "
> -                "./examples/vhost/main.c",
> -                "#", 10)
> -        out = self.dut.send_expect("make -C examples/vhost", "#")
> -        self.verify("Error" not in out, "compilation error")
> -        self.verify("No such file" not in out, "Not found file error")
> -
> -        self.virtio1 = "eth1"
> -        self.virtio1_mac = "52:54:00:00:00:01"
> -        self.src1 = "192.168.4.1"
> -        self.dst1 = "192.168.3.1"
> -        self.vm_dut = None
> -
> -        self.number_of_ports = 1
> -        self.header_row = ["FrameSize(B)", "Throughput(Mpps)", "LineRate(%)",
> "Cycle"]
> -        self.memory_channel = 4
> -
> -    def set_up(self):
> -        #
> -        # Run before each test case.
> -        #
> -        # Launch vhost sample using default params
> -        #
> -        self.dut.send_expect("rm -rf ./vhost.out", "#")
> -        self.dut.send_expect("rm -rf ./vhost-net*", "#")
> -        self.dut.send_expect("killall -s INT vhost-switch", "#")
> -
> -        self.frame_sizes = [64, 128, 256, 512, 1024, 1500]
> -        self.vm_testpmd_vector = self.target + "/app/testpmd -c 0x3 -n 3" \
> -                                 + " -- -i --tx-offloads=0 --disable-hw-vlan-filter"
> -        self.vm_testpmd_normal = self.target + "/app/testpmd -c 0x3 -n 3" \
> -                                 + " -- -i --tx-offloads=0x8000 --disable-hw-vlan-filter"
> -
> -    def launch_vhost_sample(self):
> -        #
> -        # Launch the vhost sample with different parameters
> -        #
> -        self.coremask = utils.create_mask(self.cores)
> -        self.vhostapp_testcmd = self.vhost_test % (
> -            self.coremask, self.memory_channel, self.jumbo, self.vm2vm)
> -        self.dut.send_expect(self.vhostapp_testcmd, "# ", 40)
> -        time.sleep(30)
> -        try:
> -            self.logger.info("Launch vhost sample:")
> -            self.dut.session.copy_file_from(self.dut.base_dir + "vhost.out")
> -            fp = open('./vhost.out', 'r')
> -            out = fp.read()
> -            fp.close()
> -            if "Error" in out:
> -                raise Exception("Launch vhost sample failed")
> -            else:
> -                self.logger.info("Launch vhost sample finished")
> -        except Exception as e:
> -            self.logger.error("ERROR: Failed to launch vhost sample: %s" % str(e))
> -
> -    def start_onevm(self, path="", modem=0):
> -        #
> -        # Start One VM with one virtio device
> -        #
> -
> -        self.vm = QEMUKvm(self.dut, 'vm0', 'vhost_sample')
> -        if(path != ""):
> -            self.vm.set_qemu_emulator(path)
> -        vm_params = {}
> -        vm_params['driver'] = 'vhost-user'
> -        vm_params['opt_path'] = './vhost-net'
> -        vm_params['opt_mac'] = self.virtio1_mac
> -        if(modem == 1):
> -            vm_params['opt_settings'] = 'disable-modern=false'
> -        self.vm.set_vm_device(**vm_params)
> -
> -        try:
> -            self.vm_dut = 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 vm_testpmd_start(self):
> -        #
> -        # Start testpmd in vm
> -        #
> -        if self.vm_dut is not None:
> -            self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
> -            self.vm_dut.send_expect("set fwd mac", "testpmd>", 20)
> -            self.vm_dut.send_expect("start tx_first", "testpmd>")
> -
> -    def send_verify(self, case, frame_sizes, vlan_id1=0, tag="Performance"):
> -        self.result_table_create(self.header_row)
> -        for frame_size in frame_sizes:
> -            info = "Running test %s, and %d frame size." % (case, frame_size)
> -            self.logger.info(info)
> -            payload = frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
> -            flow1 =
> '[Ether(dst="%s")/Dot1Q(vlan=%s)/IP(src="%s",dst="%s")/("X"*%d)]' % (
> -                self.virtio1_mac, vlan_id1, self.src1, self.dst1, payload)
> -            self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1)
> -            self.tester.scapy_execute()
> -
> -            tgenInput = []
> -            port = self.tester.get_local_port(self.pf)
> -            tgenInput.append((port, port, "flow1.pcap"))
> -
> -            _, pps = self.tester.traffic_generator_throughput(tgenInput, delay=30)
> -            Mpps = pps / 1000000.0
> -            pct = Mpps * 100 / float(self.wirespeed(self.nic, frame_size,
> -                                     self.number_of_ports))
> -            data_row = [frame_size, str(Mpps), str(pct), tag]
> -            self.result_table_add(data_row)
> -        self.result_table_print()
> -
> -    def test_perf_pvp_qemu_vector_pmd(self):
> -        #
> -        # Test the pvp performance for vector path
> -        #
> -        # start testpmd on VM
> -        self.jumbo = 0
> -        self.launch_vhost_sample()
> -        self.start_onevm()
> -
> -        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
> -        self.vm_dut.send_expect("start tx_first", "testpmd>")
> -        time.sleep(5)
> -        vlan_id1 = 1000
> -        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "Virtio
> 0.95 Vector Performance")
> -        self.vm_dut.kill_all()
> -
> -    def test_perf_pvp_qemu_normal_pmd(self):
> -        #
> -        # Test the performance for normal path
> -        #
> -        # start testpmd on VM
> -        self.jumbo = 0
> -        self.launch_vhost_sample()
> -        self.start_onevm()
> -        # Start testpmd with user
> -        self.vm_dut.send_expect(self.vm_testpmd_normal, "testpmd>", 20)
> -        self.vm_dut.send_expect("start tx_first", "testpmd>")
> -
> -        time.sleep(5)
> -        vlan_id1 = 1000
> -        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "Virtio
> 0.95 Normal Performance")
> -        self.vm_dut.kill_all()
> -
> -    def test_perf_pvp_qemu_mergeable_pmd(self):
> -        #
> -        # Test the performance for mergeable path
> -        #
> -        # start testpmd on VM
> -        self.jumbo = 1
> -        self.launch_vhost_sample()
> -        self.start_onevm()
> -        # Start testpmd with user
> -        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
> -        self.vm_dut.send_expect("start tx_first", "testpmd>")
> -
> -        time.sleep(5)
> -        vlan_id1 = 1000
> -        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "Virtio
> 0.95 Mergeable Performance")
> -        self.vm_dut.kill_all()
> -
> -    def test_perf_virtio_modern_qemu_vector_pmd(self):
> -        #
> -        # Test the vhost/virtio pvp performance for virtio1.0
> -        #
> -        #
> -        # start testpmd on VM
> -        self.jumbo = 0
> -        self.launch_vhost_sample()
> -        self.start_onevm("", 1)
> -        # Start testpmd with user
> -        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
> -        self.vm_dut.send_expect("start tx_first", "testpmd>")
> -
> -        time.sleep(5)
> -        vlan_id1 = 1000
> -        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "virtio1.0,
> Vector")
> -        self.vm_dut.kill_all()
> -
> -    def test_perf_virtio_modern_qemu_normal_pmd(self):
> -        #
> -        # Test the performance of one vm with 2virtio devices in legacy fwd
> -        #
> -        # start testpmd on VM
> -        self.jumbo = 0
> -        self.launch_vhost_sample()
> -        self.start_onevm("", 1)
> -        # Start testpmd with user
> -        self.vm_dut.send_expect(self.vm_testpmd_normal, "testpmd>", 20)
> -        self.vm_dut.send_expect("start tx_first", "testpmd>")
> -
> -        time.sleep(5)
> -        vlan_id1 = 1000
> -        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "virtio1.0,
> Normal")
> -        self.vm_dut.kill_all()
> -
> -    def test_perf_virtio_modern_qemu_mergeable_pmd(self):
> -        #
> -        # Test the performance of one vm with 2virtio devices in legacy fwd
> -        #
> -        # start testpmd on VM
> -        self.jumbo = 1
> -        self.launch_vhost_sample()
> -        self.start_onevm("", 1)
> -        # Start testpmd with user
> -        self.vm_dut.send_expect(self.vm_testpmd_vector, "testpmd>", 20)
> -        self.vm_dut.send_expect("start tx_first", "testpmd>")
> -
> -        time.sleep(5)
> -        vlan_id1 = 1000
> -        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, "virtio1.0,
> Mergeable")
> -        self.vm_dut.kill_all()
> -
> -    def tear_down(self):
> -        #
> -        # Run after each test case.
> -        # Clear vhost-switch and qemu to avoid blocking the following TCs
> -        #
> -        self.vm.stop()
> -        time.sleep(2)
> -
> -    def tear_down_all(self):
> -        """
> -        Run after each test suite.
> -        """
> -        pass
> --
> 2.17.1


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

end of thread, other threads:[~2019-06-26  7:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 19:37 [dts] [PATCH] tests: delete useless testsuite of virtio Yinan
2019-06-26  7:21 ` Tu, Lijuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).