test suite reviews and discussions
 help / color / mirror / Atom feed
From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH] framework tester: enhance check function with packets sequence check
Date: Tue, 25 Jul 2017 22:43:35 -0400	[thread overview]
Message-ID: <1501037015-39630-1-git-send-email-yong.liu@intel.com> (raw)

If enabled sequence check, packets check funtion will return error if
packets sequence is not correct.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/tester.py b/framework/tester.py
index feb6772..2bdd1ea 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -539,7 +539,7 @@ class Tester(Crb):
         print GREEN("Transmitting and sniffing packets, please wait few minutes...")
         send_f(intf=intf, pkts=pkts, interval=interval)
 
-    def check_random_pkts(self, portList, pktnum=2000, interval=0.01, allow_miss=True, params=None):
+    def check_random_pkts(self, portList, pktnum=2000, interval=0.01, allow_miss=True, seq_check=False, params=None):
         """
         Send several random packets and check rx packets matched
         """
@@ -610,6 +610,7 @@ class Tester(Crb):
             transmit_proc.join()
 
         # Verify all packets
+        prev_id = -1
         for txport, rxport in portList:
             recv_pkts = load_f(rx_inst[rxport])
 
@@ -638,6 +639,13 @@ class Tester(Crb):
                 else:
                     continue
 
+                if seq_check:
+                    if t_idx <= prev_id:
+                        print "Packet %d sequence not correct" % t_idx
+                        return False
+                    else:
+                        prev_id = t_idx
+
                 if compare_f(tx_pkts[txport][t_idx], recv_pkts[idx], "L4") is False:
                     print "Pkt recevied index %d not match original " \
                           "index %d" % (idx, t_idx)
-- 
1.9.3

                 reply	other threads:[~2017-07-26  2:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1501037015-39630-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@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).