test suite reviews and discussions
 help / color / mirror / Atom feed
From: xizhan4x <xix.zhang@intel.com>
To: dts@dpdk.org
Cc: xizhan4x <xix.zhang@intel.com>
Subject: [dts] [dts 09/38] tests-TestSuite_hotplug.py:support meson build
Date: Fri,  4 Sep 2020 16:18:16 +0800	[thread overview]
Message-ID: <1599207525-22123-9-git-send-email-xix.zhang@intel.com> (raw)
In-Reply-To: <1599207525-22123-1-git-send-email-xix.zhang@intel.com>

Signed-off-by: xizhan4x <xix.zhang@intel.com>
---
 tests/TestSuite_hotplug.py | 92 +++++++++++++++++++++++++---------------------
 1 file changed, 51 insertions(+), 41 deletions(-)

diff --git a/tests/TestSuite_hotplug.py b/tests/TestSuite_hotplug.py
index 4af9957..1882c84 100644
--- a/tests/TestSuite_hotplug.py
+++ b/tests/TestSuite_hotplug.py
@@ -1,4 +1,4 @@
-#BSD LICENSE
+# BSD LICENSE
 #
 # Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
 # All rights reserved.
@@ -42,10 +42,12 @@ from test_case import TestCase
 from packet import Packet
 import os
 
+
 class TestPortHotPlug(TestCase):
     """
     This feature supports igb_uio, vfio-pci and vfio-pci:noiommu now and not support freebsd
     """
+
     def set_up_all(self):
         """
         Run at the start of each test suite.
@@ -59,59 +61,62 @@ class TestPortHotPlug(TestCase):
             self.driver_name = "vfio-pci"
         else:
             self.driver_name = self.drivername
+        self.path=self.dut.apps_name['test-pmd']
 
     def set_up(self):
         """
         Run before each test case.
         """
-        self.dut.send_expect("./usertools/dpdk-devbind.py -u %s" % self.dut.ports_info[self.port]['pci'],"#",60)
+        self.dut.send_expect("./usertools/dpdk-devbind.py -u %s" % self.dut.ports_info[self.port]['pci'], "#", 60)
 
     def attach(self, port):
         """
         attach port
         """
         # dpdk hotplug discern NIC by pci bus and include domid
-        self.dut.send_expect("port attach %s" % self.dut.ports_info[port]['pci'],"is attached",60)
-        self.dut.send_expect("port start %s" % port,"Configuring Port",120)
+        self.dut.send_expect("port attach %s" % self.dut.ports_info[port]['pci'], "is attached", 60)
+        self.dut.send_expect("port start %s" % port, "Configuring Port", 120)
         # sleep 10 seconds for fortville update link stats
         time.sleep(10)
-        self.dut.send_expect("show port info %s" % port,"testpmd>",60)
+        self.dut.send_expect("show port info %s" % port, "testpmd>", 60)
 
     def detach(self, port):
         """
-        detach port 
+        detach port
         """
-        self.dut.send_expect("port stop %s" % port,"Stopping ports",60)
+        self.dut.send_expect("port stop %s" % port, "Stopping ports", 60)
         # sleep 10 seconds for fortville update link stats
         time.sleep(10)
-        self.dut.send_expect("port detach %s" % port,"is detached",60)
+        self.dut.send_expect("port detach %s" % port, "is detached", 60)
 
     def test_after_attach(self):
         """
         first run testpmd after attach port
         """
-        cmd = "./%s/app/testpmd -c %s -n %s -- -i" % (self.target,self.coremask,self.dut.get_memory_channels())
-        self.dut.send_expect(cmd,"testpmd>",60)
+        cmd = "%s -c %s -n %s -- -i" % (self.path, self.coremask, self.dut.get_memory_channels())
+        self.dut.send_expect(cmd, "testpmd>", 60)
         session_secondary = self.dut.new_session()
-        session_secondary.send_expect("./usertools/dpdk-devbind.py --bind=%s %s" % (self.driver_name, self.dut.ports_info[self.port]['pci']), "#", 60)
+        session_secondary.send_expect(
+            "./usertools/dpdk-devbind.py --bind=%s %s" % (self.driver_name, self.dut.ports_info[self.port]['pci']), "#",
+            60)
         self.dut.close_session(session_secondary)
         self.attach(self.port)
-        self.dut.send_expect("start","testpmd>",60)
-        self.dut.send_expect("port detach %s" % self.port,"Port not stopped",60)
-        self.dut.send_expect("stop","testpmd>",60)
+        self.dut.send_expect("start", "testpmd>", 60)
+        self.dut.send_expect("port detach %s" % self.port, "Port not stopped", 60)
+        self.dut.send_expect("stop", "testpmd>", 60)
         self.detach(self.port)
         self.attach(self.port)
-   
-        self.dut.send_expect("start","testpmd>",60)
-        self.dut.send_expect("port detach %s" % self.port,"Port not stopped",60)
-        self.dut.send_expect("clear port stats %s" % self.port ,"testpmd>",60)
+
+        self.dut.send_expect("start", "testpmd>", 60)
+        self.dut.send_expect("port detach %s" % self.port, "Port not stopped", 60)
+        self.dut.send_expect("clear port stats %s" % self.port, "testpmd>", 60)
         self.send_packet(self.port)
-        out = self.dut.send_expect("show port stats %s" % self.port ,"testpmd>",60)
-        packet = re.search("RX-packets:\s*(\d*)",out)
+        out = self.dut.send_expect("show port stats %s" % self.port, "testpmd>", 60)
+        packet = re.search("RX-packets:\s*(\d*)", out)
         sum_packet = packet.group(1)
         self.verify(int(sum_packet) == 1, "Insufficient the received package")
-        self.dut.send_expect("quit","#",60)
-     
+        self.dut.send_expect("quit", "#", 60)
+
     def send_packet(self, port):
         """
         Send a packet to port
