test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd
@ 2020-12-23  8:24 Haiyang Zhao
  2020-12-23  8:24 ` [dts] [PATCH V1 1/2] framework/pmd_output: " Haiyang Zhao
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Haiyang Zhao @ 2020-12-23  8:24 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Haiyang Zhao

this patchset fixed the bug reconfignizing eal param
like "-a af:00.0,representor=0-1" failed, and optmized
the eal parameter reassmeble method.

replaced "-w" with "-a" in create_eal_parameters.

Haiyang Zhao (2):
  framework/pmd_output: fix a bug in start_testpmd
  framework/dut: replace "-w" with "-a"

 framework/dut.py        |   3 +-
 framework/pmd_output.py | 107 +++++++++++++---------------------------
 2 files changed, 36 insertions(+), 74 deletions(-)

-- 
2.17.1


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

* [dts] [PATCH V1 1/2] framework/pmd_output: fix a bug in start_testpmd
  2020-12-23  8:24 [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Haiyang Zhao
@ 2020-12-23  8:24 ` Haiyang Zhao
  2020-12-23  8:24 ` [dts] [PATCH V1 2/2] framework/dut: replace "-w" with "-a" Haiyang Zhao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Haiyang Zhao @ 2020-12-23  8:24 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Haiyang Zhao

the regular expression in split_eal_param can not recognize the eal param
like "-a af:00.0,representor=0-1", this patch fixed this bug and optimized
the eal parameter reassmeble method.

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

diff --git a/framework/pmd_output.py b/framework/pmd_output.py
index 9dc6d3b4..f4ea6670 100644
--- a/framework/pmd_output.py
+++ b/framework/pmd_output.py
@@ -103,87 +103,48 @@ class PmdOutput():
     def get_pmd_cmd(self):
         return self.command
 
-    def split_eal_param(self, eal_param):
-        """
-        split eal param from test suite
-        :param eal_param:
-        :return:
-        """
-        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+\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 ',
-        #                   '-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)
-        b_pci_str_list = re.findall(re_b_pci_str, eal_param)
-        has_pci_option = {}
-        pci_list = []
-        if w_pci_str_list:
-            for pci_str in w_pci_str_list:
-                # has pci options
-                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_options[-1])
-
-        b_pci_list = []
-        if b_pci_str_list:
-            for b_pci in b_pci_str_list:
-                tmp = b_pci.split('-b')[1].strip()
-                b_pci_list.append(tmp)
-
-        file_prefix = ''
+    def start_testpmd(self, cores='default', param='', eal_param='', socket=0, fixed_prefix=False, **config):
+        """
+        start testpmd with input parameters.
+        :param cores: eg:
+                cores='default'
+                cores='1S/4C/1T'
+        :param param: dpdk application (testpmd) parameters
+        :param eal_param: user defined DPDK eal parameters, eg:
+                eal_param='-a af:00.0 -a af:00.1,proto_xtr=vlan',
+                eal_param='-b af:00.0 --file-prefix=vf0',
+                eal_param='--no-pci',
+        :param socket: physical CPU socket index
+        :param fixed_prefix: use fixed file-prefix or not, when it is true,
+               the file-prefix will not be added a timestamp
+        :param config: kwargs user defined eal parameters, eg:
+                set PCI allow list: ports=[0,1], port_options={0: "proto_xtr=vlan"},
+                set PCI block list: b_ports=['0000:1a:00.0'],
+                disable PCI: no_pci=True,
+                add virtual device: vdevs=['net_vhost0,iface=vhost-net,queues=1']
+        :return: output of launching testpmd
+        """
+        eal_param = ' ' + eal_param + ' '
+        eal_param = eal_param.replace(' -w ', ' -a ')
+        re_file_prefix = '--file-prefix[\s*=]\S+\s'
+        file_prefix_str = re.findall(re_file_prefix, eal_param)
         if file_prefix_str:
             tmp = re.split('(=|\s+)', file_prefix_str[-1].strip())
             file_prefix = tmp[-1].strip()
+            config['prefix'] = file_prefix
+        eal_param = re.sub(re_file_prefix, '', eal_param)
 
-        other_eal_str = re.sub(re_w_pci_str, '', eal_param)
-        other_eal_str = re.sub(re_b_pci_str, '', other_eal_str)
-        other_eal_str = re.sub(re_file_prefix_str, '', other_eal_str)
-
-        no_pci = False
-        if '--no-pci' in other_eal_str:
-            no_pci = True
-            other_eal_str = other_eal_str.replace('--no-pci','')
-
-        return pci_list, has_pci_option, b_pci_list, file_prefix, no_pci, other_eal_str
-
-    def start_testpmd(self, cores='default', param='', eal_param='', socket=0, fixed_prefix=False, **config):
         config['cores'] = cores
-        if eal_param == '':
-            # use configured ports if not set
-            if 'ports' not in list(config.keys()):
-                config['ports'] = [self.dut.ports_info[i]['pci'] for i in range(len(self.dut.ports_info))]
-            all_eal_param = self.dut.create_eal_parameters(fixed_prefix=fixed_prefix, socket=socket, **config)
-        else:
-            w_pci_list, port_options, b_pci_list, file_prefix, no_pci, other_eal_str = self.split_eal_param(eal_param)
-            config['other_eal_param'] = other_eal_str
-            if no_pci:
-                config['no_pci'] = no_pci
-            if w_pci_list:
-                config['ports'] = w_pci_list
-            if port_options:
-                config['port_options'] = port_options
-            if b_pci_list:
-                config['b_ports'] = b_pci_list
-            if file_prefix:
-                config['prefix'] = file_prefix
-
-            if not w_pci_list and not b_pci_list and 'ports' not in list(config.keys()):
-                config['ports'] = [self.dut.ports_info[i]['pci'] for i in range(len(self.dut.ports_info))]
-            part_eal_param = self.dut.create_eal_parameters(fixed_prefix=fixed_prefix, socket=socket, **config)
-            all_eal_param = part_eal_param + ' ' + other_eal_str
+        if ' -w ' not in eal_param and ' -a ' not in eal_param and ' -b ' not in eal_param \
+            and 'ports' not in config and 'b_ports' not in config and ' --no-pci ' not in eal_param \
+            and ( 'no_pci' not in config or ('no_pci' in config and config['no_pci'] != True)):
+            config['ports'] = [self.dut.ports_info[i]['pci'] for i in range(len(self.dut.ports_info))]
+        part_eal_param = self.dut.create_eal_parameters(fixed_prefix=fixed_prefix, socket=socket, **config)
+        all_eal_param = part_eal_param + ' ' + eal_param
 
         app_name = self.dut.apps_name['test-pmd']
         command = app_name + " %s -- -i %s" % (all_eal_param, param)
+        command = command.replace('  ', ' ')
         if self.session != self.dut:
             self.session.send_expect("cd %s" % self.dut.base_dir, "# ")
         out = self.session.send_expect(command, "testpmd> ", 120)
-- 
2.17.1


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

* [dts] [PATCH V1 2/2] framework/dut: replace "-w" with "-a"
  2020-12-23  8:24 [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Haiyang Zhao
  2020-12-23  8:24 ` [dts] [PATCH V1 1/2] framework/pmd_output: " Haiyang Zhao
