test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts][PATCH V1 0/2] optimize script: wait for interface up
@ 2022-02-24 15:42 Yu Jiang
  2022-02-24 15:42 ` [dts][PATCH V1 1/2] tests/kni: " Yu Jiang
  2022-02-24 15:42 ` [dts][PATCH V1 2/2] tests/short_live: " Yu Jiang
  0 siblings, 2 replies; 5+ messages in thread
From: Yu Jiang @ 2022-02-24 15:42 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Yu Jiang

optimize script: wait for interface up

Yu Jiang (2):
  tests/kni: wait for interface up
  tests/short_live: wait for interface up

 tests/TestSuite_kni.py        | 11 +++++++----
 tests/TestSuite_short_live.py |  6 ++++--
 2 files changed, 11 insertions(+), 6 deletions(-)

-- 
2.25.1


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

* [dts][PATCH V1 1/2] tests/kni: wait for interface up
  2022-02-24 15:42 [dts][PATCH V1 0/2] optimize script: wait for interface up Yu Jiang
@ 2022-02-24 15:42 ` Yu Jiang
  2022-02-24 15:42 ` [dts][PATCH V1 2/2] tests/short_live: " Yu Jiang
  1 sibling, 0 replies; 5+ messages in thread
From: Yu Jiang @ 2022-02-24 15:42 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Yu Jiang

optimize script kni, use new method: is_interface_up to ensure iface's link status.

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 tests/TestSuite_kni.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/TestSuite_kni.py b/tests/TestSuite_kni.py
index c2b05bad..a3655ecf 100644
--- a/tests/TestSuite_kni.py
+++ b/tests/TestSuite_kni.py
@@ -687,7 +687,8 @@ class TestKni(TestCase):
             tx_interface = self.tester.get_interface(tx_port)
 
             self.dut.send_expect("ifconfig %s up" % virtual_interface, "# ")
