test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts][PATCH V1] tests/vm_hotplug: optimize script by using existed function
@ 2022-02-25 18:09 Yu Jiang
  2022-03-15  3:22 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Jiang @ 2022-02-25 18:09 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Yu Jiang

1, use existed function wait_link_status_up to check link's status.
2, use new method: is_interface_up to to ensure iface's link status before send_packets

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 tests/TestSuite_vm_hotplug.py | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/tests/TestSuite_vm_hotplug.py b/tests/TestSuite_vm_hotplug.py
index c3695b68..0b4c3476 100644
--- a/tests/TestSuite_vm_hotplug.py
+++ b/tests/TestSuite_vm_hotplug.py
@@ -237,28 +237,16 @@ class TestVmHotplug(TestCase):
             result.append(cap_num[0])
         return result
 
-    def check_link_status(self, vm_info):
-        loop = 1
-        while (loop <= 3):
-            out = vm_info.execute_cmd("show port info all", "testpmd> ", 120)
-            port_status = re.findall("Link\s*status:\s*([a-z]*)", out)
-            if ("down" not in port_status):
-                break
-            time.sleep(3)
-            loop += 1
-        self.verify("down" not in port_status, "port can not up after start")
-
     def verify_rxtx_only(self):
         # rxonly
         self.vm_testpmd.execute_cmd('set fwd rxonly')
         self.vm_testpmd.execute_cmd('set verbose 1')
         self.vm_testpmd.execute_cmd('port start all')
         self.vm_testpmd.execute_cmd('start')
-        self.check_link_status(self.vm_testpmd)
+        self.vm_testpmd.wait_link_status_up('all')
 
         self.send_packet()
-        out = self.vm0_dut.get_session_output()
-        time.sleep(1)
+        out = self.vm0_dut.get_session_output(timeout=20)
         self.verify(self.vf0_mac in out, 'vf0 receive packet fail')
         if self.device == 2:
             self.verify(self.vf1_mac in out, 'vf1 receive packet fail')
@@ -271,7 +259,7 @@ class TestVmHotplug(TestCase):
             iface_list.append(self.tester_intf1)
         self.start_tcpdump(iface_list)
         self.vm_testpmd.execute_cmd('start')
-        time.sleep(1)
+        self.vm_testpmd.wait_link_status_up('all')
         self.vm_testpmd.execute_cmd('stop')
         out = self.get_tcpdump_package(iface_list)
         for pkt_num in out:
@@ -303,6 +291,9 @@ class TestVmHotplug(TestCase):
         time.sleep(1)
 
     def send_packet(self):
+        # check tester's link status before send packet
+        for iface in [self.tester_intf0, self.tester_intf1]:
+            self.verify(self.tester.is_interface_up(intf=iface), "Wrong link status, should be up")
         self.vf0_mac = self.vm_testpmd.get_port_mac(0)
         pkts = []
         pkt1 = r'sendp([Ether(dst="%s")/IP()/UDP()/Raw(load="P"*26)], iface="%s")' % (self.vf0_mac, self.tester_intf)
-- 
2.25.1


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

* RE: [dts][PATCH V1] tests/vm_hotplug: optimize script by using existed function
  2022-02-25 18:09 [dts][PATCH V1] tests/vm_hotplug: optimize script by using existed function Yu Jiang
@ 2022-03-15  3:22 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2022-03-15  3:22 UTC (permalink / raw)
  To: Jiang, YuX, dts

> -----Original Message-----
> From: Jiang, YuX <yux.jiang@intel.com>
> Sent: 2022年2月26日 2:09
> To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org
> Cc: Jiang, YuX <yux.jiang@intel.com>
> Subject: [dts][PATCH V1] tests/vm_hotplug: optimize script by using existed
> function
> 
> 1, use existed function wait_link_status_up to check link's status.
> 2, use new method: is_interface_up to to ensure iface's link status before
> send_packets
> 
> Signed-off-by: Yu Jiang <yux.jiang@intel.com>

Applied, thanks

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

end of thread, other threads:[~2022-03-15  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 18:09 [dts][PATCH V1] tests/vm_hotplug: optimize script by using existed function Yu Jiang
2022-03-15  3:22 ` 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).