test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] tests/TestSuite_ddp_gtp:modify pf case not start vm
@ 2020-07-03  3:25 xizhan4x
  2020-07-03  3:30 ` Xie, WeiX
  2020-07-20  6:55 ` Tu, Lijuan
  0 siblings, 2 replies; 4+ messages in thread
From: xizhan4x @ 2020-07-03  3:25 UTC (permalink / raw)
  To: dts; +Cc: xizhan4x


modify pf case not start vm env


Signed-off-by: xizhan4x <xix.zhang@intel.com>
---
 tests/TestSuite_ddp_gtp.py | 61 +++++++++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 17 deletions(-)

diff --git a/tests/TestSuite_ddp_gtp.py b/tests/TestSuite_ddp_gtp.py
index e7aa96e..972c401 100644
--- a/tests/TestSuite_ddp_gtp.py
+++ b/tests/TestSuite_ddp_gtp.py
@@ -43,10 +43,39 @@ class TestDdpGtp(TestCase):
         else:
             self.vf_assign_method = 'vfio-pci'
             self.dut.send_expect('modprobe vfio-pci', '#')
+    def insmod_modprobe(self,modename=''):
+        """
+        Insmod modProbe before run test case
+        """
+        if modename == "igb_uio":
+            self.dut.send_expect("modprobe uio", "#", 10)
+            out = self.dut.send_expect("lsmod | grep igb_uio", "#")
+            if "igb_uio" in out:
+                self.dut.send_expect("rmmod -f igb_uio", "#", 10)
+            self.dut.send_expect("insmod ./" + self.target + "/kmod/igb_uio.ko", "#", 10)
+
+            out = self.dut.send_expect("lsmod | grep igb_uio", "#")
+            assert ("igb_uio" in out), "Failed to insmod igb_uio"
 
     def set_up(self):
-        self.setup_vm_env()
-        self.load_profile()
+        self.dut_testpmd = PmdOutput(self.dut)
+        self.used_dut_port = self.dut_ports[0]
+        tester_port = self.tester.get_local_port(self.used_dut_port)
+        self.tester_intf = self.tester.get_interface(tester_port)
+        if "vf" in self._suite_result.test_case:
+            self.insmod_modprobe("igb_uio")
+            self.bind_nic_driver(self.dut_ports,"igb_uio")
+            self.setup_vm_env()
+            self.load_profile()
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK, "--port-topology=chained --txq=%s --rxq=%s"
+                               % (self.VF_QUEUE, self.VF_QUEUE))
+            self.vm0_testpmd.execute_cmd('set fwd rxonly')
+            self.vm0_testpmd.execute_cmd('set verbose 1')
+            self.vm0_testpmd.execute_cmd('start')
+        else:
+            self.load_profile()
+
 
     def search_queue_number(self, Q_strip):
         """
@@ -91,10 +120,6 @@ class TestDdpGtp(TestCase):
         Create testing environment with VF generated from 1PF
         """
         if self.env_done is False:
-            self.bind_nic_driver(self.dut_ports[:1], driver="igb_uio")
-            self.used_dut_port = self.dut_ports[0]
-            tester_port = self.tester.get_local_port(self.used_dut_port)
-            self.tester_intf = self.tester.get_interface(tester_port)
             self.dut.generate_sriov_vfs_by_port(
                 self.used_dut_port, 1, driver=driver)
             self.sriov_vfs_port = self.dut.ports_info[
@@ -102,8 +127,6 @@ class TestDdpGtp(TestCase):
             for port in self.sriov_vfs_port:
                     port.bind_driver(self.vf_driver)
             time.sleep(1)
-            self.dut_testpmd = PmdOutput(self.dut)
-            time.sleep(1)
             vf0_prop = {'opt_host': self.sriov_vfs_port[0].pci}
             # set up VM0 ENV
             self.vm0 = QEMUKvm(self.dut, 'vm0', 'ddp_gtp')
@@ -119,6 +142,7 @@ class TestDdpGtp(TestCase):
             self.vm0_testpmd = PmdOutput(self.vm0_dut)
             self.env_done = True
 
+
     def destroy_vm_env(self):
 
         if getattr(self, 'vm0', None):
@@ -146,9 +170,7 @@ class TestDdpGtp(TestCase):
             "Default", "--pkt-filter-mode=perfect --port-topology=chained \
             --txq=%s --rxq=%s"
             % (self.PF_QUEUE, self.PF_QUEUE))
-        self.vm0_testpmd.start_testpmd(
-            VM_CORES_MASK, "--port-topology=chained --txq=%s --rxq=%s"
-            % (self.VF_QUEUE, self.VF_QUEUE))
+
         self.dut_testpmd.execute_cmd('port stop all')
         time.sleep(1)
         out = self.dut_testpmd.execute_cmd('ddp get list 0')
@@ -161,9 +183,9 @@ class TestDdpGtp(TestCase):
         self.dut_testpmd.execute_cmd('set fwd rxonly')
         self.dut_testpmd.execute_cmd('set verbose 1')
         self.dut_testpmd.execute_cmd('start')
-        self.vm0_testpmd.execute_cmd('set fwd rxonly')
-        self.vm0_testpmd.execute_cmd('set verbose 1')
-        self.vm0_testpmd.execute_cmd('start')
+        time.sleep(2)
+
+
 
     def gtp_packets(
             self, type='fdir', tunnel_pkt='gtpu', inner_L3='ipv4',
@@ -409,7 +431,10 @@ class TestDdpGtp(TestCase):
             type='clfter', port='vf id 0', tunnel_pkt='gtpu', inner_L3='ipv6')
 
     def tear_down(self):
-        self.vm0_testpmd.execute_cmd('stop')
+        if "vf" in self._suite_result.test_case:
+            self.destroy_vm_env()
+            self.vm0_testpmd.execute_cmd('stop')
+            self.vm0_testpmd.quit()
         self.dut_testpmd.execute_cmd('stop')
         out = self.dut_testpmd.execute_cmd('ddp get list 0')
         if "Profile number is: 0" not in out:
@@ -420,8 +445,10 @@ class TestDdpGtp(TestCase):
             self.verify("Profile number is: 0" in out,
                         "Failed to delete ddp profile!!!")
             self.dut_testpmd.execute_cmd('port start all')
-        self.vm0_testpmd.quit()
         self.dut_testpmd.quit()
 
+
     def tear_down_all(self):
-        self.destroy_vm_env()
+        if self.env_done:
+            self.destroy_vm_env()
+
-- 
1.8.3.1


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

end of thread, other threads:[~2020-07-24  2:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03  3:25 [dts] [PATCH V1] tests/TestSuite_ddp_gtp:modify pf case not start vm xizhan4x
2020-07-03  3:30 ` Xie, WeiX
2020-07-24  2:29   ` Tu, Lijuan
2020-07-20  6:55 ` 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).