test suite reviews and discussions
 help / color / mirror / Atom feed
From: Xiao Qimai <qimaix.xiao@intel.com>
To: dts@dpdk.org
Cc: Xiao Qimai <qimaix.xiao@intel.com>
Subject: [dts] [PATCH V1]framework/tester: add log info
Date: Thu, 20 Feb 2020 10:37:10 +0800	[thread overview]
Message-ID: <1582166230-118849-1-git-send-email-qimaix.xiao@intel.com> (raw)

*. add log info for tester when checking packets

Signed-off-by: Xiao Qimai <qimaix.xiao@intel.com>
---
 framework/tester.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/framework/tester.py b/framework/tester.py
index 427164e..a858081 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -689,7 +689,7 @@ class Tester(Crb):
         for txport, rxport in portList:
             txIntf = self.get_interface(txport)
             rxIntf = self.get_interface(rxport)
-            print(GREEN("Preparing transmit packets, please wait few minutes..."))
+            self.logger.info(GREEN("Preparing transmit packets, please wait few minutes..."))
             pkt = pkt_c()
             pkt.generate_random_pkts(pktnum=pktnum, random_type=random_type, ip_increase=True, random_payload=True,
                                      options={"layers_config": params})
@@ -712,7 +712,7 @@ class Tester(Crb):
             for i in filenames:
                 flag = self.send_expect('ps -ef |grep %s|grep -v grep' % i, expected='# ')
                 if flag:
-                    print('wait for the completion of sending pkts...')
+                    self.logger.info('wait for the completion of sending pkts...')
                     sleep(1.5)
                     continue
         prev_id = -1
@@ -721,13 +721,13 @@ class Tester(Crb):
             recv_pkts = p.pktgen.pkts
             # only report when received number not matched
             if len(tx_pkts[txport].pktgen.pkts) > len(recv_pkts):
-                print(("Pkt number not matched,%d sent and %d received\n" % (
+                self.logger.info(("Pkt number not matched,%d sent and %d received\n" % (
                 len(tx_pkts[txport].pktgen.pkts), len(recv_pkts))))
                 if allow_miss is False:
                     return False
 
             # check each received packet content
-            print(GREEN("Comparing sniffed packets, please wait few minutes..."))
+            self.logger.info(GREEN("Comparing sniffed packets, please wait few minutes..."))
             for idx in range(len(recv_pkts)):
                 try:
                     l3_type = p.strip_element_layer2('type', p_index=idx)
@@ -745,16 +745,16 @@ class Tester(Crb):
 
                 if seq_check:
                     if t_idx <= prev_id:
-                        print("Packet %d sequence not correct" % t_idx)
+                        self.logger.info("Packet %d sequence not correct" % t_idx)
                         return False
                     else:
                         prev_id = t_idx
 
                 if compare_f(tx_pkts[txport].pktgen.pkts[t_idx], recv_pkts[idx], "L4") is False:
-                    print("Pkt received index %d not match original " \
+                    self.logger.warning("Pkt received index %d not match original " \
                           "index %d" % (idx, t_idx))
-                    print("Sent: %s" % strip_f(tx_pkts[txport].pktgen.pkts[t_idx], "L4"))
-                    print("Recv: %s" % strip_f(recv_pkts[idx], "L4"))
+                    self.logger.info("Sent: %s" % strip_f(tx_pkts[txport].pktgen.pkts[t_idx], "L4"))
+                    self.logger.info("Recv: %s" % strip_f(recv_pkts[idx], "L4"))
                     return False
 
         return True
-- 
1.8.3.1


             reply	other threads:[~2020-02-20  2:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  2:37 Xiao Qimai [this message]
2020-02-21  2:03 ` 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=1582166230-118849-1-git-send-email-qimaix.xiao@intel.com \
    --to=qimaix.xiao@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).