From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99E0BA2F6B for ; Tue, 8 Oct 2019 04:22:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 902E21C0AF; Tue, 8 Oct 2019 04:22:24 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 353421C02D for ; Tue, 8 Oct 2019 04:22:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2019 19:22:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,269,1566889200"; d="scan'208";a="223103407" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 07 Oct 2019 19:22:21 -0700 Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 7 Oct 2019 19:22:21 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 7 Oct 2019 19:22:20 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.119]) with mapi id 14.03.0439.000; Tue, 8 Oct 2019 10:22:17 +0800 From: "Chen, Zhaoyan" To: "Mei, JianweiX" , "dts@dpdk.org" CC: "Ma, LihongX" , "Chen, Zhaoyan" Thread-Topic: [dts][PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd Thread-Index: AQHVdRBySQJJdXuKCkqqS4jkwXWNmKdQFEPQ Date: Tue, 8 Oct 2019 02:22:17 +0000 Message-ID: <9DEEADBC57E43F4DA73B571777FECECA41DD736D@SHSMSX104.ccr.corp.intel.com> References: <1569605698-316544-1-git-send-email-jianweix.mei@intel.com> <1569605698-316544-5-git-send-email-jianweix.mei@intel.com> In-Reply-To: <1569605698-316544-5-git-send-email-jianweix.mei@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Acked-by: Chen, Zhaoyan Regards, Zhaoyan Chen > -----Original Message----- > From: Mei, JianweiX > Sent: Saturday, September 28, 2019 1:35 AM > To: dts@dpdk.org > Cc: Chen, Zhaoyan ; Ma, LihongX ; > Mei, JianweiX > Subject: [dts][PATCH V1 5/6] framework/pmd_output.py: overwrite function > start_testpmd >=20 > From: meijx >=20 > overwrite start_testpmd according to create EAL parameters. >=20 > Signed-off-by: meijx > --- > framework/pmd_output.py | 79 > +++++++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 70 insertions(+), 9 deletions(-) >=20 > diff --git a/framework/pmd_output.py b/framework/pmd_output.py index > 4cb8fed..bcb3865 100644 > --- a/framework/pmd_output.py > +++ b/framework/pmd_output.py > @@ -103,17 +103,78 @@ class PmdOutput(): > def get_pmd_cmd(self): > return self.command >=20 > - def start_testpmd(self, cores, param=3D'', eal_param=3D'', socket=3D= 0): > + def split_eal_param(self, eal_param): > + """ > + split eal param from test suite > + :param eal_param: > + :return: > + """ > + re_w_pci_str =3D '-w\\s+.+?:.+?:.+?\\..+?[,.*=3D\d+]?\s' > + re_file_prefix_str =3D '--file-prefix=3D.+?\s' > + re_b_pci_str =3D '-b\\s+.+?:.+?:.+?\\..+?[,.*=3D\d+]?\s' > + eal_param =3D eal_param + ' ' > + # pci_str_list eg: ['-w 0000:1a:00.0 ', '-w 0000:1a:00.1,queue= -num-per-vf=3D4 ', > '-w 0000:aa:bb.1,queue-num-per-vf=3D4 '] > + w_pci_str_list =3D re.findall(re_w_pci_str, eal_param) > + # file_prefix_str eg: ['--file-prefix=3Ddpdk '] > + file_prefix_str =3D re.findall(re_file_prefix_str, eal_param) > + b_pci_str_list =3D re.findall(re_b_pci_str, eal_param) > + has_pci_option =3D {} > + pci_list =3D [] > + if w_pci_str_list: > + for pci_str in w_pci_str_list: > + # has pci options > + if ',' in pci_str: > + pci_option =3D pci_str.split(',') > + pci =3D pci_option[0].split(' ')[-1] > + has_pci_option[pci] =3D pci_option[1].strip() > + pci_list.append(pci) > + else: > + pci_list.append(pci_str.split('-w')[-1].strip()) > + > + b_pci_list =3D [] > + if b_pci_str_list: > + for b_pci in b_pci_str_list: > + tmp =3D b_pci.split('-b')[1].strip() > + b_pci_list.append(tmp) > + > + file_prefix =3D '' > + if file_prefix_str: > + tmp =3D file_prefix_str[0].split('=3D') > + file_prefix =3D tmp[1].strip() >=20 > - if type(cores) =3D=3D list: > - core_list =3D cores > - elif cores =3D=3D "Default": > - core_list =3D self.dut.get_core_list(self.default_cores) > + other_eal_str =3D re.sub(re_w_pci_str, '', eal_param) > + other_eal_str =3D re.sub(re_b_pci_str, '', other_eal_str) > + other_eal_str =3D re.sub(re_file_prefix_str, '', other_eal_str) > + > + no_pci =3D False > + if '--no-pci' in other_eal_str: > + no_pci =3D True > + other_eal_str =3D 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=3D'default', param=3D'', eal_param=3D'= ', socket=3D0, > fixed_prefix=3DFalse, **config): > + config['cores'] =3D cores > + if eal_param =3D=3D '': > + # use configured ports > + config['ports'] =3D [self.dut.ports_info[i]['pci'] for i in > range(len(self.dut.ports_info))] > + all_eal_param =3D > + self.dut.create_eal_parameters(fixed_prefix=3Dfixed_prefix, > + socket=3Dsocket, **config) > else: > - core_list =3D self.dut.get_core_list(cores, socket=3Dsocket) > - self.coremask =3D create_mask(core_list) > - command =3D "./%s/app/testpmd -c %s -n %d %s -- -i %s" \ > - % (self.dut.target, self.coremask, self.dut.get_memory_chann= els(), eal_param, > param) > + w_pci_list, port_options, b_pci_list, file_prefix, no_pci, o= ther_eal_str =3D > self.split_eal_param(eal_param) > + if no_pci: > + config['no_pci'] =3D no_pci > + elif not w_pci_list and not b_pci_list: > + config['ports'] =3D [self.dut.ports_info[i]['pci'] for i= in > range(len(self.dut.ports_info))] > + config['prefix'] =3D file_prefix > + else: > + config['ports'] =3D w_pci_list > + config['port_options'] =3D port_options > + config['b_ports'] =3D b_pci_list > + config['prefix'] =3D file_prefix > + part_eal_param =3D self.dut.create_eal_parameters(fixed_pref= ix=3Dfixed_prefix, > socket=3Dsocket, **config) > + all_eal_param =3D part_eal_param + ' ' + other_eal_str > + > + command =3D "./%s/app/testpmd %s -- -i %s" % (self.dut.target, > + all_eal_param, param) > out =3D self.session.send_expect(command, "testpmd> ", 120) > self.command =3D command > # wait 10s to ensure links getting up before test start. > -- > 1.8.3.1