test suite reviews and discussions
 help / color / mirror / Atom feed
From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org, lihongx.ma@intel.com
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V1 2/2] test/vxlan_sample: python3 support
Date: Thu, 13 Feb 2020 14:28:16 +0800	[thread overview]
Message-ID: <20200213062816.80145-3-yufengx.mo@intel.com> (raw)
In-Reply-To: <20200213062816.80145-1-yufengx.mo@intel.com>


python3 support.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 tests/TestSuite_vxlan_sample.py | 42 ++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/tests/TestSuite_vxlan_sample.py b/tests/TestSuite_vxlan_sample.py
index 7d4be40..df9d3a6 100644
--- a/tests/TestSuite_vxlan_sample.py
+++ b/tests/TestSuite_vxlan_sample.py
@@ -202,11 +202,11 @@ class TestVxlanSample(TestCase):
             if self.vm_dut is None:
                 raise Exception("Set up VM ENV failed!")
         except Exception as e:
-            print(utils.RED("Failure for %s" % str(e)))
+            self.logger.error("Failure for %s" % str(e))
 
         # create another vm
         if vm_num == 2:
-            print("not implemented now")
+            self.logger.warning("not implemented now")
 
         return True
 
@@ -303,11 +303,11 @@ class TestVxlanSample(TestCase):
                     self.verify(ord(payload[i]) == 88, "Check udp data failed")
             except:
                 case_pass = False
-                print(utils.RED("Failure in checking packet payload"))
+                self.logger.error("Failure in checking packet payload")
 
             if case_pass:
-                print(utils.GREEN("Check normal udp packet forward pass on "
-                                "virtIO port %d" % vf_id))
+                self.logger.info("Check normal udp packet forward pass on "
+                                "virtIO port %d" % vf_id)
 
         if pkt_type == "vxlan_udp_decap":
             # create vxlan packet pf mac + vni=1000 + inner virtIO port0 mac
@@ -338,11 +338,11 @@ class TestVxlanSample(TestCase):
                     self.verify(ord(payload[i]) == 88, "Check udp data failed")
             except:
                 case_pass = False
-                print(utils.RED("Failure in checking packet payload"))
+                self.logger.error("Failure in checking packet payload")
 
             if case_pass:
-                print(utils.GREEN("Check vxlan packet decap pass on virtIO port"
-                                " %d" % vf_id))
+                self.logger.info("Check vxlan packet decap pass on virtIO port"
+                                " %d" % vf_id)
 
         if pkt_type == "vxlan_udp":
             # create vxlan packet pf mac + vni=1000 + inner virtIO port0 mac
@@ -373,11 +373,11 @@ class TestVxlanSample(TestCase):
                     self.verify(ord(payload[i]) == 88, "Check udp data failed")
             except:
                 case_pass = False
-                print(utils.RED("Failure in checking packet payload"))
+                self.logger.error("Failure in checking packet payload")
 
             if case_pass:
-                print(utils.GREEN("Check vxlan packet decap and encap pass on "
-                                "virtIO port %d" % vf_id))
+                self.logger.info("Check vxlan packet decap and encap pass on "
+                                "virtIO port %d" % vf_id)
 
         if pkt_type == "vxlan_udp_chksum":
             params['inner_l4_type'] = 'UDP'
@@ -396,7 +396,7 @@ class TestVxlanSample(TestCase):
             vxlan_pkt = VxlanTestConfig(self, **params)
             vxlan_pkt.create_pcap()
             chksums_ref = vxlan_pkt.get_chksums()
-            print(utils.GREEN("Checksum reference: %s" % chksums_ref))
+            self.logger.info("Checksum reference: %s" % chksums_ref)
 
             params['inner_ip_invalid'] = 1
             params['inner_l4_invalid'] = 1
@@ -419,14 +419,14 @@ class TestVxlanSample(TestCase):
             pk_new.pktgen.assign_pkt(pkts)
             pk_new.pktgen.update_pkts()
             chksums = vxlan_pkt.get_chksums(pk_new)
-            print(utils.GREEN("Checksum : %s" % chksums))
+            self.logger.info("Checksum : %s" % chksums)
             for key in chksums_ref:
                 if 'inner' in key:  # only check inner packet chksum
                     self.verify(chksums[key] == chksums_ref[key],
                                 "%s not matched to %s"
                                 % (key, chksums_ref[key]))
 
-            print(utils.GREEN("%s checksum pass" % params['inner_l4_type']))
+            self.logger.info("%s checksum pass" % params['inner_l4_type'])
 
         if pkt_type == "vxlan_tcp_tso":
             # create vxlan packet pf mac + vni=1000 + inner virtIO port0 mac +
@@ -459,15 +459,15 @@ class TestVxlanSample(TestCase):
                 del inner.chksum
                 inner[IP] = inner[IP].__class__(str(inner[IP]))
                 inner_ip_chksum_ref = inner[IP].chksum
-                print(utils.GREEN("inner ip checksum reference: %x" % inner_ip_chksum_ref))
-                print(utils.GREEN("inner ip checksum: %x" % inner_ip_chksum))
+                self.logger.info("inner ip checksum reference: %x" % inner_ip_chksum_ref)
+                self.logger.info("inner ip checksum: %x" % inner_ip_chksum)
                 self.verify(inner_ip_chksum == inner_ip_chksum_ref, "inner ip checksum error")
                 inner_l4_chksum = inner[params['inner_l4_type']].chksum
                 del inner[params['inner_l4_type']].chksum
                 inner[params['inner_l4_type']] = inner[params['inner_l4_type']].__class__(str(inner[params['inner_l4_type']]))
                 inner_l4_chksum_ref =  inner[params['inner_l4_type']].chksum
-                print(utils.GREEN("inner l4 checksum reference: %x" % inner_l4_chksum_ref))
-                print(utils.GREEN("inner l4 checksum: %x" % inner_l4_chksum))
+                self.logger.info("inner l4 checksum reference: %x" % inner_l4_chksum_ref)
+                self.logger.info("inner l4 checksum: %x" % inner_l4_chksum)
                 self.verify(inner_l4_chksum == inner_l4_chksum_ref, "inner %s checksum error" % params['inner_l4_type'])
 
             length = 0
@@ -481,12 +481,12 @@ class TestVxlanSample(TestCase):
                     length += len(payload)
                 except:
                     case_pass = False
-                    print(utils.RED("Failure in checking tso payload"))
+                    self.logger.error("Failure in checking tso payload")
 
             self.verify(length == 892, "Total tcp payload size not match")
             if case_pass:
-                print(utils.GREEN("Vxlan packet tso pass on virtIO port %d"
-                                % vf_id))
+                self.logger.info("Vxlan packet tso pass on virtIO port %d"
+                                % vf_id)
 
     def test_perf_vxlan_sample(self):
         # vxlan payload length for performance test
-- 
2.21.0


  parent reply	other threads:[~2020-02-13  6:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  6:28 [dts] [PATCH V1 0/2] tests: " yufengmx
2020-02-13  6:28 ` [dts] [PATCH V1 1/2] test/iavf: " yufengmx
2020-02-13 10:31   ` Tu, Lijuan
2020-02-13  6:28 ` yufengmx [this message]
2020-02-13 10:31   ` [dts] [PATCH V1 2/2] test/vxlan_sample: " 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=20200213062816.80145-3-yufengx.mo@intel.com \
    --to=yufengx.mo@intel.com \
    --cc=dts@dpdk.org \
    --cc=lihongx.ma@intel.com \
    /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).