test suite reviews and discussions
 help / color / mirror / Atom feed
From: "xu,huilong" <huilongx.xu@intel.com>
To: dts@dpdk.org
Cc: "xu,huilong" <huilongx.xu@intel.com>
Subject: [dts] [patch V2 2/2] used check_tx_bytes for check tx_bytes in test case
Date: Thu, 12 Jan 2017 16:46:57 +0800	[thread overview]
Message-ID: <1484210817-42185-2-git-send-email-huilongx.xu@intel.com> (raw)
In-Reply-To: <1484210817-42185-1-git-send-email-huilongx.xu@intel.com>

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

  reply	other threads:[~2017-01-12  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-01-16  2:28 ` Liu, Yong

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=1484210817-42185-2-git-send-email-huilongx.xu@intel.com \
    --to=huilongx.xu@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).