@@ -120,30 +125,32 @@ class TestPortHotPlug(TestCase):
         txport = self.tester.get_local_port(port)
         self.txItf = self.tester.get_interface(txport)
         pkt = Packet(pkt_type='UDP')
-        pkt.config_layer('ether', {'dst': self.dmac,})
+        pkt.config_layer('ether', {'dst': self.dmac, })
         pkt.send_pkt(self.tester, tx_port=self.txItf)
-                       
+
     def test_before_attach(self):
         """
         first attach port after run testpmd
         """
         session_secondary = self.dut.new_session()
-        session_secondary.send_expect("./usertools/dpdk-devbind.py --bind=%s %s" % (self.driver_name, self.dut.ports_info[self.port]['pci']), "#", 60)
+        session_secondary.send_expect(
+            "./usertools/dpdk-devbind.py --bind=%s %s" % (self.driver_name, self.dut.ports_info[self.port]['pci']), "#",
+            60)
         self.dut.close_session(session_secondary)
-        cmd = "./%s/app/testpmd -c %s -n %s -- -i" % (self.target,self.coremask,self.dut.get_memory_channels())
-        self.dut.send_expect(cmd,"testpmd>",60)
+        cmd = "%s -c %s -n %s -- -i" % (self.path, self.coremask, self.dut.get_memory_channels())
+        self.dut.send_expect(cmd, "testpmd>", 60)
         self.detach(self.port)
         self.attach(self.port)
 
-        self.dut.send_expect("start","testpmd>",60)
-        self.dut.send_expect("port detach %s" % self.port, "Port not stopped",60)
-        self.dut.send_expect("clear port stats %s" % self.port ,"testpmd>",60)
+        self.dut.send_expect("start", "testpmd>", 60)
+        self.dut.send_expect("port detach %s" % self.port, "Port not stopped", 60)
+        self.dut.send_expect("clear port stats %s" % self.port, "testpmd>", 60)
         self.send_packet(self.port)
-        out = self.dut.send_expect("show port stats %s" % self.port ,"testpmd>",60)
-        packet = re.search("RX-packets:\s*(\d*)",out)
+        out = self.dut.send_expect("show port stats %s" % self.port, "testpmd>", 60)
+        packet = re.search("RX-packets:\s*(\d*)", out)
         sum_packet = packet.group(1)
         self.verify(int(sum_packet) == 1, "Insufficient the received package")
-        self.dut.send_expect("quit","#",60)
+        self.dut.send_expect("quit", "#", 60)
 
     def test_port_detach_attach_for_vhost_user_virtio_user(self):
         vdev = "eth_vhost0,iface=vhost-net,queues=1"
@@ -154,25 +161,27 @@ class TestPortHotPlug(TestCase):
         cores = self.dut.get_core_list("all")
         self.verify(len(cores) > 8, "insufficient cores for this case")
         eal_param = self.dut.create_eal_parameters(no_pci=True, cores=cores[1:5], vdevs=[vdev], prefix="vhost")
-        testpmd_cmd = "./%s/app/testpmd " % self.target + eal_param + ' -- -i'
+        testpmd_cmd = "%s " % self.path + eal_param + ' -- -i'
         self.dut.send_expect(testpmd_cmd, "testpmd>", timeout=60)
         self.dut.send_expect("port stop 0", "testpmd>")
         self.dut.send_expect("port detach 0", "Device is detached")
         stats = self.dut.send_expect("ls %s" % path, "#", timeout=3,
-                                   alt_session=True, verify=True)
-        self.verify(stats==2, 'port detach failed')
+                                     alt_session=True, verify=True)
+        self.verify(stats == 2, 'port detach failed')
         time.sleep(1)
         self.dut.send_expect("port attach eth_vhost1,iface=%s,queues=1" % iface, "Port 0 is attached.")
         self.dut.send_expect("port start 0", "testpmd>")
         out = self.dut.send_expect("ls %s" % path, "#", timeout=3,
                                    alt_session=True, verify=True)
