test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] framework: add port config pci bus id check suites: seperated checksum_offload function and performance port requirements
Date: Thu,  5 Feb 2015 10:18:34 +0800	[thread overview]
Message-ID: <1423102714-21962-1-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1423032214-19856-1-git-send-email-yong.liu@intel.com>

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 conf/ports.cfg                      |  2 +-
 framework/config.py                 | 16 ++++++++++++++--
 framework/dut.py                    |  5 +++--
 tests/TestSuite_checksum_offload.py |  6 +++++-
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/conf/ports.cfg b/conf/ports.cfg
index 55e26d8..eb2cb34 100644
--- a/conf/ports.cfg
+++ b/conf/ports.cfg
@@ -5,5 +5,5 @@
 #     pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa 
 [DUT IP]
 ports = 
-    pci=XX:XX.X,intf=eth0
+    pci=XX:XX.X,intf=eth0;
     pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0
diff --git a/framework/config.py b/framework/config.py
index dc4f944..af014a8 100755
--- a/framework/config.py
+++ b/framework/config.py
@@ -33,6 +33,7 @@
 Generic port and crbs configuration file load function
 """
 
+import re
 import ConfigParser  # config parse module
 import argparse      # prase arguments module
 
@@ -46,6 +47,7 @@ class UserConf():
         self.port_config = port_conf
         self.crb_config = crb_conf
         self.ports_cfg = {}
+        self.pci_regex = "([\da-f]{2}:[\da-f]{2}.\d{1})$"
         try:
             self.port_conf = ConfigParser.SafeConfigParser()
             self.port_conf.read(self.port_config)
@@ -61,20 +63,30 @@ class UserConf():
                      for port in self.port_conf.get(crb, 'ports').split(';')]
 
         for port in ports:
-            port_cfg = self.parse_port_param(port)
+            port_cfg = self.__parse_port_param(port)
+            # check pci BDF validity
             if 'pci' not in port_cfg:
+                print "NOT FOUND CONFIG FOR NO PCI ADDRESS!!!"
+                continue
+            m = re.match(self.pci_regex, port_cfg['pci'])
+            if m is None:
                 print "INVALID CONFIG FOR NO PCI ADDRESS!!!"
+                continue
+
             keys = port_cfg.keys()
             keys.remove('pci')
             self.ports_cfg[port_cfg['pci']] = {key: port_cfg[key] for key in keys}
 
+    def get_ports_config(self):
+        return self.ports_cfg
+
     def check_port_available(self, pci_addr):
         if pci_addr in self.ports_cfg.keys():
             return True
         else:
             return False
 
-    def parse_port_param(self, port):
+    def __parse_port_param(self, port):
         portDict = dict()
 
         for param in port.split(','):
diff --git a/framework/dut.py b/framework/dut.py
index cddc248..e095d86 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -562,8 +562,9 @@ class Dut(Crb):
         """
         for port in self.ports_info:
             pci_bus = port['pci']
-            if pci_bus in self.conf.ports_cfg:
-                port_cfg = self.conf.ports_cfg[pci_bus]
+            ports_cfg = self.conf.get_ports_config()
+            if pci_bus in ports_cfg:
+                port_cfg = ports_cfg[pci_bus]
                 port_cfg['source'] = 'cfg'
             else:
                 port_cfg = {}
diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py
index 05438b2..e353aaa 100644
--- a/tests/TestSuite_checksum_offload.py
+++ b/tests/TestSuite_checksum_offload.py
@@ -54,7 +54,7 @@ class TestChecksumOffload(TestCase):
         Checksum offload prerequisites.
         """
         # Based on h/w type, choose how many ports to use
-        self.dut_ports = self.dut.get_ports_performance()
+        self.dut_ports = self.dut.get_ports()
 
         # Verify that enough ports are available
         self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
@@ -297,6 +297,10 @@ class TestChecksumOffload(TestCase):
         """
         Test checksum offload performance.
         """
+        self.dut_ports = self.dut.get_ports_performance()
+        # Verify that enough ports are available
+        self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
+
         # sizes = [64, 128, 256, 512, 1024]
         sizes = [64, 128]
         pkts = {
-- 
1.9.3

      parent reply	other threads:[~2015-02-05  2:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04  6:43 [dts] [PATCH v2 0/4] Support additional port configuration file Yong Liu
2015-02-04  6:43 ` [dts] [PATCH v2 1/4] framework: add new module for load " Yong Liu
2015-02-04  6:47   ` Qiu, Michael
2015-02-04  6:43 ` [dts] [PATCH v2 2/4] framework: execuction file support port config nic_type Yong Liu
2015-02-04  7:07   ` Qiu, Michael
2015-02-04  6:43 ` [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence Yong Liu
2015-02-04  6:59   ` Qiu, Michael
2015-02-04  6:43 ` [dts] [PATCH v2 4/4] suites: remove nic type check from testsuites Yong Liu
2015-02-04  6:50   ` Qiu, Michael
2015-02-05  1:32 ` [dts] [PATCH v2 0/4] Support additional port configuration file Liu, Yong
2015-02-05  2:18 ` Yong Liu [this message]

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=1423102714-21962-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).