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 2CD34A051A; Fri, 17 Jan 2020 03:27:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BCA7B1D540; Fri, 17 Jan 2020 03:27:16 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 3DF8D1D52D for ; Fri, 17 Jan 2020 03:27:15 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2020 18:27:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,327,1574150400"; d="scan'208";a="220590265" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.222]) by fmsmga008.fm.intel.com with ESMTP; 16 Jan 2020 18:27:14 -0800 From: yufengmx To: dts@dpdk.org, lijuan.tu@intel.com Cc: yufengmx Date: Fri, 17 Jan 2020 10:29:54 +0800 Message-Id: <20200117022954.21597-3-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200117022954.21597-1-yufengx.mo@intel.com> References: <20200117022954.21597-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1 2/2] tests/l3fwd: support set test ports in cfg file 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 key to select custom dut ports to run testing. If not set this key in cfg file, use default dut port list of dts framework. Signed-off-by: yufengmx --- tests/l3fwd_base.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/l3fwd_base.py b/tests/l3fwd_base.py index 3fbf71f..0e51418 100644 --- a/tests/l3fwd_base.py +++ b/tests/l3fwd_base.py @@ -63,6 +63,7 @@ class L3fwdBase(object): def l3fwd_init(self, valports, socket): self.__valports = valports + self.__white_list = None self.__socket = socket self.__nic_name = self.nic self.__pkt_typ = 'udp' @@ -384,6 +385,7 @@ class L3fwdBase(object): "{bin} " "-c {cores} " "-n {channel} " + "{whitelist}" "-- " "-p {port_mask} " "--config '{config}'" @@ -391,6 +393,7 @@ class L3fwdBase(object): 'bin': bin, 'cores': core_mask, 'channel': self.dut.get_memory_channels(), + 'whitelist': self.__white_list if self.__white_list else '', 'port_mask': utils.create_mask(self.__valports), 'config': config, }) if self.nic == "niantic": @@ -701,7 +704,30 @@ class L3fwdBase(object): return test_content + def __get_whitelist(self, port_list): + white_list = '' + for port_index in port_list: + pci = self.dut.ports_info[port_index].get('pci') + if not pci: + continue + white_list += '-w {} '.format(pci) + return white_list + + def __preset_port_list(self, test_content): + port_list = test_content.get('port_list') + if port_list: + if not set(port_list).issubset(set(self.__valports)): + msg = 'total ports are {}, select ports are wrong'.format(pformat(self.__valports)) + raise VerifyFailure(msg) + else: + msg = 'current using {} for testing'.format(pformat(port_list)) + self.logger.warning(msg) + self.__valports = port_list + self.__white_list = self.__get_whitelist(port_list) + def l3fwd_preset_test_environment(self, test_content): + # if user set port list in cfg file, use + self.__preset_port_list(test_content) # get test content self.__test_content = self.__get_test_content_from_cfg(test_content) # binary process flag -- 2.21.0