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 6EF4BA0524; Mon, 7 Dec 2020 10:59:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5D6A5C8E6; Mon, 7 Dec 2020 10:59:33 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 300B1C8C4 for ; Mon, 7 Dec 2020 10:59:30 +0100 (CET) IronPort-SDR: NuQiStB9A/eGq0osX0A09EjtnpqlP5l0TjBy2MueIE4IEWQCJc0JUG23ebomfLrxLWtaE6KFzu 4F7pVOk65Tyw== X-IronPort-AV: E=McAfee;i="6000,8403,9827"; a="173783182" X-IronPort-AV: E=Sophos;i="5.78,399,1599548400"; d="scan'208";a="173783182" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2020 01:59:29 -0800 IronPort-SDR: L5w3SMDmDl65zE8n4BJ/6TTZ7beB5Hyrcu7bhAwo4fh1k9pt+dfYxqhe0YeYWwSSRfDQl0H2I4 1nzIvRJdhoTg== X-IronPort-AV: E=Sophos;i="5.78,399,1599548400"; d="scan'208";a="541448215" Received: from unknown (HELO localhost.localdomain) ([10.240.183.57]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2020 01:59:27 -0800 From: Haiyang Zhao To: lijuan.tu@intel.com, dts@dpdk.org Cc: Haiyang Zhao Date: Mon, 7 Dec 2020 17:53:02 +0800 Message-Id: <20201207095302.2133-3-haiyangx.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201207095302.2133-1-haiyangx.zhao@intel.com> References: <20201207095302.2133-1-haiyangx.zhao@intel.com> Subject: [dts] [PATCH V1 2/2] framework/pmd_output: add -a support in split_eal_param 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" add -a support and optmize the regular expression. Signed-off-by: Haiyang Zhao --- 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