From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C9F7FA0A0A; Wed, 24 Mar 2021 03:29:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 947864067B; Wed, 24 Mar 2021 03:29:06 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id E034740151 for ; Wed, 24 Mar 2021 03:29:04 +0100 (CET) IronPort-SDR: Uel6La01OP/jnyxQTSCVhuGX+nk5xWJJy1zb0fBIyvgZw4xFloSZyRxhmK1nLbCywqt/6nUbor 6dZukpH3sXmw== X-IronPort-AV: E=McAfee;i="6000,8403,9932"; a="254608449" X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="254608449" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 19:29:03 -0700 IronPort-SDR: KBhaxpcO5d3cWKtPqnzwHDNIsAT0+/27LXuSPYhrX734OdY4fYnWlyoTX1+c4/LX0mgkL/mLlm GBICkqQw2waw== X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="408619668" Received: from unknown (HELO localhost.localdomain.localdomain) ([10.240.183.111]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 19:29:01 -0700 From: Zhou Jun To: dts@dpdk.org Cc: Zhou Jun Date: Wed, 24 Mar 2021 10:25:46 +0800 Message-Id: <1616552746-21134-1-git-send-email-junx.w.zhou@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH V2] tests/malicious_driver_event_indication:code for optimizing the start mode of VF X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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" v1: the original way:copy testpmd to another file and start VF now:start VF with another profix file on the testpmd start PF v2: modifying nonstandard variable naming Signed-off-by: Zhou Jun --- .../TestSuite_malicious_driver_event_indication.py | 43 ++++++++-------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/tests/TestSuite_malicious_driver_event_indication.py b/tests/TestSuite_malicious_driver_event_indication.py index 44859ab..8b446cf 100644 --- a/tests/TestSuite_malicious_driver_event_indication.py +++ b/tests/TestSuite_malicious_driver_event_indication.py @@ -38,6 +38,7 @@ import re import time import traceback from contextlib import contextmanager +from pmd_output import PmdOutput from exception import VerifyFailure @@ -159,28 +160,12 @@ class TestSuiteMaliciousDrvEventIndication(TestCase): def init_vf_testpmd(self): self.vf_pmd_session_name = 'vf_testpmd' self.vf_pmd_session = self.dut.create_session(self.vf_pmd_session_name) - self.vf_testpmd = "{}/{}/app/testpmd_vf".format( - self.target_dir, self.dut.target) - cmd = 'rm -f {vf_pmd};cp -f {pf_pmd} {vf_pmd}'.format( - **{'pf_pmd': self.pf_testpmd, 'vf_pmd': self.vf_testpmd}) - self.d_a_con(cmd) + self.vf_pmdout = PmdOutput(self.dut, self.vf_pmd_session) def start_vf_testpmd(self): - core_mask = utils.create_mask(self.vf_pmd_cores) - cmd = ( - "{bin} " - "-v " - "-c {core_mask} " - "-n {mem_channel} " - "--file-prefix={prefix} " - "{whitelist} " - "-- -i ").format(**{ - 'bin': self.vf_testpmd, - 'core_mask': core_mask, - 'mem_channel': self.dut.get_memory_channels(), - 'whitelist': self.vf_pmd_whitelist, - 'prefix': 'vf_pmd', }) - self.vf_pmd_con([cmd, "testpmd> ", 120]) + self.vf_pmdout.start_testpmd(self.vf_pmd_cores, + eal_param="-v {}".format(self.vf_pmd_allowlst), + prefix='vf_pmd') self.is_vf_pmd_on = True cmds = [ 'set fwd txonly', @@ -269,7 +254,7 @@ class TestSuiteMaliciousDrvEventIndication(TestCase): corelist = self.dut.get_core_list("1S/6C/1T", socket=socket)[2:] self.pf_pmd_whitelist = '-w ' + self.vf_ports_info[0].get('pf_pci') self.pf_pmd_cores = corelist[:2] - self.vf_pmd_whitelist = '-w ' + self.vf_ports_info[0].get('vfs_pci')[0] + self.vf_pmd_allowlst = '-w ' + self.vf_ports_info[0].get('vfs_pci')[0] self.vf_pmd_cores = corelist[2:] def init_params(self): @@ -278,11 +263,6 @@ class TestSuiteMaliciousDrvEventIndication(TestCase): def preset_test_environment(self): self.preset_dpdk_compilation() - self.init_pf_testpmd() - self.init_vf_testpmd() - self.vf_create() - # get socket and cores - self.preset_pmd_res() def destroy_resource(self): with self.restore_dpdk_compilation(): @@ -297,7 +277,6 @@ class TestSuiteMaliciousDrvEventIndication(TestCase): """ Run at the start of each test suite. """ - self.init_params() self.dut_ports = self.dut.get_ports(self.nic) self.verify(len(self.dut_ports) >= 1, "Not enough ports") self.verify_supported_nic() @@ -314,13 +293,21 @@ class TestSuiteMaliciousDrvEventIndication(TestCase): """ Run before each test case. """ - pass + self.init_params() + self.init_pf_testpmd() + self.init_vf_testpmd() + self.vf_create() + self.preset_pmd_res() def tear_down(self): """ Run after each test case. """ self.dut.kill_all() + self.vf_destroy() + if self.vf_pmd_session: + self.dut.close_session(self.vf_pmd_session) + self.vf_pmd_session = None def test_malicious_driver_event_detected(self): """ -- 1.8.3.1