test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yu Jiang <yux.jiang@intel.com>
To: lijuan.tu@intel.com, dts@dpdk.org
Cc: Yu Jiang <yux.jiang@intel.com>
Subject: [dts][PATCH V1 1/2] tests/kni: wait for interface up
Date: Thu, 10 Feb 2022 16:32:25 +0000	[thread overview]
Message-ID: <20220210163226.2442488-2-yux.jiang@intel.com> (raw)
In-Reply-To: <20220210163226.2442488-1-yux.jiang@intel.com>

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_kni.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/TestSuite_kni.py b/tests/TestSuite_kni.py
index c2b05bad..c2036625 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()
@@ -975,7 +978,7 @@ class TestKni(TestCase):
         self.dut.send_expect("brctl addif br1 %s" %
                              port_virtual_interaces[1], "# ")
         self.dut.send_expect("ifconfig br1 up", "# ")
-        time.sleep(3)
+        self.verify(self.dut.is_interface_up(intf='br1'), "Wrong link status, should be up")
 
         tx_port = self.tester.get_local_port(dut_ports[0])
         rx_port = self.tester.get_local_port(dut_ports[1])
@@ -997,6 +1000,7 @@ class TestKni(TestCase):
             self.result_table_add([flows, float(pps) / 10 ** 6])
 
         self.dut.send_expect("ifconfig br1 down", "# ")
+        self.verify(self.dut.is_interface_down(intf='br1'), "Wrong link status, should be down")
         self.dut.send_expect("brctl delbr \"br1\"", "# ", 30)
 
         for port in allow_list:
-- 
2.25.1


  reply	other threads:[~2022-02-10  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-02-10 16:32 ` [dts][PATCH V1 2/2] tests/short_live: wait for interface up Yu Jiang
2022-02-24 15:42 [dts][PATCH V1 0/2] optimize script: " Yu Jiang
2022-02-24 15:42 ` [dts][PATCH V1 1/2] tests/kni: " Yu Jiang

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=20220210163226.2442488-2-yux.jiang@intel.com \
    --to=yux.jiang@intel.com \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@intel.com \
    /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).