@ 2020-12-23  8:24 ` Haiyang Zhao
  2020-12-23  8:35 ` [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Zhao, HaiyangX
  2020-12-24  3:03 ` Tu, Lijuan
  3 siblings, 0 replies; 5+ messages in thread
From: Haiyang Zhao @ 2020-12-23  8:24 UTC (permalink / raw)
  To: lijuan.tu, dts; +Cc: Haiyang Zhao

replace "-w" with "-a" when config is empty.

Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
 framework/dut.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/framework/dut.py b/framework/dut.py
index db0d7df6..c4301df3 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -208,11 +208,12 @@ class Dut(Crb):
                           + blank + no_pci \
                           + blank + vdev
         else:
+            allow_option = '-a' if self.dpdk_version > '20.11.0-rc3' or self.dpdk_version == '20.11.0' else '-w'
             # get pci from ports_info
             pci_list = []
             if len(self.ports_info) != 0:
                 for port_info in self.ports_info:
-                    pci_list.append('-w %s' % port_info['pci'])
+                    pci_list.append('%s %s' % (allow_option, port_info['pci']))
             self.logger.info(pci_list)
             pci_str = ' '.join(pci_list)
             # default cores '1S/2C/1T'
-- 
2.17.1


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

* Re: [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd
  2020-12-23  8:24 [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Haiyang Zhao
  2020-12-23  8:24 ` [dts] [PATCH V1 1/2] framework/pmd_output: " Haiyang Zhao
  2020-12-23  8:24 ` [dts] [PATCH V1 2/2] framework/dut: replace "-w" with "-a" Haiyang Zhao
@ 2020-12-23  8:35 ` Zhao, HaiyangX
  2020-12-24  3:03 ` Tu, Lijuan
  3 siblings, 0 replies; 5+ messages in thread
From: Zhao, HaiyangX @ 2020-12-23  8:35 UTC (permalink / raw)
  To: Tu, Lijuan, dts

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

Tested-by:  Haiyang Zhao <haiyangx.zhao@intel.com>

Best Regards,
Zhao Haiyang

> -----Original Message-----
> From: Haiyang Zhao <haiyangx.zhao@intel.com>
> Sent: Wednesday, December 23, 2020 16:24
> To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org
> Cc: Zhao, HaiyangX <haiyangx.zhao@intel.com>
> Subject: [dts][PATCH V1 0/2] framework: fix a bug in start_testpmd


[-- Attachment #2: test_eal.log --]
[-- Type: application/octet-stream, Size: 18490 bytes --]

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

* Re: [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd
  2020-12-23  8:24 [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Haiyang Zhao
                   ` (2 preceding siblings ...)
  2020-12-23  8:35 ` [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Zhao, HaiyangX
@ 2020-12-24  3:03 ` Tu, Lijuan
  3 siblings, 0 replies; 5+ messages in thread
From: Tu, Lijuan @ 2020-12-24  3:03 UTC (permalink / raw)
  To: Zhao, HaiyangX, dts; +Cc: Zhao, HaiyangX

> this patchset fixed the bug reconfignizing eal param like "-a
> af:00.0,representor=0-1" failed, and optmized the eal parameter reassmeble
> method.
> 
> replaced "-w" with "-a" in create_eal_parameters.
> 
> Haiyang Zhao (2):
>   framework/pmd_output: fix a bug in start_testpmd
>   framework/dut: replace "-w" with "-a"

Applied

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

end of thread, other threads:[~2020-12-24  3:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23  8:24 [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Haiyang Zhao
2020-12-23  8:24 ` [dts] [PATCH V1 1/2] framework/pmd_output: " Haiyang Zhao
2020-12-23  8:24 ` [dts] [PATCH V1 2/2] framework/dut: replace "-w" with "-a" Haiyang Zhao
2020-12-23  8:35 ` [dts] [PATCH V1 0/2] framework: fix a bug in start_testpmd Zhao, HaiyangX
2020-12-24  3:03 ` Tu, Lijuan

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git