-        self.verify(iface in out , 'port attach failed')
+        self.verify(iface in out, 'port attach failed')
 
         self.session2 = self.dut.create_session(name="virtio_user")
         eal_param = self.dut.create_eal_parameters(no_pci=True, fixed_prefix="virtio1", cores=cores[5:9])
-        testpmd_cmd2 = "%s/%s/app/testpmd " % (self.dut.base_dir,self.target) + eal_param + ' -- -i'
+        testpmd_cmd2 = "%s " % (self.path) + eal_param + ' -- -i'
         self.session2.send_expect(testpmd_cmd2, "testpmd>", timeout=60)
-        self.session2.send_expect("port attach net_virtio_user1,mac=00:01:02:03:04:05,path=%s,queues=1,packed_vq=1,mrg_rxbuf=1,in_order=0" % path, "testpmd")
+        self.session2.send_expect(
+            "port attach net_virtio_user1,mac=00:01:02:03:04:05,path=%s,queues=1,packed_vq=1,mrg_rxbuf=1,in_order=0" % path,
+            "testpmd")
         self.session2.send_expect("port start 0", "testpmd>", timeout=60)
         out = self.dut.send_expect("ls %s" % path, "#", timeout=3,
                                    alt_session=True, verify=True)
@@ -197,9 +206,10 @@ class TestPortHotPlug(TestCase):
         Run after each test case.
         """
         self.dut.kill_all()
-        self.dut.send_expect("./usertools/dpdk-devbind.py --bind=%s %s" % (self.driver_name, self.dut.ports_info[self.port]['pci']), "#", 60)
+        self.dut.send_expect(
+            "./usertools/dpdk-devbind.py --bind=%s %s" % (self.driver_name, self.dut.ports_info[self.port]['pci']), "#",
+            60)
         time.sleep(2)
-        
 
     def tear_down_all(self):
         """
-- 
1.8.3.1


  parent reply	other threads:[~2020-09-04  8:17 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  8:18 [dts] [dts 01/38] tests-TestSuite_dpdk_gro_lib.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 02/38] tests-TestSuite_dpdk_gso_lib.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 03/38] tests-TestSuite_dynamic_config.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 04/38] " xizhan4x
2020-09-04  8:18 ` [dts] [dts 05/38] tests-TestSuite_fdir.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 06/38] tests-TestSuite_flow_classify.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 07/38] tests-TestSuite_fortville_rss_granularity_config.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 08/38] tests-TestSuite_generic_flow_api.py:support " xizhan4x
2020-09-04  8:18 ` xizhan4x [this message]
2020-09-04  8:18 ` [dts] [dts 10/38] tests-TestSuite_hotplug_mp.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 11/38] tests-TestSuite_interrupt_pmd.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 12/38] tests-TestSuite_ipgre.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 13/38] tests-TestSuite_l2fwd_jobstats.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 14/38] tests/TestSuite_loopback_multi_paths_port_restart.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 15/38] tests/TestSuite_loopback_multi_queues.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 16/38] tests/TestSuite_loopback_virtio_user_server_mode.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 17/38] tests/TestSuite_multiple_pthread.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 18/38] tests/TestSuite_ntb.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 19/38] tests/TestSuite_nvgre.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 20/38] tests/TestSuite_perf_virtio_user_loopback.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 21/38] tests/TestSuite_perf_vm2vm_virtio_net_perf.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 22/38] tests/TestSuite_pmdpcap.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 23/38] tests/TestSuite_pmdrss_hash.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 24/38] tests/TestSuite_pvp_diff_qemu_version.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 25/38] tests/TestSuite_pvp_multi_paths_performance.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 26/38] tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 27/38] tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 28/38] tests/TestSuite_pvp_qemu_multi_paths_port_restart.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 29/38] tests/TestSuite_pvp_share_lib.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 30/38] tests/TestSuite_pvp_vhost_user_built_in_net_driver.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 31/38] tests/TestSuite_pvp_vhost_user_reconnect.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 32/38] tests/TestSuite_pvp_virtio_user_2M_hugepages.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 33/38] tests/TestSuite_qinq_filter.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 34/38] tests/TestSuite_queue_start_stop.py: xizhan4x
2020-09-04  8:18 ` [dts] [dts 35/38] tests/TestSuite_softnic.py:support meson build xizhan4x
2020-09-04  8:18 ` [dts] [dts 36/38] tests/TestSuite_tso.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 37/38] tests/TestSuite_vxlan.py:support " xizhan4x
2020-09-04  8:18 ` [dts] [dts 38/38] tests/TestSuite_vxlan_gpe_support_in_i40e.py:support " xizhan4x
2020-09-07  5:20 ` [dts] [dts 01/38] tests-TestSuite_dpdk_gro_lib.py:support " Ma, LihongX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1599207525-22123-9-git-send-email-xix.zhang@intel.com \
    --to=xix.zhang@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).