test suite reviews and discussions
 help / color / mirror / Atom feed
From: zhuwenhui <wenhuix.zhu@intel.com>
To: dts@dpdk.org
Cc: zhuwenhui <wenhuix.zhu@intel.com>
Subject: [dts] [PATCH V3] tests/dual_vlan check if the link is up
Date: Thu, 24 Jan 2019 11:02:41 +0800	[thread overview]
Message-ID: <1548298961-26285-1-git-send-email-wenhuix.zhu@intel.com> (raw)

The link maybe up failed after "start", make sure the link is really up, 
and then proceed to the next step.

Signed-off-by: zhuwenhui <wenhuix.zhu@intel.com>
---
V2: add show_port()

V3:
1. update show_port() to check_link_up()
2. in check_link_up(), add the solution to show the port_id which is
still down
3. use check_link_up() in test cases

 tests/TestSuite_dual_vlan.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py
index 994ac42..d7fba3d 100644
--- a/tests/TestSuite_dual_vlan.py
+++ b/tests/TestSuite_dual_vlan.py
@@ -40,6 +40,7 @@ Test the support of Dual VLAN Offload Features by Poll Mode Drivers.
 import utils
 import random
 import re
+import time
 
 txvlan = 3
 outvlan = 1
@@ -182,6 +183,17 @@ class TestDualVlan(TestCase):
             else:
                 self.verify("%s %s" % (mode, modeName[mode]) in out, "%s setting error" % mode)
 
+    def verify_link_up(self):
+        ports = self.dut.get_ports(self.nic)
+        for port_id in range(len(ports)):
+            out = self.dut.send_expect("show port info %s" % port_id, "testpmd> ")
+            port_time_up = 0
+            while (port_time_up <= 10) and ("Link status: down" in out):
+                time.sleep(1)
+                out = self.dut.send_expect("show port info %s" % port_id, "testpmd> ")
+                port_time_up += 1
+                self.verify("Link status: down" not in out, "Port %s Link down, please check your link" % port_id)
+
     def multimode_test(self, caseIndex):
         """
         Setup Strip/Filter/Extend/Insert enable/disable for synthetic test.
@@ -200,6 +212,7 @@ class TestDualVlan(TestCase):
             self.dut.send_expect('tx_vlan set %s %s' % (dutTxPortId, txvlan), "testpmd> ")
             self.dut.send_expect('port start all', "testpmd> ")
             self.dut.send_expect('start', "testpmd> ")
+            self.verify_link_up()
 
         configMode = "Strip %s, filter %s 0x1, extend %s, insert %s" % (temp[0], temp[1], temp[2], "on" if (caseDef & txCase) != 0 else "off")
 
@@ -218,6 +231,7 @@ class TestDualVlan(TestCase):
                 self.dut.send_expect('tx_vlan reset %s' % dutTxPortId, "testpmd> ")
                 self.dut.send_expect('port start all', "testpmd> ")
                 self.dut.send_expect('start', "testpmd> ")
+                self.verify_link_up()
 
         else:
             self.dut.send_expect('rx_vlan add %s %s' % (invlan, dutRxPortId), "testpmd> ")
@@ -230,6 +244,7 @@ class TestDualVlan(TestCase):
                 self.dut.send_expect('tx_vlan reset %s' % dutTxPortId, "testpmd> ")
                 self.dut.send_expect('port start all', "testpmd> ")
                 self.dut.send_expect('start', "testpmd> ")
+                self.verify_link_up()
             self.dut.send_expect('rx_vlan rm %s %s' % (invlan, dutRxPortId), "testpmd> ")
             self.dut.send_expect('rx_vlan rm %s %s' % (outvlan, dutRxPortId), "testpmd> ")
 
@@ -364,6 +379,7 @@ class TestDualVlan(TestCase):
         self.dut.send_expect("tx_vlan set %s %s" % (dutTxPortId, txvlan), "testpmd> ")
         self.dut.send_expect("port start all", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
+        self.verify_link_up()
 
         self.vlan_send_packet()
         out = self.get_tcpdump_package()
@@ -374,6 +390,7 @@ class TestDualVlan(TestCase):
         self.dut.send_expect("tx_vlan reset %s" % dutTxPortId, "testpmd> ")
         self.dut.send_expect("port start all", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
+        self.verify_link_up()
 
         self.vlan_send_packet()
         out = self.get_tcpdump_package()
-- 
2.17.2

             reply	other threads:[~2019-01-24  2:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24  3:02 zhuwenhui [this message]
2019-01-24  6:14 ` Zhu, ShuaiX
2019-01-29  9:33 ` Tu, Lijuan

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=1548298961-26285-1-git-send-email-wenhuix.zhu@intel.com \
    --to=wenhuix.zhu@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).