test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] tests: optimize two suites
@ 2019-11-22 15:43 Wenjie Li
  2019-11-27  9:03 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Wenjie Li @ 2019-11-22 15:43 UTC (permalink / raw)
  To: dts; +Cc: Wenjie Li

ensure the DUT port is up before the tester send packets in below suites:
  tests/TestSuite_metering_and_policing.py
  tests/TestSuite_short_live.py

Signed-off-by: Wenjie Li <wenjiex.a.li@intel.com>
---
 tests/TestSuite_metering_and_policing.py |  8 ++++++--
 tests/TestSuite_short_live.py            | 12 ++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_metering_and_policing.py b/tests/TestSuite_metering_and_policing.py
index 77da805..ef8c419 100644
--- a/tests/TestSuite_metering_and_policing.py
+++ b/tests/TestSuite_metering_and_policing.py
@@ -42,7 +42,7 @@ from test_case import TestCase
 from plotting import Plotting
 from settings import HEADER_SIZE
 from dut import Dut
-
+from pmd_output import PmdOutput
 
 class TestMeteringAndPolicing(TestCase):
     scapyCmds = []
@@ -244,7 +244,11 @@ class TestMeteringAndPolicing(TestCase):
         """
         Send packet and check the stats. If expect_port == -1, the packet should be dropped.
         """
-        time.sleep(3)
+        # check the ports are UP before sending packets
+        self.pmd_out = PmdOutput(self.dut)
+        res = self.pmd_out.wait_link_status_up('all', 30)
+        self.verify(res is True, 'there have port link is down')
+
         rx_before = []
         tx_before = []
         for i in range(0, len(self.dut_ports)):
diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py
index 4e1ee15..dfccbd8 100644
--- a/tests/TestSuite_short_live.py
+++ b/tests/TestSuite_short_live.py
@@ -141,6 +141,12 @@ class TestShortLiveApp(TestCase):
         self.dut.send_expect("set fwd mac", "testpmd>")
         self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("start", "testpmd>")
+
+        # check the ports are UP before sending packets
+        self.pmd_out = PmdOutput(self.dut)
+        res = self.pmd_out.wait_link_status_up('all', 30)
+        self.verify(res is True, 'there have port link is down')
+
         self.check_forwarding([0, 1], self.nic)
 
     def test_start_up_time(self):
@@ -166,6 +172,12 @@ class TestShortLiveApp(TestCase):
             self.dut.send_expect("set fwd mac", "testpmd>")
             self.dut.send_expect("set promisc all off", "testpmd>")
             self.dut.send_expect("start", "testpmd>")
+
+            # check the ports are UP before sending packets
+            self.pmd_out = PmdOutput(self.dut)
+            res = self.pmd_out.wait_link_status_up('all', 30)
+            self.verify(res is True, 'there have port link is down')
+
             self.check_forwarding([0, 1], self.nic)
 
             # kill with different Signal
-- 
2.17.1


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

end of thread, other threads:[~2019-11-27  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 15:43 [dts] [PATCH V1] tests: optimize two suites Wenjie Li
2019-11-27  9:03 ` 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).