test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet size from xstats
@ 2019-03-06  7:19 michael.luo
  2019-03-07 10:35 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: michael.luo @ 2019-03-06  7:19 UTC (permalink / raw)
  To: dts

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

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

* Re: [dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet size from xstats
  2019-03-06  7:19 [dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet size from xstats michael.luo
@ 2019-03-07 10:35 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2019-03-07 10:35 UTC (permalink / raw)
  To: Luo, Michael, dts

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of michael.luo@intel.com
> Sent: Wednesday, March 6, 2019 3:19 PM
> To: dts@dpdk.org
> Subject: [dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet
> size from xstats
> 
> 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

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

end of thread, other threads:[~2019-03-07 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06  7:19 [dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet size from xstats michael.luo
2019-03-07 10:35 ` 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).