test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1]framework/tester: add log info
@ 2020-02-20  2:37 Xiao Qimai
  2020-02-21  2:03 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Xiao Qimai @ 2020-02-20  2:37 UTC (permalink / raw)
  To: dts; +Cc: Xiao Qimai

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


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

* Re: [dts] [PATCH V1]framework/tester: add log info
  2020-02-20  2:37 [dts] [PATCH V1]framework/tester: add log info Xiao Qimai
@ 2020-02-21  2:03 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2020-02-21  2:03 UTC (permalink / raw)
  To: Xiao, QimaiX, dts; +Cc: Xiao, QimaiX

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xiao Qimai
> Sent: Thursday, February 20, 2020 10:37 AM
> To: dts@dpdk.org
> Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: [dts] [PATCH V1]framework/tester: add log info
> 
> *. 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


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

end of thread, other threads:[~2020-02-21  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20  2:37 [dts] [PATCH V1]framework/tester: add log info Xiao Qimai
2020-02-21  2:03 ` 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).