test suite reviews and discussions
 help / color / mirror / Atom feed
From: michael.luo@intel.com
To: dts@dpdk.org
Subject: [dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet size from xstats
Date: Wed,  6 Mar 2019 15:19:12 +0800	[thread overview]
Message-ID: <1551856752-16081-1-git-send-email-michael.luo@intel.com> (raw)

From: Luo Gaoliang <michael.luo@intel.com>

Detecting the categories of packet size from xstats to test the
case test_based_size instead of using the hardcoded sizes. Because different
NICs may categorize the big packets differently. For example, a 1024Byte packet,
Niantic counts it into rx_size_1024_to_max_packets, but Fortville puts it into
tx_size_1024_to_1522_packets.

Signed-off-by: Luo Gaoliang <michael.luo@intel.com>
---
 tests/TestSuite_vhost_pmd_xstats.py | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/tests/TestSuite_vhost_pmd_xstats.py b/tests/TestSuite_vhost_pmd_xstats.py
index e33b342..db59f48 100755
--- a/tests/TestSuite_vhost_pmd_xstats.py
+++ b/tests/TestSuite_vhost_pmd_xstats.py
@@ -158,21 +158,14 @@ class TestVhostPmdXstats(TestCase):
         Verify receiving and transmitting packets correctly in the Vhost PMD xstats
         """
         self.prepare_start()
-        sizes = [64, 65, 128, 256, 513, 1025]
-        scope = ''
-        for pktsize in sizes:
-            if pktsize == 64:
-                scope = 'size_64'
-            elif 65 <= pktsize <= 127:
-                scope = 'size_65_to_127'
-            elif 128 <= pktsize <= 255:
-                scope = 'size_128_to_255'
-            elif 256 <= pktsize <= 511:
-                scope = 'size_256_to_511'
-            elif 512 <= pktsize <= 1023:
-                scope = 'size_512_to_1023'
-            elif 1024 <= pktsize:
-                scope = 'size_1024_to_max'
+        out = self.dut.send_expect(
+            "show port xstats %s" % self.dut_ports[0], "testpmd>", 60)
+        p = re.compile(r'rx_size_[0-9]+_[to_\w+]*packets')
+        categories = p.findall(out)
+        self.verify(len(categories) > 0, 'Unable to find the categories of RX packet size!')
+        for cat in categories:
+            scope = re.search(r'(?<=rx_)\w+(?=_packets)', cat).group(0)
+            pktsize = int(re.search(r'(?<=rx_size_)\d+', cat).group(0))
 
             self.scapy_send_packet(pktsize, self.dmac, 10000)
             self.send_verify(scope, 10000)
-- 
2.7.4

             reply	other threads:[~2019-03-06  7:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06  7:19 michael.luo [this message]
2019-03-07 10:35 ` 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=1551856752-16081-1-git-send-email-michael.luo@intel.com \
    --to=michael.luo@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).