test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes
@ 2017-01-12  8:46 xu,huilong
  2017-01-12  8:46 ` [dts] [patch V2 2/2] used check_tx_bytes for check tx_bytes in test case xu,huilong
  2017-01-16  2:28 ` [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes Liu, Yong
  0 siblings, 2 replies; 3+ messages in thread
From: xu,huilong @ 2017-01-12  8:46 UTC (permalink / raw)
  To: dts; +Cc: xu,huilong

changlist:
1. add PROTOCOL_PACKET_SIZE value in setting mode
2. add check_tx_bytes function in testpmd output mode

Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
 framework/pmd_output.py | 10 ++++++++--
 framework/settings.py   |  7 ++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/framework/pmd_output.py b/framework/pmd_output.py
index d982c89..13dcaef 100644
--- a/framework/pmd_output.py
+++ b/framework/pmd_output.py
@@ -31,7 +31,7 @@
 
 import os
 import re
-from settings import TIMEOUT
+from settings import TIMEOUT,PROTOCOL_PACKET_SIZE
 from utils import create_mask
 
 
@@ -192,7 +192,13 @@ class PmdOutput():
         Get the allmulticast mode of port.
         """
         return self.get_detail_from_port_info("Allmulticast mode: ", "\S+", port_id)
-
+    def check_tx_bytes(self, tx_bytes, exp_bytes = 0):
+        """
+        fortville nic will send lldp packet when nic setup with testpmd.
+        so should used (tx_bytes - exp_bytes) % PROTOCOL_PACKET_SIZE['lldp']
+        for check tx_bytes count right
+        """
+        return not (tx_bytes - exp_bytes) % PROTOCOL_PACKET_SIZE['lldp']
     def get_port_vlan_offload(self, port_id):
         """
         Function: get the port vlan settting info.
diff --git a/framework/settings.py b/framework/settings.py
index df2a491..acffa34 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -161,7 +161,12 @@ HEADER_SIZE = {
     'tcp': 20,
     'vxlan': 8,
 }
-
+"""
+dpdk send protocol packet size.
+"""
+PROTOCOL_PACKET_SIZE = {
+    'lldp': 110,
+}
 
 """
 Default session timeout.
-- 
1.9.3

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

* [dts] [patch V2 2/2] used check_tx_bytes for check tx_bytes in test case
  2017-01-12  8:46 [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes xu,huilong
@ 2017-01-12  8:46 ` xu,huilong
  2017-01-16  2:28 ` [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes Liu, Yong
  1 sibling, 0 replies; 3+ messages in thread
From: xu,huilong @ 2017-01-12  8:46 UTC (permalink / raw)
  To: dts; +Cc: xu,huilong

Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
 tests/TestSuite_jumboframes.py  |  5 ++++-
 tests/TestSuite_pmd.py          |  4 ++--
 tests/TestSuite_shutdown_api.py | 15 +++++++++------
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/tests/TestSuite_jumboframes.py b/tests/TestSuite_jumboframes.py
index 58f2e17..bc6e70d 100644
--- a/tests/TestSuite_jumboframes.py
+++ b/tests/TestSuite_jumboframes.py
@@ -39,6 +39,7 @@ import re
 from time import sleep
 from test_case import TestCase
 from pmd_output import PmdOutput
+from settings import PROTOCOL_PACKET_SIZE
 
 ETHER_HEADER_LEN = 18
 IP_HEADER_LEN = 20
@@ -93,7 +94,9 @@ class TestJumboframes(TestCase):
         rx_err -= rx_err_ori
 
         if received:
-            self.verify((tx_pkts == rx_pkts) and ((tx_bytes + 4) == pktsize) and ((rx_bytes + 4) == pktsize),
+            self.verify(self.pmdout.check_tx_bytes(tx_pkts, rx_pkts) 
+                         and ( self.pmdout.check_tx_bytes(tx_bytes + 4, pktsize )) 
+                         and ((rx_bytes + 4) == pktsize),
                         "packet pass assert error")
         else:
             #self.verify(p0tx_pkts == p1rx_pkts and (p1rx_err == 1 or p1rx_pkts == 0),
diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index 7b9e6b5..bc59849 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -364,13 +364,13 @@ class TestPmd(TestCase,IxiaPacketGenerator):
 
         time.sleep(5)
 
-        self.verify(p0tx_pkts == p1rx_pkts,
+        self.verify(self.pmdout.check_tx_bytes(p0tx_pkts, p1rx_pkts),
                     "packet pass assert error, %d RX packets, %d TX packets" % (p1rx_pkts, p0tx_pkts))
 
         self.verify(p1rx_bytes == frame_size - 4,
                     "packet pass assert error, expected %d RX bytes, actual %d" % (frame_size - 4, p1rx_bytes))
 
-        self.verify(p0tx_bytes == frame_size - 4,
+        self.verify(self.pmdout.check_tx_bytes(p0tx_bytes, frame_size - 4),
                     "packet pass assert error, expected %d TX bytes, actual %d" % (frame_size - 4, p0tx_bytes))
 
         return out
diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py
index 3dbacf2..66219f5 100644
--- a/tests/TestSuite_shutdown_api.py
+++ b/tests/TestSuite_shutdown_api.py
@@ -42,7 +42,7 @@ import re
 import os
 from test_case import TestCase
 from pmd_output import PmdOutput
-from settings import HEADER_SIZE
+from settings import HEADER_SIZE, PROTOCOL_PACKET_SIZE
 from exception import VerifyFailure
 
 #
@@ -149,14 +149,17 @@ class TestShutdownApi(TestCase):
             if vlan is True:
                 # vlan strip default is on
                 tx_bytes_exp -= 4
-
+         
+        # fortville nic enable send lldp packet function when port setup
+        # now the tx-packets size is lldp_size(110) * n + forward packe size
+        # so use (tx-packets - forward packet size) % lldp_size, if it is 0, it means forward packet size right
+ 
         if received:
-            self.verify(p0tx_pkts == p1rx_pkts, "Wrong TX pkts p0_tx=%d, p1_rx=%d" % (p0tx_pkts, p1rx_pkts))
+            self.verify(self.pmdout.check_tx_bytes(p0tx_pkts, p1rx_pkts), "Wrong TX pkts p0_tx=%d, p1_rx=%d" % (p0tx_pkts, p1rx_pkts))
             self.verify(p1rx_bytes == rx_bytes_exp, "Wrong Rx bytes p1_rx=%d, expect=%d" % (p1rx_bytes, rx_bytes_exp))
-            self.verify(p0tx_bytes == tx_bytes_exp, "Wrong Tx bytes p0_tx=%d, expect=%d" % (p0tx_bytes, tx_bytes_exp))
+            self.verify(self.pmdout.check_tx_bytes(p0tx_bytes, tx_bytes_exp) , "Wrong Tx bytes p0_tx=%d, expect=%d" % (p0tx_bytes, tx_bytes_exp))
         else:
-            self.verify(p0tx_pkts == 0, "Packet not dropped p0tx_pkts=%d" % p0tx_pkts)
-            self.verify(p0tx_bytes == 0, "Packet not dropped p0tx_bytes=%d" % p0tx_bytes)
+            self.verify(self.pmdout.check_tx_bytes(p0tx_pkts), "Packet not dropped p0tx_pkts=%d" % p0tx_pkts)
 
     def check_ports(self, status=True):
         """
-- 
1.9.3

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

* Re: [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes
  2017-01-12  8:46 [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes xu,huilong
  2017-01-12  8:46 ` [dts] [patch V2 2/2] used check_tx_bytes for check tx_bytes in test case xu,huilong
@ 2017-01-16  2:28 ` Liu, Yong
  1 sibling, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2017-01-16  2:28 UTC (permalink / raw)
  To: Xu, HuilongX, dts; +Cc: Xu, HuilongX

Thanks, applied into master branch. Please add more description for the background in next time.
The commit log will help us get to known the tricky thing in DPDK.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,huilong
> Sent: Thursday, January 12, 2017 4:47 PM
> To: dts@dpdk.org
> Cc: Xu, HuilongX <huilongx.xu@intel.com>
> Subject: [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd
> tx_bytes
> 
> changlist:
> 1. add PROTOCOL_PACKET_SIZE value in setting mode 2. add check_tx_bytes
> function in testpmd output mode
> 
> Signed-off-by: xu,huilong <huilongx.xu@intel.com>

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

end of thread, other threads:[~2017-01-16  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12  8:46 [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes xu,huilong
2017-01-12  8:46 ` [dts] [patch V2 2/2] used check_tx_bytes for check tx_bytes in test case xu,huilong
2017-01-16  2:28 ` [dts] [patch V2 1/2] add check_tx_bytes function for check testpmd tx_bytes Liu, Yong

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).