test suite reviews and discussions
 help / color / mirror / Atom feed
From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: lijuan.tu@intel.com, dts@dpdk.org
Cc: Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [PATCH V1 2/2] framework/pmd_output: add -a support in split_eal_param
Date: Mon,  7 Dec 2020 17:53:02 +0800	[thread overview]
Message-ID: <20201207095302.2133-3-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20201207095302.2133-1-haiyangx.zhao@intel.com>

add -a support and optmize the regular expression.

Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
 framework/pmd_output.py | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/framework/pmd_output.py b/framework/pmd_output.py
index 6557f9c..9dc6d3b 100644
--- a/framework/pmd_output.py
+++ b/framework/pmd_output.py
@@ -109,11 +109,14 @@ class PmdOutput():
         :param eal_param:
         :return:
         """
-        re_w_pci_str = '\s?-w\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s|\s?-w\\s+.+?:.+?\\..+?[,.*=\d+]?\s'
+        re_w_pci_str = '\s?-[w,a]\s+\w*:?[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}.[A-Fa-f0-9]{1},.*=\d+' \
+                       '|\s?-[w,a]\s+\w*:?[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}.[A-Fa-f0-9]{1}'
         re_file_prefix_str = '--file-prefix[\s*=]\S+\s'
-        re_b_pci_str = '\s?-b\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s|\s?-b\\s+.+?:.+?\\..+?[,.*=\d+]?\s'
+        re_b_pci_str = '\s?-b\s+\w*:?[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}.[A-Fa-f0-9]{1},.*=\d+' \
+                       '|\s?-b\s+\w*:?[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}.[A-Fa-f0-9]{1}'
         eal_param = eal_param + ' '
-        # pci_str_list eg: ['-w   0000:1a:00.0 ', '-w 0000:1a:00.1,queue-num-per-vf=4 ', '-w 0000:aa:bb.1,queue-num-per-vf=4 ']
+        # pci_str_list eg: ['-w   0000:1a:00.0 ', '-w 0000:1a:00.1,queue-num-per-vf=4 ', '-w 0000:aa:bb.1,queue-num-per-vf=4 ',
+        #                   '-a   0000:1a:00.0 ', '-a 0000:1a:00.1,queue-num-per-vf=4 ', '-a 0000:aa:bb.1,queue-num-per-vf=4 ']
         w_pci_str_list = re.findall(re_w_pci_str, eal_param)
         # file_prefix_str eg: ['--file-prefix=dpdk ']
         file_prefix_str = re.findall(re_file_prefix_str, eal_param)
@@ -123,13 +126,13 @@ class PmdOutput():
         if w_pci_str_list:
             for pci_str in w_pci_str_list:
                 # has pci options
-                if ',' in pci_str:
-                    pci_option = pci_str.split(',')
-                    pci = pci_option[0].split(' ')[-1]
-                    has_pci_option[pci] = pci_option[1].strip()
-                    pci_list.append(pci)
+                pci_str_options = pci_str.split('-w ') if '-w ' in pci_str else pci_str.split('-a ')
+                if ',' in pci_str_options[-1]:
+                    pci_option = pci_str_options[-1].split(',')
+                    has_pci_option[pci_option[0]] = pci_option[1].strip()
+                    pci_list.append(pci_option[0])
                 else:
-                    pci_list.append(pci_str.split('-w')[-1].strip())
+                    pci_list.append(pci_str_options[-1])
 
         b_pci_list = []
         if b_pci_str_list:
-- 
2.17.1


  parent reply	other threads:[~2020-12-07  9:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  9:53 [dts] [PATCH V1 0/2] framework: add -a option support in eal param Haiyang Zhao
2020-12-07  9:53 ` [dts] [PATCH V1 1/2] framework/dut: add -a support in create_eal_parameters Haiyang Zhao
2020-12-07  9:53 ` Haiyang Zhao [this message]
2020-12-07 10:02 ` [dts] [PATCH V1 0/2] framework: add -a option support in eal param Zhao, HaiyangX
2020-12-10  8:39 ` 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=20201207095302.2133-3-haiyangx.zhao@intel.com \
    --to=haiyangx.zhao@intel.com \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@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).