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 33C6CA0613 for ; Fri, 27 Sep 2019 10:48:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2C0D4343C; Fri, 27 Sep 2019 10:48:57 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 7D5022E8F for ; Fri, 27 Sep 2019 10:48:55 +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 orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2019 01:48:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,554,1559545200"; d="scan'208";a="219706392" Received: from unknown (HELO dpdk-meijianwei-tester.sh.intel.com) ([10.240.179.33]) by fmsmga002.fm.intel.com with ESMTP; 27 Sep 2019 01:48:53 -0700 From: Jianwei Mei To: dts@dpdk.org Cc: zhaoyan.chen@intel.com, lihongx.ma@intel.com, meijx Date: Sat, 28 Sep 2019 01:34:57 +0800 Message-Id: <1569605698-316544-5-git-send-email-jianweix.mei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569605698-316544-1-git-send-email-jianweix.mei@intel.com> References: <1569605698-316544-1-git-send-email-jianweix.mei@intel.com> Subject: [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" From: meijx overwrite start_testpmd according to create EAL parameters. Signed-off-by: meijx --- framework/pmd_output.py | 79 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 9 deletions(-) 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 - def start_testpmd(self, cores, param='', eal_param='', socket=0): + def split_eal_param(self, eal_param): + """ + split eal param from test suite + :param eal_param: + :return: + """ + re_w_pci_str = '-w\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s' + re_file_prefix_str = '--file-prefix=.+?\s' + re_b_pci_str = '-b\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s' + 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 '] + 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 + 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) + else: + pci_list.append(pci_str.split('-w')[-1].strip()) + + 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 = '' + if file_prefix_str: + tmp = file_prefix_str[0].split('=') + file_prefix = tmp[1].strip() - if type(cores) == list: - core_list = cores - elif cores == "Default": - core_list = self.dut.get_core_list(self.default_cores) + 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 + 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: - core_list = self.dut.get_core_list(cores, socket=socket) - self.coremask = create_mask(core_list) - command = "./%s/app/testpmd -c %s -n %d %s -- -i %s" \ - % (self.dut.target, self.coremask, self.dut.get_memory_channels(), eal_param, param) + w_pci_list, port_options, b_pci_list, file_prefix, no_pci, other_eal_str = self.split_eal_param(eal_param) + if no_pci: + config['no_pci'] = no_pci + elif not w_pci_list and not b_pci_list: + config['ports'] = [self.dut.ports_info[i]['pci'] for i in range(len(self.dut.ports_info))] + config['prefix'] = file_prefix + else: + config['ports'] = w_pci_list + config['port_options'] = port_options + config['b_ports'] = b_pci_list + config['prefix'] = file_prefix + part_eal_param = self.dut.create_eal_parameters(fixed_prefix=fixed_prefix, socket=socket, **config) + all_eal_param = part_eal_param + ' ' + other_eal_str + + command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, all_eal_param, param) out = self.session.send_expect(command, "testpmd> ", 120) self.command = command # wait 10s to ensure links getting up before test start. -- 1.8.3.1