test suite reviews and discussions
 help / color / mirror / Atom feed
From: Wenjie Li <wenjiex.a.li@intel.com>
To: dts@dpdk.org
Cc: Wenjie Li <wenjiex.a.li@intel.com>
Subject: [dts] [PATCH V1] tests: optimize three suites
Date: Mon, 11 Nov 2019 17:18:55 +0000	[thread overview]
Message-ID: <1573492735-54128-1-git-send-email-wenjiex.a.li@intel.com> (raw)

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
  tests/TestSuite_tx_preparation.py

Signed-off-by: Wenjie Li <wenjiex.a.li@intel.com>
---
 tests/TestSuite_metering_and_policing.py |  8 ++++++--
 tests/TestSuite_short_live.py            | 12 ++++++++++++
 tests/TestSuite_tx_preparation.py        |  5 +++++
 3 files changed, 23 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', 15)
+        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', 15)
+        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', 15)
+            self.verify(res is True, 'there have port link is down')
+
             self.check_forwarding([0, 1], self.nic)
 
             # kill with different Signal
diff --git a/tests/TestSuite_tx_preparation.py b/tests/TestSuite_tx_preparation.py
index 366a547..90ab7b6 100644
--- a/tests/TestSuite_tx_preparation.py
+++ b/tests/TestSuite_tx_preparation.py
@@ -116,6 +116,11 @@ class TestTX_preparation(TestCase):
         """
         Send packet to portid and output
         """
+        # check the ports are UP before sending packets
+        self.pmd_out = PmdOutput(self.dut)
+        res = self.pmd_out.wait_link_status_up('all', 15)
+        self.verify(res is True, 'there have port link is down')
+
         LrgLength = random.randint(Normal_mtu, Max_mtu-100)
         pkts = {'IPv4/cksum TCP': 'Ether(dst="%s")/IP()/TCP(flags=0x10)\
                     /Raw(RandString(50))' % self.dmac,
-- 
2.17.1


             reply	other threads:[~2019-11-11  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 17:18 Wenjie Li [this message]
2019-11-11  8:34 ` Li, WenjieX A
2019-11-22  6:21 ` 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=1573492735-54128-1-git-send-email-wenjiex.a.li@intel.com \
    --to=wenjiex.a.li@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).