-            time.sleep(5)
+            # ensure virtual_interface link up
+            self.verify(self.dut.is_interface_up(intf=virtual_interface), "Wrong link status, should be up")
             # Start tcpdump with filters for src and dst MAC address, this avoids
             # unwanted broadcast, ICPM6... packets
             out = self.dut.send_expect(
@@ -733,7 +734,8 @@ class TestKni(TestCase):
 
             out = self.dut.send_expect(
                 "ifconfig %s up" % virtual_interface, "# ")
-            time.sleep(5)
+            # ensure virtual_interface up
+            self.verify(self.dut.is_interface_up(intf=virtual_interface), "virtual_interface should be up")
             out = self.dut.send_expect("ifconfig %s" % virtual_interface, "# ")
             m = re.search(rx_match, out)
             previous_rx_packets = int(m.group(1))
@@ -751,6 +753,8 @@ class TestKni(TestCase):
 
             pkt = packet.Packet()
             pkt.update_pkt(scapy_str)
+            # ensure tester's interface up
+            self.verify(self.tester.is_interface_up(intf=tx_interface), "Tester's interface should be up")
             pkt.send_pkt(self.tester, tx_port=tx_interface, count=200)
 
             out = self.dut.send_expect("ifconfig %s" % virtual_interface, "# ")
@@ -909,7 +913,6 @@ class TestKni(TestCase):
                 self.verify("ERROR" not in out, "Device not found")
 
             self.dut.send_expect("ifconfig br_kni up", "# ")
-            time.sleep(3)
 
             tx_port = self.tester.get_local_port(self.config['ports'][0])
             rx_port = self.tester.get_local_port(self.config['ports'][1])
@@ -919,7 +922,7 @@ class TestKni(TestCase):
 
             if step['flows'] == 2:
                 tgenInput.append((rx_port, tx_port, pcap))
-            time.sleep(1)
+            self.verify(self.dut.is_interface_up(intf="br_kni"), "br_kni should be up")
 
             # clear streams before add new streams
             self.tester.pktgen.clear_streams()
-- 
2.25.1


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

* [dts][PATCH V1 2/2] tests/short_live: wait for interface up
  2022-02-24 15:42 [dts][PATCH V1 0/2] optimize script: wait for interface up Yu Jiang
  2022-02-24 15:42 ` [dts][PATCH V1 1/2] tests/kni: " Yu Jiang
@ 2022-02-24 15:42 ` Yu Jiang
  2022-02-27 14:20   ` Tu, Lijuan
  1 sibling, 1 reply; 5+ messages in thread
From: Yu Jiang @ 2022-02-24 15:42 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Yu Jiang

optimize script short_live:
1, use new method: is_interface_up to ensure iface's link status.
2, when launch example frequently, need wait for more than 0.5s to
restart example after kill example abnormally.

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

diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py
index 1b8fbb94..556728b9 100644
--- a/tests/TestSuite_short_live.py
+++ b/tests/TestSuite_short_live.py
@@ -106,7 +106,8 @@ class TestShortLiveApp(TestCase):
         # rx and tx packet are list
         if (txPort == rxPort):
             count = 2
-
+        # ensure tester's link up
+        self.verify(self.tester.is_interface_up(intf=rxitf), "Wrong link status, should be up")
         filter_list = [{'layer': 'ether', 'config': {'type': 'not IPv6'}}, {'layer': 'userdefined', 'config': {'pcap-filter': 'not udp'}}]
         inst = self.tester.tcpdump_sniff_packets(rxitf, count=count,filters=filter_list)
 
@@ -135,6 +136,8 @@ class TestShortLiveApp(TestCase):
                 time.sleep(1)
                 delay = delay + 1
             else:
+                # need wait for 1s to restart example after kill example abnormally.
+                time.sleep(1)
                 break
         self.verify(delay < delay_max, "Failed to kill the process within %s seconds" % delay_max)
 
@@ -144,7 +147,6 @@ class TestShortLiveApp(TestCase):
         """
         #dpdk start
         self.dut.send_expect("./%s %s -- -i --portmask=0x3" % (self.app_testpmd, self.eal_para()), "testpmd>", 120)
-        time.sleep(5)
         self.dut.send_expect("set fwd mac", "testpmd>")
         self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("start", "testpmd>")
-- 
2.25.1


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

* RE: [dts][PATCH V1 2/2] tests/short_live: wait for interface up
  2022-02-24 15:42 ` [dts][PATCH V1 2/2] tests/short_live: " Yu Jiang
@ 2022-02-27 14:20   ` Tu, Lijuan
  0 siblings, 0 replies; 5+ messages in thread
From: Tu, Lijuan @ 2022-02-27 14:20 UTC (permalink / raw)
  To: Jiang, YuX, dts

> -----Original Message-----
> From: Jiang, YuX <yux.jiang@intel.com>
> Sent: 2022年2月24日 23:42
> To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org
> Cc: Jiang, YuX <yux.jiang@intel.com>
> Subject: [dts][PATCH V1 2/2] tests/short_live: wait for interface up
> 
> optimize script short_live:
> 1, use new method: is_interface_up to ensure iface's link status.
> 2, when launch example frequently, need wait for more than 0.5s to restart
> example after kill example abnormally.
> 
> Signed-off-by: Yu Jiang <yux.jiang@intel.com>

Series applied.

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

* [dts][PATCH V1 2/2] tests/short_live: wait for interface up
  2022-02-10 16:32 [dts][PATCH V1 0/2] optimize script: wait for interface/link up Yu Jiang
@ 2022-02-10 16:32 ` Yu Jiang
  0 siblings, 0 replies; 5+ messages in thread
From: Yu Jiang @ 2022-02-10 16:32 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Yu Jiang

use new method: is_interface_up/down to to ensure iface's link status.

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

diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py
index 1b8fbb94..0d090682 100644
--- a/tests/TestSuite_short_live.py
+++ b/tests/TestSuite_short_live.py
@@ -106,7 +106,8 @@ class TestShortLiveApp(TestCase):
         # rx and tx packet are list
         if (txPort == rxPort):
             count = 2
-
+        # ensure tester's link up
+        self.verify(self.tester.is_interface_up(intf=rxitf), "Wrong link status, should be up")
         filter_list = [{'layer': 'ether', 'config': {'type': 'not IPv6'}}, {'layer': 'userdefined', 'config': {'pcap-filter': 'not udp'}}]
         inst = self.tester.tcpdump_sniff_packets(rxitf, count=count,filters=filter_list)
 
@@ -144,7 +145,6 @@ class TestShortLiveApp(TestCase):
         """
         #dpdk start
         self.dut.send_expect("./%s %s -- -i --portmask=0x3" % (self.app_testpmd, self.eal_para()), "testpmd>", 120)
-        time.sleep(5)
         self.dut.send_expect("set fwd mac", "testpmd>")
         self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("start", "testpmd>")
-- 
2.25.1


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

end of thread, other threads:[~2022-02-27 14:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 15:42 [dts][PATCH V1 0/2] optimize script: wait for interface up Yu Jiang
2022-02-24 15:42 ` [dts][PATCH V1 1/2] tests/kni: " Yu Jiang
2022-02-24 15:42 ` [dts][PATCH V1 2/2] tests/short_live: " Yu Jiang
2022-02-27 14:20   ` Tu, Lijuan
  -- strict thread matches above, loose matches on Subject: below --
2022-02-10 16:32 [dts][PATCH V1 0/2] optimize script: wait for interface/link up Yu Jiang
2022-02-10 16:32 ` [dts][PATCH V1 2/2] tests/short_live: wait for interface up Yu Jiang

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).